02.09.2018, 22:20
OnPlayerConnect
I joined a test sv with my friends, he goes afk, but instead changing his nickanem to _AFK_clown, i get it changed to myself instead, there's someting wrong with the "id's" cant figure out.
PHP код:
SetTimerEx("AFKCheck", 5000, 1, "i", playerid);
PHP код:
forward AFKCheck(playerid);
public AFKCheck(playerid)
{
new Float:Pos[3];
for(new i = 0; i < MAX_PLAYERS; i++)
{
GetPlayerPos(i,Pos[0],Pos[1],Pos[2]);
if(IsPlayerInRangeOfPoint(i,2,Pos[0],Pos[1],Pos[2]))
{
AFK[i]++;
}
if(AFK[i] == 60)
{
AFK[i] = 0;
Lounge[i] = true;
SetPlayerPos(i, -794.806396,497.738037,1376.195312);
SetPlayerInterior(i, 1);
SetPlayerVirtualWorld(i,10);
IsPlayerInLobby[i] = 1;
SetPlayerHealth(i, 99999);
ResetPlayerWeapons(i);
new string[250];
format(string, sizeof(string), "_AFK_%s", PlayerName[i]);
SetPlayerName(i, string);
SetPlayerColor(i, COLOR_GREY);
}
}
return 1;
}