SA-MP Forums Archive
[SNIPPET] AFK and Back feature [NOOB FRIENDLY / SIMPLE] - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [SNIPPET] AFK and Back feature [NOOB FRIENDLY / SIMPLE] (/showthread.php?tid=129878)



[SNIPPET] AFK and Back feature [NOOB FRIENDLY / SIMPLE] - Jontay - 24.02.2010

Got bored today so I decided to read the forums and download a few scripts. What I found was that the majority of non roleplay servers didnt have an afk system, so heres a real simple one. Don't point out the problems, I don't care. If I get it wrong, dont blame me, its been a long time since I coded.

pawn Код:
// AFK and back feature by Jonty
// please dont remove this if its a public script, feel free to remove it if your script is private

// afk
if(strcmp(cmdtext, "/afk") == 0) //afk command
{
SetPlayerSpectating(playerid, 1); // I think its setplayerspectating, not sure.
SendClientMessage(playerid, COLOR_HERE, "You are now AFK. Type /back to return.");
return 1;
}
// back
if(strcmp(cmdtext, "/back") == 0) //back command
{
SetPlayerSpectating(playerid, 0); // I think its setplayerspectating, not sure.
SendClientMessage(playerid, COLOR_HERE, "Welcome back!");
return 1;
}
Put that in your
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])



Re: [SNIPPET] AFK and Back feature [NOOB FRIENDLY / SIMPLE] - [WSM]Deadly_Evil - 24.02.2010

Quote:
Originally Posted by Jonteh
Got bored today so I decided to read the forums and download a few scripts. What I found was that the majority of non roleplay servers didnt have an afk system, so heres a real simple one. Don't point out the problems, I don't care. If I get it wrong, dont blame me, its been a long time since I coded.
There are tons of Filterscripts and if the code is wrong Dont blame you?

Btw the code is correct and not bad work


Re: [SNIPPET] AFK and Back feature [NOOB FRIENDLY / SIMPLE] - Flake. - 24.02.2010

really simple but nice
in future versions you could add 3DTextLabels saying "I am AFK" or smth


Re: [SNIPPET] AFK and Back feature [NOOB FRIENDLY / SIMPLE] - Jontay - 25.02.2010

Or you could do:

pawn Код:
// AFK and back feature by Jonty
// please dont remove this if its a public script, feel free to remove it if your script is private

// afk
if(strcmp(cmdtext, "/afk") == 0) //afk command
{
SetPlayerSpectating(playerid, 1); // I think its setplayerspectating, not sure.
SendClientMessage(playerid, COLOR_HERE, "You are now AFK. Type /back to return.");
SetPlayerColor(playerid, COLOR_GREY);
return 1;
}
// back
if(strcmp(cmdtext, "/back") == 0) //back command
{
SetPlayerSpectating(playerid, 0); // I think its setplayerspectating, not sure.
SendClientMessage(playerid, COLOR_HERE, "Welcome back!");
SpawnPlayer(playerid);
SetPlayerColorToTeamColor(playerid);
return 1;
}



Re: [SNIPPET] AFK and Back feature [NOOB FRIENDLY / SIMPLE] - Rzzr - 25.02.2010

If you would have even tested this, or used the wiki, you would have found out that it is TogglePlayerSpectating and not SetPlayerSpectating.


Re: [SNIPPET] AFK and Back feature [NOOB FRIENDLY / SIMPLE] - Jontay - 27.02.2010

It took me a couple mins, I got bored at 1.00am, give me a damn break.