How to make /afk - 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: How to make /afk (
/showthread.php?tid=211640)
How to make /afk -
Dannu13 - 15.01.2011
hy how i can make cmd /afk and /back how i can make when i write /afk my camerda has a slowli spin
bad english.. Sorry
Re: How to make /afk -
Jochemd - 15.01.2011
Search returned this (took me 2 seconds) ->
https://sampforum.blast.hk/showthread.php?tid=204575
Re: How to make /afk -
Dannu13 - 15.01.2011
Quote:
Originally Posted by Jochemd
|
i dont understant
bad english
Re: How to make /afk -
Toreno - 15.01.2011
Here's a little and simple code.
At the top of your script:
pawn Код:
new IsPlayerAFK[MAX_PLAYERS];
Under OnPlayerConnect(playerid)
pawn Код:
IsPlayerAFK[playerid] = 0;
Under OnPlayerCommandText(playerid, cmdtext[])
pawn Код:
new string[128], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(strcmp("/afk", cmdtext, true, 4) == 0)
{
if(!IsPlayerAFK[playerid])
{
format(string, sizeof(string), "** [ID: %d] %s is now AFK.",playerid,PlayerName);
SendClientMessageToAll(0xFFFFFFAA, string);
TogglePlayerControllable(playerid,0);
IsPlayerAFK[playerid] = 1;
}
else
{
format(string, sizeof(string), "** [ID: %d] %s is no longer AFK.",playerid,PlayerName);
SendClientMessageToAll(0xFFFFFFAA, string);
TogglePlayerControllable(playerid,1);
IsPlayerAFK[playerid] = 0;
}
return 1;
}