Hello! This is simple script which guarantees you protection of your player while you're pissing (OOC)
.
All you need is just to paste this code:
In the beginning:
[pawn]
new playerisafk[MAX_PLAYERS];
new Float:px, Float:py, Float:pz;
[/pawn]
In
public OnPlayerText(playerid, text[])
[pawn]
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(strfind(text, "!afk", true, 0) != -1)
{
if(!playerisafk[playerid])
{
GetPlayerPos(playerid, px, py, pz);
new string[256];
format(string, sizeof(string), "%s is now AFK (Away from keyboard).", pname);
SendClientMessageToAll(0xFF875AA, string);
SetPlayerPos(playerid, 474.23223, -1717.48022, 62.5, 135, 0); // change date coords on your own (I've made it lighthouse's rooftop for a standart
.
TogglePlayerControllable(playerid, 0);
playerisafk[playerid]=1;
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You are still in the AFK mode.");
}
return 1;
}
else if(strfind(text, "!back", true, 0) != -1)
{
if(!playerisafk[playerid])
{
SendClientMessage(playerid, 0xFF0000AA, "You are not in the AFK mode.");
}
else
{
new string2[256];
format(string2, sizeof(string2), "%s is now Back", pname);
SendClientMessageToAll(0xFF875AA, string2);
SetPlayerPos(playerid, px, py, pz, 0, 0);
TogglePlayerControllable(playerid, 1);
playerisafk[playerid]=0;
}
return 1;
}
[/pawn]
I tried to make it mo' advanced, so:
1st. You can't use !afk if you're already afk - it is for anti-abusing, 4 example, flooding.
2nd. You can't use !back if you aren't afk - specially for old people with sclerosis.
3rd. !back will return you to the place whr you used !afk.
Dank je voor uw aandacht
.