CLEO Help Need help

CLEO related
Status
Not open for further replies.

Serioga

Member
Joined
Jan 31, 2017
Messages
7
Reaction score
0
Hello, how to detect if server have closed connection?
i want to make an auto reconnect
for example if server closes connection then 0C8F: samp process_chat_input "/rec"
i have tried to detect it with 0ad4 but it creates some sort of loop and server is restarting
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,492
Reaction score
236
Location
( ͡° ͜ʖ ͡°)
0B4F: samp 1@ = get_gamestate
IF
1@ == 5
????????????????????????????????????????
Try that one1^^
GAMESTATE_NONE = 0
GAMESTATE_WAIT_CONNECT = 1
GAMESTATE_AWAIT_JOIN = 2
GAMESTATE_CONNECTED = 3
GAMESTATE_RESTARTING = 4
GAMESTATE_DISCONNECTED = 5
 

Serioga

Member
Joined
Jan 31, 2017
Messages
7
Reaction score
0
Opcode.eXe said:
0B4F: samp 1@ = get_gamestate
IF
1@ == 5
????????????????????????????????????????
Try that one1^^
GAMESTATE_NONE = 0
GAMESTATE_WAIT_CONNECT = 1
GAMESTATE_AWAIT_JOIN = 2
GAMESTATE_CONNECTED = 3
GAMESTATE_RESTARTING = 4
GAMESTATE_DISCONNECTED = 5

How to exclude it for the first game launching?
 

Serioga

Member
Joined
Jan 31, 2017
Messages
7
Reaction score
0
Doesnt work then server closes connection in the middle of the game
How to force it reconnect when in chat appears "Server closed connection."?
I made reconnection part but i need detect those words
 

Serioga

Member
Joined
Jan 31, 2017
Messages
7
Reaction score
0
Code:
{$CLEO}
{$INCLUDE SF}
0000: NOP

wait 2000

alloc 4@ 256
0c11: memset 4@ 0 256

0BE3: raknet setup_incoming_rpc_hook @ClientMessage

while true
wait 0
end

:ClientMessage
0BE5: raknet 0@ = get_hook_param PARAM_BITSTREAM
0BE5: raknet 1@ = get_hook_param PARAM_PACKETID
if
1@ == RPC_ScrClientMessage // DWORD color, DWORD strLen, char[] msg
then
    0BE7: raknet 2@ = bit_stream_read 0@ type BS_TYPE_INT  
    0BE7: raknet 3@ = bit_stream_read 0@ type BS_TYPE_INT 
    0C11: memset destination 4@ value 0 size 256
    0BE8: raknet bit_stream 0@ read_array 4@ size 3@
    0C0F: array 4@ element 3@ = 0x00

if
0C18: 7@ = strstr string1 4@ string2 "Server closed the connection."
then
0C8F: samp process_chat_input "/rec 2"
end
end
Why it is crashing the game? Whats wrong here?
 
Status
Not open for further replies.
Top