Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.97 KB | None | 0 0
  1. new pAfk[MAX_PLAYERS];
  2. new pAfkS[MAX_PLAYERS];
  3.  
  4. public OnPlayerUpdate(playerid)
  5. {
  6.     if(pAfk[playerid] == 1 && pAfks < 0)
  7.     {
  8.         new string[144];
  9.         format(string, sizeof(string), "%s è tornato dall'afk!", GetName(playerid));
  10.         SendClientMessageToAll(0xFFFFFFFF, string);
  11.     }
  12.     pAfk[playerid] = 0;
  13.     pAfk[playerid] = 0;
  14.     return 1;
  15. }
  16.  
  17. AddAfk()
  18. {
  19.     new string[144];
  20.     for(new i = 0; i < MAX_PLAYERS; i++)
  21.     {
  22.         if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue;
  23.         pAfk[i] = 1;
  24.         pAfkS[playerid]++;
  25.         if(GetPVarInt(playerid, "AFKMinutes") > 2)
  26.         {
  27.             format(string, sizeof(string), "%s è andato afk!", GetName(playerid));
  28.             SendClientMessageToAll(0xFFFFFFFF, string);
  29.             pAfkS[playerid] = -2000000;
  30.         }
  31.     }
  32.     return 1;
  33. }
  34.  
  35. public OnGameModeInit()
  36. {
  37.     SetTimer("AddAfk", 1000, true);
  38.     return 1;
  39. }
  40.  
  41. GetName(playerid)
  42. {
  43.     new pName[MAX_PLAYER_NAME];
  44.     GetPlayerName(playerid, pName, sizeof(pName));
  45.     return pName;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement