SA-MP Forums Archive
afk command help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: afk command help (/showthread.php?tid=83289)



afk command help - Idan_McCartney - 24.06.2009

i trying to do afk command and i want to check if you already freeze or not

Код:
 if (TogglePlayerControllable(playerid,0)) return SendClientMessage(playerid,0xFF000FFF,"You are already freezed");
it's don't work, it's type "You are already freezed" even if you not and it's make you freeze anyway


Re: afk command help - MenaceX^ - 24.06.2009

Make a variable.


Re: afk command help - abhinavdabral - 24.06.2009

dude ... TogglePlayerControllable(playerid,0) will always return 1 that is true and so you will always get that message .......... You have to create a variable at the stating like
Код:
new bool:IsPlayerFreezed[MAX_PLAYERS]=false;
And the place where you have your afk code .... add something like this
Код:
IsPlayerFreezed[playerid]=true;
now you can run it like this
Код:
if (IsPlayerFreezed[playerid])) return SendClientMessage(playerid,0xFF000FFF,"You are already freezed");
// Below this goes your BACK code //////
// add this one in BACK code too //
IsPlayerFreezed[playerid]=false;
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid,0xFF000FFF,"You have been un-freezed");
return 1;
Thank You
Abhinav