Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //afk
- new playerAfk[EXMPLAYERS];
- new playerAfkTimer[EXMPLAYERS];
- cmd(afk)
- {
- if(gettime() - CallRemoteFunction("getPlayerLastNegative", "i", playerid) < 10)
- {
- return xSendResultMessage(playerid, 0, "You cannot use this command in open conflict.");
- }
- if(GetPlayerState(playerid) == PLAYER_STATE_WASTED) {
- return xSendResultMessage(playerid, 0, "You cannot use this command now.");
- }
- denyCommandAccess(t == 20);
- if(!playerAfk[playerid])
- {
- playerAfk[playerid] = 1;
- GameTextForPlayer(playerid, "~y~AFK MODE ~n~~w~Type ~g~/afk~w~ to return to the game.", 4000, 4);
- SendClientMessage(playerid, 0xFFF000FF, "You are in {FF0000}AFK{FFF000} Mode. Type {FF0000}/afk{FFF000} to return to the game.");
- playerAfkTimer[playerid] = SetTimerEx("afkTimer", 10000, 1, "d", playerid);
- notifyPrivateEvent("%s went /afk.", playerNick[playerid]);
- TogglePlayerSpectating(playerid, 1);
- afkTimer(playerid);
- CallRemoteFunction("setPlayerSpawnedFalse", "i", playerid);
- }
- else
- {
- playerAfk[playerid] = 0;
- KillTimer(playerAfkTimer[playerid]);
- TogglePlayerSpectating(playerid, 0);
- notifyPrivateEvent("%s is back.", playerNick[playerid]);
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment