KamikazeSripterul
Well-known member
- Joined
- Jun 30, 2019
- Messages
- 353
- Reaction score
- 23
So on the server i play, you get notified when a friend joins the server. (
). I have tried to get the name from the string, and edit the string but keeping the same name.. if that makes sense. Also, you can edit your desired sentence from game. So if you're in-game you can type /loginname Hi! Your friend %s has joined the game. Say hi! therefore i put this into an .ini file and used it to replace the original string from the server. %s will be the name from the original string. Now.. the problem is that my game just crashes when someone logs in, which is frustrating. I have tested to see if it was from the string or the nickname.. nothing wrong with that so i'm guessing the problem is somewhere at 0C18 or 0AD4.. not sure. Can anyone help or give any helping tips? Thanks in advance.
Code:
{$CLEO}
{$INCLUDE SF}
0000:
thread "LogInName"
repeat
wait 0
until SAMP.Available()
0BE3: raknet setup_incoming_rpc_hook @log_in
0B34: "loginname" @loginname
WHILE TRUE
WAIT 0
END
:loginname
IF SAMP.IsCommandTyped(20@)
THEN
0B2B: samp 2@ = get_player_id_by_actor_handle $PLAYER_ACTOR
0B36: samp 1@ = get_player_nickname 2@
chatmsg "Proccesing review..." 16711680
chatmsg 20@ -256 1@
0AF5: write_string 20@ to_ini_file "cleo\LoginName.ini" section "String" key "Sentence"
ELSE
chatmsg "{cecece}[LogInName]: {ffff00}Use /loginname <sentence>." -1
END
SAMP.CmdRet()
:log_in
0BE5: raknet 31@ = get_hook_param PARAM_PACKETID
IF 31@ == RPC_ScrClientMessage
THEN
alloc 28@ 129
alloc 11@ 128
0C11: memset destination 28@ value 0 size 129
0BE5: raknet 30@ = get_hook_param PARAM_BITSTREAM
0BE7: raknet 27@ = bit_stream_read 30@ type BS_TYPE_INT //color
0BE7: raknet 29@ = bit_stream_read 30@ type BS_TYPE_INT //lenght
0BE8: raknet bit_stream 30@ read_array 28@ size 29@ //string
0C0D: struct 28@ offset 29@ size 1 = 0
IF 0C18: $NOT_STRING = strstr string1 28@ string2 "s-a logat pe server."
THEN
0AD4: $NOT_USED = scan_string 10@ format "Prietenul tau, %s, s-a logat pe server." 5@
0AF4: 11@ = read_string_from_ini_file "cleo\LoginName.ini" section "String" key "Sentence"
chatmsg 11@ -256 5@
0BE0: raknet hook_ret false
END
IF 0C18: $NOT_STRING = strstr string1 28@ string2 "is now online."
THEN
0AD4: $NOT_USED = scan_string 10@ format "Your friend %s is now online." 5@
0AF4: 11@ = read_string_from_ini_file "cleo\LoginName.ini" section "String" key "Sentence"
chatmsg 11@ -256 5@
0BE0: raknet hook_ret false
END
free 11@
free 28@
END
0BE0: raknet hook_ret true