Advertisement
Guest User

Untitled

a guest
Jun 19th, 2010
473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.02 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new AFK[MAX_PLAYERS];
  4. new Text3D:AFKL[MAX_PLAYERS];
  5.  
  6. public OnPlayerConnect(playerid)
  7. {
  8.     AFK[playerid] = 0;
  9.     return 1;
  10. }
  11.  
  12. public OnPlayerDisconnect(playerid)
  13. {
  14.     Delete3DTextLabel(AFKL[playerid]);
  15.     return 1;
  16. }
  17.  
  18. public OnPlayerCommandText(playerid, cmdtext[])
  19. {
  20.     new string[256];
  21.    
  22.     if (strcmp("/afklist", cmdtext, true) == 0)
  23.     {
  24.             SendClientMessage(playerid, 0x33AA33AA, "AFK LIST:");
  25.             for(new i = 0; i < MAX_PLAYERS; i++)
  26.             {
  27.                 if(IsPlayerConnected(i))
  28.                 {
  29.                     if(AFK[i] == 1)
  30.                     {
  31.                             new name[128];
  32.                             GetPlayerName(i,name,128);
  33.                             format(string, 256, "%s", name);
  34.                             SendClientMessage(playerid, 0xFFFF00FF, string);
  35.                     }
  36.                 }
  37.             }
  38.             return 1;
  39.     }
  40.     if(!strcmp(cmdtext, "/AFK", true))
  41.     {
  42.         new string[128], name[MAX_PLAYER_NAME];
  43.         if(AFK[playerid] == 1) return SendClientMessage(playerid, 0xFF0000FF, "You are already AFK!");
  44.         GetPlayerName(playerid, name, sizeof name);
  45.         AFK[playerid] = 1;
  46.         TogglePlayerControllable(playerid, 0);
  47.         SendClientMessage(playerid, 0x33AA33AA, "You are now AFK, When you are back type /back!");
  48.         format(string, sizeof string, "%s is now AFK!", name);
  49.         SendClientMessageToAll(0xAFAFAFAA, string);
  50.         AFKL[playerid] = Create3DTextLabel("Away From Keyboard", 0xFF0000FF, 30.0, 40.0, 50.0, 40.0, 0);
  51.         Attach3DTextLabelToPlayer(AFKL[playerid], playerid, 0.0, 0.0, 0.7);
  52.         return 1;
  53.     }
  54.     if(!strcmp(cmdtext, "/BACK", true))
  55.     {
  56.         new string[128], name[MAX_PLAYER_NAME];
  57.         if(AFK[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "You aren't AFK!");
  58.         GetPlayerName(playerid, name, sizeof name);
  59.         AFK[playerid] = 0;
  60.         TogglePlayerControllable(playerid, 1);
  61.         SendClientMessage(playerid, 0x33AA33AA, "You are back!");
  62.         format(string, sizeof string, "%s is back!", name);
  63.         SendClientMessageToAll(0xAFAFAFAA, string);
  64.         Delete3DTextLabel(AFKL[playerid]);
  65.         return 1;
  66.     }
  67.     return 0;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement