0ACD: show_text_highpriority "Gmode: ~r~OFF~w~" time 1500
wait 200
0C8F: samp process_chat_input "/gmode"
0C8F crashes it, idk why but I guess it's because it tries to process a command while 1 command is already being executed and have not returned yet. Also it seems that "if 15@ == true" is not followed by "then" and "end" so maybe if 15@ turns false it will crash the code... Or it recognises identation which I didn't know and that's why "then/end" is not needed?
Anyway, I'd try running this:
Code:
{$CLEO .cs}
0000:
13@ = 1
15@ = TRUE
0B34: samp register_client_command "anti" to_label @GModeActivate
:Main
wait 0
if
056D: actor $PLAYER_ACTOR defined
jf @MAIN
00A0: store_actor $PLAYER_ACTOR position_to 3@ 4@ 5@
10@ = 100.0 //minimal distance
12@ = false //to check if there are any players around at all
0A8D: 29@ = read_memory 0xB74490 size 4 virtual_protect 0
000A: 29@ += 0x4
0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0
for 30@ = 0 to 35584 step 0x100
0A8D: 31@ = read_memory 29@ size 1 virtual_protect 0
000A: 29@ += 0x1
if and
0029: 31@ >= 0x00
001B: 0x80 > 31@
then
005A: 31@ += 30@
00A0: store_actor 31@ position_to 6@ 7@ 8@
050A: 9@ = distance_between_XYZ 3@ 4@ 5@ and_XYZ 6@ 7@ 8@
if and
0025: 10@ > 9@
0021: 9@ > 0.2 //idk if it's neccessary but I remember having some weird problems without it while making other mod so
//if
//0025: 10@ > 9@
then
0087: 10@ = 9@ // (float) to save the new closest distance found
0085: 11@ = 31@ // (int) to save the new closest player found
12@ = true
end
end
end
if 12@ == true
jf @Main
if
15@ == true
then
if and
10@ <= 3.0
13@ == 1
then
0C8F: samp process_chat_input "/gmode"
chatmsg "1" -1
wait 5000
end
if and
10@ >= 3.0
13@ == 0
then
0C8F: samp process_chat_input "/gmode"
chatmsg "2" -1
wait 5000
end
0B12: 13@ = 13@ XOR 1
end
jump @Main
:GModeActivate
0B12: 15@ = 15@ XOR true
if
15@ == true
then
0ACD: show_text_highpriority "Gmode: ~g~ON" time 1500
else
0ACD: show_text_highpriority "Gmode: ~r~OFF" time 1500
//0C8F: samp process_chat_input "/gmode"
end
0B43: samp cmd_ret
(I added 2x chatmsg and wait 5000 just for my "debugging")
If it's really necessary to have "0C8F" executed after deactivation then I'd replace it with something like:
Code:
else
0ACD: show_text_highpriority "Gmode: ~r~OFF" time 1500
16@ = true
end
and then at the begining of the main function add:
Code:
if 16@ == true
then
16@ = false
0C8F: samp process_chat_input "/gmode"
end