stock
RandPlayerID()
{
new
OnLine[MAX_PLAYERS],
OnLineCount = -1;
for(new i = 0, gmp = GetMaxPlayers(); i < gmp; i++)
{
if(IsPlayerConnected(i))
OnLine[++OnLineCount] = i;
}
return (OnLineCount > -1)?(OnLine[random(OnLineCount + 1)]):(INVALID_PLAYER_ID);
}
stock
pName(playerid)
{
new
R_PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, R_PlayerName, MAX_PLAYER_NAME);
return R_PlayerName;
}
COMMAND:sorsol(playerid)
{
new
str[128],
rand_id = RandPlayerID();
format(str, sizeof str, \"OnLine véletlenszerû playerid: %d name: %s\", rand_id, pName(rand_id));
SendClientMessage(playerid, -1, str);
return 1;
}