Diogo_Bras

[iPs] AFK Advanced System (:

Mar 30th, 2011
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.20 KB | None | 0 0
  1. /* [iPs] AFK Advanced System (:
  2.    Criador Geral: [iPs]DiogoBras  
  3.    Agradecimentos; Fórum samp - Andei a pesquisar uns tópicos de galera pedindo, e decidi fazer :D
  4.    Comandos: /ausente ; /online ; /Lista  
  5.    Funcionalidades:    
  6.    /ausente - O jogador fica com a tag "[AFK]" antes do nick, ficando [AFK]NOME! É setado para o mundo virtual nº1, para não ter contato com os outros jogadores e também é congelado.  
  7.    /onlline - O jogador fica com o nome normal, sem a tag "[AFK]"! É denovo setado para o mundo virtual nº0 (normal), e é descongelado.  
  8.    /Lista - Mostra o nome de todos os jogadores que estão ausentes, e quando eles voltam (/online) o nome deles desaparece da lista quando digitado o comando. */  
  9.  
  10. #include <a_samp>
  11.  
  12. // »Defines das Cores«
  13. #define Amarelo 0xEEAD0EFF
  14. #define Laranja 0xFF7F00FF
  15. #define Vermelho 0xEE0000FF
  16.  
  17. // »Variáveis«
  18. new AFK[MAX_PLAYERS], Jogador[MAX_PLAYER_NAME], string[56], NomeTemporario[MAX_PLAYER_NAME];
  19.  
  20. public OnPlayerConnect(playerid)
  21. {
  22.    AFK[playerid] = 0;
  23.    return 1;
  24. }
  25.  
  26. public OnPlayerCommandText(playerid, cmdtext[])
  27. {
  28.  
  29. if(strcmp(cmdtext, "/ausente", true) == 0)
  30. {
  31.    if(AFK[playerid] == 0)
  32.    {
  33.       GetPlayerName(playerid, NomeTemporario, sizeof(NomeTemporario));
  34.       SetPVarString(playerid, "NomeOriginal", NomeTemporario);
  35.       format(NomeTemporario, sizeof(NomeTemporario), "[AFK]%s", NomeTemporario);
  36.       SetPlayerName(playerid, NomeTemporario);
  37.       SetPlayerArmour(playerid, 99999);
  38.       TogglePlayerControllable(playerid, 0);
  39.       GetPayerName(playerid, Jogador, sizeof(Jogador));
  40.       format(string, sizeof(string), "|AFK| Jogador(a) %s está ausente! (/ausente).", Jogador);
  41.       SendClientMessageToAll(Amarelo, string);
  42.       AFK[playerid] = 1;
  43.       return SetPlayerVirtualWorld(playerid, 1);
  44.       }
  45.       else return SendClientMessage(playerid, Laranja, "|AFK| Você já está ausente! Use (/online) para voltar ao servidor.");
  46. }
  47.  
  48. if(strcmp(cmdtext, "/online", true) == 0)
  49. {
  50.    if(AFK[playerid] == 1)
  51.    {
  52.       GetPVarString(playerid, "NomeOriginal", NomeTemporario, sizeof(NomeTemporario));
  53.       SetPlayerName(playerid, NomeTemporario);
  54.       DeletePVar(playerid, "NomeOriginal");
  55.       SetPlayerArmour(playerid, 0);
  56.       TogglePlayerControllable(playerid, 1);
  57.       GetPlayerName(playerid, Jogador, sizeof(Jogador));
  58.       format(string, sizeof(string), "|AFK| Jogador(a) %s está voltou ao jogo! (/online).", Jogador);
  59.       SendClientMessageToAll(Amarelo, string);
  60.       AFK[playerid]=0;
  61.       return SetPlayerVirtualWorld(playerid, 0);
  62.       }
  63.       else return SendClientMessage(playerid, Laranja, "|AFK| Você já está online!");
  64. }
  65.  
  66. if(strcmp(cmdtext, "/Lista", true) == 0)
  67. {
  68.    SendClientMessage(playerid, Laranja, "|AFK| Jogadores Ausentes:");
  69.    for(new j = 0; j < MAX_PLAYERS; j++)
  70.    {
  71.       if(IsPlayerConnected(j))
  72.       {
  73.          if(AFK[j] == 1)
  74.          {
  75.             GetPlayerName(j, Jogador, sizeof(Jogador));
  76.             format(string, sizeof(string),"Jogador %s | ID: %i", Jogador, j);
  77.             SendClientMessage(playerid, Amarelo, string);
  78.             }
  79.          }
  80.       }
  81.    return 1;
  82. }
  83. return SendClientMessage(playerid, Vermelho, "Comando inválido!");
  84. }
Advertisement
Add Comment
Please, Sign In to add comment