zp42O

Sistema /afk

Jan 12th, 2013
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.18 KB | None | 0 0
  1. // Sistema de /AFK                  //
  2. // Scripter: zp42O                  //
  3. // Versão 1.0                      //
  4. // Visite: www.youtube.com/z3niii  //
  5.  
  6. #define FILTERSCRIPT
  7. #include <a_samp>
  8.  
  9. #define COLOR_YELLOW 0xFFFF00AA
  10. #define COLOR_RED 0xFF0000FF
  11.  
  12. new gPlayers[MAX_PLAYERS][MAX_PLAYER_NAME+1];
  13. new hp = 9999999;
  14. new Float:phealth;
  15. new IsPlayerAfk[MAX_PLAYERS];
  16.  
  17. public OnFilterScriptInit()
  18. {
  19.     print("\n--------------------------------------");
  20.     print(" Sistema de /afk - Feito por zp42O ");
  21.     print("--------------------------------------\n");
  22.     return 1;
  23. }
  24.  
  25. public OnPlayerConnect(playerid)
  26. {
  27.     IsPlayerAfk[playerid] = 0;
  28.     return 1;
  29. }
  30.  
  31. public OnPlayerDisconnect(playerid, reason)
  32. {
  33.     IsPlayerAfk[playerid] = 0;
  34.     return 1;
  35. }
  36.  
  37. public OnPlayerText(playerid, text[])
  38. {
  39.     if(IsPlayerAfk[playerid] == 1)
  40.         {
  41.         SendClientMessage(playerid, COLOR_RED, "ERRO: Estás neste momento AFK e não podes usar o chat. Faz /voltar para falares.");
  42.         return 0;
  43.         }
  44.     return 1;
  45. }
  46.  
  47. public OnPlayerCommandText(playerid, cmdtext[])
  48. {
  49. if (strcmp("/afk", cmdtext, true, 10) == 0)
  50. {
  51.     new string[33];
  52.     if (IsPlayerAfk[playerid] == 0) {
  53.     GetPlayerName(playerid,gPlayers[playerid],MAX_PLAYER_NAME);
  54.     GetPlayerHealth(playerid,phealth);
  55.     SetPlayerHealth(playerid,hp);
  56.     TogglePlayerControllable(playerid, 0);
  57.     format(string,sizeof(string),".:: [%s] está /AFK! ::.",gPlayers[playerid]);
  58.     SendClientMessageToAll(COLOR_RED,string);
  59.     IsPlayerAfk[playerid] = 1;
  60.     return true;
  61.     }
  62.     if (IsPlayerAfk[playerid] == 1) {
  63.     SendClientMessage(playerid, COLOR_RED, "ERRO: Novamente? Mas tu já estás /AFK!");
  64.     }
  65.     return true;
  66. }
  67. if (strcmp("/voltar", cmdtext, true, 10) == 0)
  68. {
  69.     new string[33];
  70.     if (IsPlayerAfk[playerid] == 1) {
  71.     TogglePlayerControllable(playerid, 1);
  72.     SetPlayerHealth(playerid,phealth);
  73.     format(string,sizeof(string),".:: [%s] voltou! ::.",gPlayers[playerid]);
  74.     SendClientMessageToAll(COLOR_YELLOW,string);
  75.     IsPlayerAfk[playerid] = 0;
  76.     return true;
  77.     }
  78.     if (IsPlayerAfk[playerid] == 0) {
  79.     SendClientMessage(playerid, COLOR_RED, "ERRO: Tu não estás /AFK para usares este comando");
  80.     }
  81.     return true;
  82. }
  83. return 1;
  84. }
Advertisement
Add Comment
Please, Sign In to add comment