Advertisement
Guest User

[FS] Sistema AFK + Motivo [strcmp] | @Riichard

a guest
Apr 14th, 2012
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.89 KB | None | 0 0
  1. /*
  2.                   ______________________________
  3.                  |  System AFK Dialog [Motivo]  |
  4.                  |  By - @Riichard (OwnPlaay)   |
  5.                  |  Não Retire os Creditos!     |
  6.                  |______________________________|
  7.  
  8. */
  9. #include < a_samp >
  10. #define SystemAFK 420 // ID Já Usada? Modifique.
  11. #define Vermelho 0xFF0000AA
  12. #define Amarelo 0xFFFF28AA
  13. new Afk[MAX_PLAYERS];
  14. // ======= [ AFK ] ======= //
  15. #if defined FILTERSCRIPT
  16.  
  17. public OnFilterScriptInit() {
  18.     print("\n AFK Em Dialog + Motivo - @Riichard");
  19.     return 1;
  20. }
  21. #else
  22.  
  23. #endif
  24. // Entrou AFK
  25. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  26.     if (dialogid == SystemAFK) {
  27.         if (response) {
  28.             new Float: X,
  29.             Float: Y,
  30.             Float: Z;
  31.             new str[200];
  32.             GetPlayerName(playerid, str, sizeof(str));
  33.             format(str, sizeof(str), "{41FF20}%s(ID:%d){9C9C9C} » Entrou em Modo {41FF20}(AFK/Ausente) {9C9C9C}[Motivo: %s]", str, playerid, inputtext[0]);
  34.             SendClientMessageToAll(-1, str);
  35.             SendClientMessageToAll(0x9C9C9CAA, "Vejá quem está em Modo Ausente/AFK » {FFFF00}/AFKs");
  36.             TogglePlayerControllable(playerid, 0);
  37.             SetPlayerHealth(playerid, 99999999.9);
  38.             SetCameraBehindPlayer(playerid);
  39.             GetPlayerPos(playerid, X, Y, Z);
  40.             SetPlayerPos(playerid, X, Y, Z + 80);
  41.             SendClientMessage(playerid, 0x20B2AAAA, "Você entrou em Modo Ausente. Use : /On,/Online ou /Voltar.");
  42.         }
  43.     }
  44.     return 1;
  45. }
  46. // Connect Mensagem FS
  47. public OnPlayerConnect(playerid) {
  48.     SendClientMessage(playerid, Amarelo, "» Sistema AFK em Dialog + Motivo. /AFK /AUSENTE");
  49.     Afk[playerid] = 0;
  50.     return 1;
  51. }
  52. // Comando AFK
  53. public OnPlayerCommandText(playerid, cmdtext[]) {
  54.     // Online - ON
  55.     if (!strcmp(cmdtext, "/on", true) || !strcmp(cmdtext, "/voltar", true) || !strcmp(cmdtext, "/online", true)) {
  56.         if (Afk[playerid] == 1) {
  57.             Afk[playerid] = 0;
  58.             new str[200];
  59.             GetPlayerName(playerid, str, sizeof(str));
  60.             format(str, sizeof(str), "{41FF20}%s(ID:%d){9C9C9C} » Saiu do Modo {41FF20}(AFK/Ausente)", str, playerid);
  61.             SendClientMessageToAll(-1, str);
  62.             new Float: X,
  63.             Float: Y,
  64.             Float: Z;
  65.             TogglePlayerControllable(playerid, 1);
  66.             SetPlayerHealth(playerid, 100.0);
  67.             GetPlayerPos(playerid, X, Y, Z);
  68.             SetPlayerPos(playerid, X, Y, Z - 80);
  69.             SendClientMessage(playerid, 0x00FF7FAA, "Bem Vindo de Volta :)");
  70.         } else {
  71.             SendClientMessage(playerid, Vermelho, "[FAIL] » Você não Está Ausente ");
  72.             return 1;
  73.         }
  74.         return 1;
  75.     }
  76.     // AFK - Ausente
  77.     if (!strcmp(cmdtext, "/afk", true) || !strcmp(cmdtext, "/aus", true) || !strcmp(cmdtext, "/ausente", true)) {
  78.         if (Afk[playerid] == 0) {
  79.             Afk[playerid] = 1;
  80.             ShowPlayerDialog(playerid, SystemAFK, DIALOG_STYLE_INPUT, "» AFK System V1", "Porque Motivo Vai Ficar Ausente:", "Ausentar", "Cancelar");
  81.         } else {
  82.             SendClientMessage(playerid, Vermelho, "[FAIL] » Você ja Está Ausente ");
  83.             return 1;
  84.         }
  85.         return 1;
  86.     }
  87.     if (strcmp("/AFKs", cmdtext, true, 10) == 0) {
  88.         SendClientMessage(playerid, -1, "{696969}______[ {00CED1}Jogadores Ausente {696969}]______");
  89.         for (new i = 0; i < MAX_PLAYERS; i++) {
  90.             if (IsPlayerConnected(i)) {
  91.                 if (Afk[i] == 1) {
  92.                     new Name[24];
  93.                     new String1[258];
  94.                     GetPlayerName(i, Name, sizeof(Name));
  95.                     format(String1, 256, "{696969}Player : {00CED1}%s(ID:%d)", Name, playerid);
  96.                     SendClientMessage(playerid, -1, String1);
  97.                 }
  98.             }
  99.         }
  100.         return 1;
  101.     }
  102.     return 0;
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement