Advertisement
RaFaeLs

AFK - FIX

Jun 13th, 2013
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. new bool:AFK[MAX_PLAYERS];
  2.  
  3. public OnPlayerCommandText(playerid, cmdtext[])
  4. {
  5.     new String[250];
  6.  
  7.     if(!strcmp(cmdtext,"/AFK",true)) {
  8.         AFK[playerid] = AFK[playerid]? (0):(1);
  9.         format(String,sizeof(String),AFK[playerid]? ("!The Player %s Is In AFK"):("The Player %s Out From AFK"),GetName(playerid));
  10.         SendClientMessageToAll(COLOR_LBLUE,String);
  11.         TogglePlayerControllable(playerid,!AFK[playerid]);
  12.         GameTextForPlayer(playerid,AFK[playerid]? ("AFK"):("UnAFK"), 3000, 6);
  13.         return 1;
  14.     }
  15.        
  16.     if(!strcmp(cmdtext,"/AFKList",true)) {
  17.         new afks = 0;
  18.        
  19.         SendClientMessage(playerid,COLOR_LBLUE,"••••• ••••• AFK LIST ••••• •••••");
  20.         for(new i = 0; i < MAX_PLAYERS; i++) {
  21.             if(!IsPlayerConnected(i) || !AFK[i]) continue;
  22.  
  23.             format(String, sizeof(String),"%i. %s (id: %d)", ++afks, GetName(playerid), playerid);
  24.             SendClientMessage(playerid,COLOR_LBLUE,String);
  25.         }
  26.  
  27.         if(!afks)
  28.             return SendClientMessage(playerid, COLOR_LBLUE, "No AFK Players");
  29.         return 1;
  30.     }
  31. }
  32.  
  33. stock GetName(playerid)
  34. {
  35.     new name[MAX_PLAYER_NAME];
  36.     GetPlayerName(playerid,name,sizeof(name));
  37.     return name;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement