CLEO Help Sanny "Unknown opcode"

CLEO related
Status
Not open for further replies.

tjofi

Member
Joined
Apr 30, 2017
Messages
6
Reaction score
0
Hello there.

I found this reconnect.cs somewhere on this website and it works great when I place the original file in my cleo folder.

It lets me reconnect as if I quit the game (/q) and came back, but without having to exit the game.

The roleplay server I play on spawns me in my house whenever I join the game after disconnecting, but when I crash (timeout) it spawns me where I lost connection, which is why I always force-crash (start a new game while on the server).

So I wanted to change the script using Sanny, but apparently the opcodes that are already in the original script do not exist (are unknown to Sanny) and "Ignore_Unknown" is not working, I can't compile it.

This is the code:
Code:
{$CLEO .cs}
 
thread "Rejoin"
0662: NOP "Edit by [Monstercat]"
 
const
self = $PLAYER_ACTOR
VK_LSHIFT = 0xA0
VK_KEY_0 = 0x30
SAMP_BASE = 29@
 
DISCONNECT_QUIT = 0
DISCONNECT_TIMEOUT = 1
 
GAMESTATE_NONE = 0
GAMESTATE_WAIT_CONNECT = 1
GAMESTATE_AWAIT_JOIN = 2
GAMESTATE_CONNECTING = 3
GAMESTATE_CONNECTED = 4
GAMESTATE_RESTARTING = 5
GAMESTATE_DISCONNECTED = 6
 
TIME_RECONNECT = 15
end
 
if
  8AF7: get_samp_base_to SAMP_BASE
then
    0A93: end_custom_thread
end
repeat
    wait 400
until 0AFA: is_samp_structures_available
 
// ================================== MAIN ================================== //
 
while true
    wait 0
    if and
    player.Defined(0)
    8B21:  not samp is_chat_not_opened
    0AB0: VK_LSHIFT
    then
        if 0AB0: VK_KEY_0 
        then
            0B28: samp disconnect_with_reason DISCONNECT_QUIT
            wait TIME_RECONNECT
            0B27: samp set_gamestate GAMESTATE_WAIT_CONNECT
            repeat
            wait 20
            until 8AB0: VK_KEY_0
        end
        end
    end
 
// ============================== END OF MAIN ============================== //

Basically all I need is to change the
0B28: samp disconnect_with_reason DISCONNECT_QUIT
to
0B28: samp disconnect_with_reason DISCONNECT_TIMEOUT

Sanny isn't letting me do it, and when I simply edit the .cs file in notepad to change "QUIT" to "TIMEOUT", samp gets stuck on loading screen and eventually crashes.
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,116
Solutions
5
Reaction score
882
Location
Lithuania
Download.:
http://ugbase.eu/attachment.php?aid=4662

Then.:
- Copy all files from the "SB data" to "/Sanny Builder 3/data/sa".
 

tjofi

Member
Joined
Apr 30, 2017
Messages
6
Reaction score
0
Thanks, I managed to edit the file as well as to connect to the server.
However, when I use shift+0, it tells me:

[05:44:49] Connected. Joining the game...
[05:44:49] CONNECTION REJECTED: Unacceptable NickName
[05:44:49] Please choose another nick between and 3-20 characters
[05:44:49] Please use only a-z, A-Z, 0-9
[05:44:49] Use /quit to exit or press ESC and select Quit Game

So I need to /q anyway..

Edit: It does reconnect me after approximately 5 attempts which is annoying, is there a way to completely resolve this?
 

0x32789

Expert
Joined
May 26, 2014
Messages
849
Reaction score
51
Location
LongForgotten <-> 0x32789
tjofi said:
Thanks, I managed to edit the file as well as to connect to the server.
However, when I use shift+0, it tells me:

[05:44:49] Connected. Joining the game...
[05:44:49] CONNECTION REJECTED: Unacceptable NickName
[05:44:49] Please choose another nick between and 3-20 characters
[05:44:49] Please use only a-z, A-Z, 0-9
[05:44:49] Use /quit to exit or press ESC and select Quit Game

So I need to /q anyway..

Edit: It does reconnect me after approximately 5 attempts which is annoying, is there a way to completely resolve this?

add a wait timer after disconnecting.
e.g.
Code:
:main
DISCONNECT
wait 5000
RECONNECT
jump @main

whenever there is a lost connection in SA-MP server by player, The player is in SA-MP server but paused for like 4-5 seconds then he disconnects. You have to wait some time like 8 seconds or 5 seconds, Your gonna keep getting connection error unacceptable nickname because there is a person with same name which is you before the crash, wait for the timeout to process successfully and server to remove the player.
 

tjofi

Member
Joined
Apr 30, 2017
Messages
6
Reaction score
0
I'm not familiar with scripting, can you add it to this code so I can copy the entire thing and modify my current script with that thing added?

Code:
{$CLEO .cs}
 
thread "Rejoin"
0662: NOP "Edit by [Monstercat]"
 
const
self = $PLAYER_ACTOR
VK_LSHIFT = 0xA0
VK_KEY_0 = 0x30
SAMP_BASE = 29@
 
DISCONNECT_QUIT = 0
DISCONNECT_TIMEOUT = 1
 
GAMESTATE_NONE = 0
GAMESTATE_WAIT_CONNECT = 1
GAMESTATE_AWAIT_JOIN = 2
GAMESTATE_CONNECTING = 3
GAMESTATE_CONNECTED = 4
GAMESTATE_RESTARTING = 5
GAMESTATE_DISCONNECTED = 6
 
TIME_RECONNECT = 15
end
 
if
  8AF7: get_samp_base_to SAMP_BASE
then
    0A93: end_custom_thread
end
repeat
    wait 400
until 0AFA: is_samp_structures_available
 
// ================================== MAIN ================================== //
 
while true
    wait 0
    if and
    player.Defined(0)
    8B21:  not samp is_chat_not_opened
    0AB0: VK_LSHIFT
    then
        if 0AB0: VK_KEY_0 
        then
            0B28: samp disconnect_with_reason DISCONNECT_TIMEOUT
            wait TIME_RECONNECT
            0B27: samp set_gamestate GAMESTATE_WAIT_CONNECT
            repeat
            wait 20
            until 8AB0: VK_KEY_0
        end
        end
    end
 
// ============================== END OF MAIN ============================== //
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,116
Solutions
5
Reaction score
882
Location
Lithuania
tjofi said:
I'm not familiar with scripting, can you add it to this code so I can copy the entire thing and modify my current script with that thing added?

Code:
{$CLEO .cs}
 
thread "Rejoin"
0662: NOP "Edit by [Monstercat]"
 
const
self = $PLAYER_ACTOR
VK_LSHIFT = 0xA0
VK_KEY_0 = 0x30
SAMP_BASE = 29@
 
DISCONNECT_QUIT = 0
DISCONNECT_TIMEOUT = 1
 
GAMESTATE_NONE = 0
GAMESTATE_WAIT_CONNECT = 1
GAMESTATE_AWAIT_JOIN = 2
GAMESTATE_CONNECTING = 3
GAMESTATE_CONNECTED = 4
GAMESTATE_RESTARTING = 5
GAMESTATE_DISCONNECTED = 6
 
TIME_RECONNECT = 15
end
 
if
  8AF7: get_samp_base_to SAMP_BASE
then
    0A93: end_custom_thread
end
repeat
    wait 400
until 0AFA: is_samp_structures_available
 
// ================================== MAIN ================================== //
 
while true
    wait 0
    if and
    player.Defined(0)
    8B21:  not samp is_chat_not_opened
    0AB0: VK_LSHIFT
    then
        if 0AB0: VK_KEY_0 
        then
            0B28: samp disconnect_with_reason DISCONNECT_TIMEOUT
            wait TIME_RECONNECT
            0B27: samp set_gamestate GAMESTATE_WAIT_CONNECT
            repeat
            wait 20
            until 8AB0: VK_KEY_0
        end
        end
    end
 
// ============================== END OF MAIN ============================== //

Try

[shcode=cpp]
{$CLEO .cs}

thread "Rejoin"
0662: NOP "Edit by [Monstercat]"

const
self = $PLAYER_ACTOR
VK_LSHIFT = 0xA0
VK_KEY_0 = 0x30
SAMP_BASE = 29@

DISCONNECT_QUIT = 0
DISCONNECT_TIMEOUT = 1

GAMESTATE_NONE = 0
GAMESTATE_WAIT_CONNECT = 1
GAMESTATE_AWAIT_JOIN = 2
GAMESTATE_CONNECTING = 3
GAMESTATE_CONNECTED = 4
GAMESTATE_RESTARTING = 5
GAMESTATE_DISCONNECTED = 6

TIME_RECONNECT = 5000
end

if
  8AF7: get_samp_base_to SAMP_BASE
then
    0A93: end_custom_thread
end
repeat
    wait 400
until 0AFA: is_samp_structures_available

// ================================== MAIN ================================== //

while true
    wait 0
    if and
    player.Defined(0)
    8B21:  not samp is_chat_not_opened
    0AB0: VK_LSHIFT
    then
        if 0AB0: VK_KEY_0 
        then
            0B28: samp disconnect_with_reason DISCONNECT_TIMEOUT
            wait TIME_RECONNECT
            0B27: samp set_gamestate GAMESTATE_WAIT_CONNECT
            repeat
            wait 20
            until 8AB0: VK_KEY_0
        end
        end
    end

// ============================== END OF MAIN ============================== //
[/shcode]
 

tjofi

Member
Joined
Apr 30, 2017
Messages
6
Reaction score
0
Thank you a lot!
I kept editing it until I reached the appropriate "TIME_RECONNECT" value so I don't get any rejection from the server upon attempt to reconnect, turns out "10000" is the minimum.
Much appreciated!
 
Status
Not open for further replies.
Top