Hello ugbase, i request help to learn how to get the online player with highest number ID.
note: i know that "0C8A: samp 1@ = get_max_player_id streamed_only 0" gets the total of connected players and i can use that number to do what i want, BUT it doesn't work in my case, because the server i play on adds it's own npcs and these have ids between players, as example, if there are 100 connected players, the highest id from connected player is something like 188. this number is not precise.
What i try to achieve is the loop once, get highest number, and then rewrite 20@ to that value, i know how to do everything except get highest id number.
note: i know that "0C8A: samp 1@ = get_max_player_id streamed_only 0" gets the total of connected players and i can use that number to do what i want, BUT it doesn't work in my case, because the server i play on adds it's own npcs and these have ids between players, as example, if there are 100 connected players, the highest id from connected player is something like 188. this number is not precise.
What i try to achieve is the loop once, get highest number, and then rewrite 20@ to that value, i know how to do everything except get highest id number.
Code:
{$CLEO .cs}
0000: NOP
0B34: samp register_client_command "fc" @MAXPLAYER
20@ = 450
WHILE TRUE
WAIT 0
IF 20@ <> 0
THEN
IF 0AB0: key_pressed 32
THEN PRINTF "%d" 100 20@
END
FOR 0@ = 0 TO 20@ STEP 1
IF AND
8B64: samp is_player 0@ npc
0B23: samp is_player_connected 0@
THEN
0B36: samp 1@ = get_player_nickname 0@
IF 8C29: $NOT_USED = stristr string1 1@ string2 "npc" // ignore npcs
THEN
IF OR
0C14: 1@ "someone"
THEN
gosub @Rendstuff
END
// and then another 200 conditions like prevous one.
END
END
END
END
END
:MAXPLAYER
WAIT 0
0B35: samp 12@ = get_last_command_params
0AD4: 13@ = scan_string 12@ format "%d" 14@
0085: 20@ = 14@ // (int)
PRINTF "%d" 2000 20@
Samp.CmdRet()