Hellrocker

Untitled

Mar 22nd, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. //afk
  2. new playerAfk[EXMPLAYERS];
  3. new playerAfkTimer[EXMPLAYERS];
  4.  
  5. cmd(afk)
  6. {
  7.  
  8. if(gettime() - CallRemoteFunction("getPlayerLastNegative", "i", playerid) < 10)
  9. {
  10. return xSendResultMessage(playerid, 0, "You cannot use this command in open conflict.");
  11. }
  12.  
  13. if(GetPlayerState(playerid) == PLAYER_STATE_WASTED) {
  14. return xSendResultMessage(playerid, 0, "You cannot use this command now.");
  15. }
  16.  
  17. denyCommandAccess(t == 20);
  18. if(!playerAfk[playerid])
  19. {
  20. playerAfk[playerid] = 1;
  21. GameTextForPlayer(playerid, "~y~AFK MODE ~n~~w~Type ~g~/afk~w~ to return to the game.", 4000, 4);
  22. SendClientMessage(playerid, 0xFFF000FF, "You are in {FF0000}AFK{FFF000} Mode. Type {FF0000}/afk{FFF000} to return to the game.");
  23. playerAfkTimer[playerid] = SetTimerEx("afkTimer", 10000, 1, "d", playerid);
  24. notifyPrivateEvent("%s went /afk.", playerNick[playerid]);
  25. TogglePlayerSpectating(playerid, 1);
  26. afkTimer(playerid);
  27. CallRemoteFunction("setPlayerSpawnedFalse", "i", playerid);
  28. }
  29. else
  30. {
  31. playerAfk[playerid] = 0;
  32. KillTimer(playerAfkTimer[playerid]);
  33. TogglePlayerSpectating(playerid, 0);
  34. notifyPrivateEvent("%s is back.", playerNick[playerid]);
  35. }
  36. return 1;
  37. }
Add Comment
Please, Sign In to add comment