17.01.2016, 23:40
i made an afk command but whenever any player use it, the server crashes and stop working why ?
pawn Код:
CMD:afk(playerid,params[])
{
#pragma unused params
if(IsPlayerAdmin(playerid))
{
if(PlayerInfo[playerid][Afk] == 0)
{
PlayerInfo[playerid][Afk] = 1;
SetPlayerHealth(playerid,100000);
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid,green,"AFK ON");
SetPlayerInterior(playerid,6);
SetPlayerPos(playerid,265.1273,77.6823,1001.0391);
SetPlayerFacingAngle(playerid,271.3259);
return SendClientMessageToAll(yellow,"[INFO]:%s is now away from keyboard, you can't reach him!");
}
else
{
PlayerInfo[playerid][Afk] = 0;
SetPlayerHealth(playerid,100);
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid,red,"AFK OFF");
}
return SendClientMessageToAll(yellow,"[INFO]:%s is not away anymore, now you can reach him!");
}
else return SendClientMessage(playerid,red,"ERROR: You must be registered and logged in to use this feature");
}