AFK cmd makes the server restart why - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: AFK cmd makes the server restart why (
/showthread.php?tid=598880)
AFK cmd makes the server restart why -
KillerStrike23 - 17.01.2016
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");
}
Re: AFK cmd makes the server restart why -
Siman - 18.01.2016
Try
PHP код:
CMD:afk(playerid,params[])
{
#pragma unused params
if(IsPlayerAdmin(playerid))
{
if(PlayerInfo[playerid][Afk] == 0)
{
PlayerInfo[playerid][Afk] = 1;
SetPlayerHealth(playerid,100000);
TogglePlayerControllable(playerid, false);
SendClientMessage(playerid,green,"AFK ON");
SetPlayerInterior(playerid,6);
SetPlayerPos(playerid,265.1273,77.6823,1001.0391);
SetPlayerFacingAngle(playerid,271.3259);
SendClientMessageToAll(yellow,"[INFO]:%s is now away from keyboard, you can't reach him!");
return true;
}
else
{
PlayerInfo[playerid][Afk] = 0;
SetPlayerHealth(playerid,100);
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid,red,"AFK OFF");
SendClientMessageToAll(yellow,"[INFO]:%s is not away anymore, now you can reach him!");
return true;
}
}
return SendClientMessage(playerid,red,"ERROR: You must be registered and logged in to use this feature");
}
Re: AFK cmd makes the server restart why -
Gammix - 18.01.2016
I guess its because you are using characters in a unformated function:
Код:
SendClientMessageToAll(yellow, "[INFO]:%s is not away anymore, now you can reach him!");
Use
format for such purpose. (remove %s)
Re: AFK cmd makes the server restart why -
KillerStrike23 - 18.01.2016
thanks bro i really didn't see it i formated it now! best regards