Advertisement
Paulo_AttacK

Vip System v2.1

Jan 1st, 2013
1,031
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 21.47 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. //
  4. //        #### ########   ######     ######## ########    ###    ##     ##
  5. //         ##  ##     ## ##    ##       ##    ##         ## ##   ###   ###
  6. //         ##  ##     ## ##             ##    ##        ##   ##  #### ####
  7. //         ##  ########   ######        ##    ######   ##     ## ## ### ##
  8. //         ##  ##              ##       ##    ##       ######### ##     ##
  9. //         ##  ##        ##    ##       ##    ##       ##     ## ##     ##
  10. //        #### ##         ######        ##    ######## ##     ## ##     ##
  11. //
  12. //
  13. //                              pVip System v2.1
  14. //
  15. /*                   ______          ______           _      
  16. //                   | ___ \         | ___ \         | |      
  17. //                   | |_/ /_   _    | |_/ /_ _ _   _| | ___  
  18. //                   | ___ \ | | |   |  __/ _` | | | | |/ _ \
  19. //                   | |_/ / |_| |_  | | | (_| | |_| | | (_) |
  20. //                   \____/ \__, (_) \_|  \__,_|\__,_|_|\___/
  21. //                           __/ |                            
  22. //                          |___/                            
  23. */                            
  24. //
  25. //                      !!!   Sistema de Vips com Dias   !!!
  26. //
  27. //                  [iPs]TeaM soluções de programação em geral
  28. //
  29. //                      http://ipsteam.tk/forum/ (contate-nos)
  30. //
  31. /////////////////////////////////////////////////////////////////////////////////
  32.  
  33. #define FILTERSCRIPT
  34.  
  35. #include a_samp
  36.  
  37. #define pCMD 2 //Coloque aqui o Processador de comandos(1 - bCmd, 2 - iCmd, 3 - zCmd)
  38. #define pSAVE 1 //Coloque aqui o Sistema de Salvamento(1 - bLines, 2 - DOF2)
  39.  
  40. #if pCMD == 1
  41.     #include bcmd
  42.     #include sscanf2
  43. #endif
  44.  
  45. #if pCMD == 2
  46.     #include IPS/iCmd
  47. #endif
  48.  
  49. #if pCMD == 3
  50.     #include zcmd
  51.     #include sscanf2
  52. #endif
  53.  
  54. #if pSAVE == 1
  55.     #include IPS/bLines
  56. #endif
  57.  
  58. #if pSAVE == 2
  59.     #include DOF2
  60. #endif
  61.  
  62. #define Arquivo "Contas/%s.ini" //Local das Contas dos Jogadores.
  63. #define Vip_List "VipList.ini" //Local da VipList.
  64.  
  65. new pVip[MAX_PLAYERS][2];
  66.  
  67. public OnFilterScriptInit() {
  68.     print("Vip System By. Paulo!");
  69.     print(" Carregado com Sucesso!!");
  70.     return 1;
  71. }
  72.  
  73. public OnFilterScriptExit() {
  74.     print("Vip System By. Paulo!");
  75.     print(" Descarregado com Sucesso!!");
  76.     #if pSAVE == 1
  77.         File_Save();
  78.     #else
  79.         DOF2_Exit();
  80.     #endif
  81.     return 1;
  82. }
  83.  
  84. public OnPlayerConnect(playerid) {
  85.     new pFile[64], pNome[21];
  86.     GetPlayerName(playerid, pNome, 20);
  87.     format(pFile, 64, Arquivo, pNome);
  88.    
  89.     #if pSAVE == 1
  90.         File_Open(Arquivo);
  91.         if(File_GetInt(1)) {
  92.             if(gettime() >= File_GetInt(0)) {
  93.                 File_SetInt(0, 0);
  94.                 File_SetInt(1, 0);
  95.                 SendClientMessage(playerid, 0xFF0000FF, "[INFO] Seu VIP expirou!!");
  96.             }
  97.             pVip[playerid][0] = File_GetInt(0);
  98.             pVip[playerid][1] = File_GetInt(1);
  99.         }
  100.     #else
  101.         if(DOF2_GetInt(Arquivo, "pVip")) {
  102.             if(gettime() >= DOF2_GetInt(Arquivo, "pTime")) {
  103.                 DOF2_SetInt(Arquivo, "pVip", 0);
  104.                 DOF2_SetInt(Arquivo, "pTime", 0);
  105.                 DOF2_SaveFile();
  106.                 SendClientMessage(playerid, 0xFF0000FF, "[INFO] Seu VIP expirou!!");
  107.             }
  108.             pVip[playerid][0] = DOF2_GetInt(Arquivo, "pTime");
  109.             pVip[playerid][1] = DOF2_GetInt(Arquivo, "pVip");
  110.         }
  111.     #endif
  112.     return 1;
  113. }
  114.  
  115. #if pCMD == 1
  116.     // ---> bCmd
  117.     bCMD[darvip]>(playerid:params[]:help) {
  118.         if(help) return SendClientMessage(playerid, -1, "Este comando é usado para dar vip!");
  119.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Você não é um Admin!");
  120.  
  121.         new GiveID, sVip, pDias;
  122.         if(sscanf(params, "uii", GiveID, sVip, pDias)) return SendClientMessage(playerid, 0xFFFFFFFF, "[USO] /darvip [Id/Nick] [Vip(1-Bronze, 2-Prata e 3-Ouro)] [Dias]");
  123.         if(!IsPlayerConnected(GiveID)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Jogador Offline!");
  124.         if(!(sVip > 0 && sVip < 4)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Vip somente de 1-3!");
  125.         if(pDias < 1) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Dias maiores que 0!");
  126.  
  127.         new pStr[33];
  128.         format(pStr, sizeof(pStr), "[INFO] Você recebeu VIP %s por %d dias!!", (sVip == 1 ? ("Bronze") : sVip == 2  ? ("Prata") : ("Ouro")), pDias);
  129.         SendClientMessage(GiveID, 0x00FF00FF, pStr);
  130.  
  131.         new pFile[64], pNome[21];
  132.         GetPlayerName(GiveID, pNome, 20);
  133.         format(pFile, 64, Arquivo, pNome);
  134.  
  135.         pVip[GiveID][0] = (gettime() + (pDias * 24 * 60 * 60));
  136.         pVip[GiveID][1] = sVip;
  137.         #if pSAVE == 1
  138.             // ---> bLines
  139.             File_Open(pFile);
  140.             File_SetInt(0, pVip[GiveID][0]);
  141.             File_SetInt(1, pVip[GiveID][1]);
  142.         #else
  143.             // ---> DOF2
  144.             DOF2_SetInt(pFile, "pTime", pVip[GiveID][0]);
  145.             DOF2_SetInt(pFile, "pVip", pVip[GiveID][1]);
  146.             DOF2_SaveFile();
  147.         #endif
  148.         return 1;
  149.     }
  150.  
  151.     bCMD[tirarvip]>(playerid:params[]:help) {
  152.         if(help) return SendClientMessage(playerid, -1, "Este comando é usado para tirar o Vip!");
  153.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Você não é um Admin!");
  154.  
  155.         new GiveID;
  156.         if(sscanf(params, "u", GiveID)) return SendClientMessage(playerid, 0xFFFFFFFF, "[USO] /tirarvip [Id/Nick]");
  157.         if(!IsPlayerConnected(GiveID)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Jogador Offline!");
  158.  
  159.         new pFile[64], pNome[21], pStr[32];
  160.         GetPlayerName(GiveID, pNome, 20);
  161.         format(pFile, 64, Arquivo, pNome);
  162.  
  163.         format(pStr, sizeof(pStr), "[INFO] Você perdeu seu VIP %s!!", (pVip[GiveID][1] == 1 ? ("Bronze") : pVip[GiveID][1] == 2  ? ("Prata") : ("Ouro")));
  164.         SendClientMessage(GiveID, 0xFF0000FF, pStr);
  165.  
  166.         pVip[GiveID][0] = 0;
  167.         pVip[GiveID][1] = 0;
  168.         #if pSAVE == 1
  169.             // ---> bLines
  170.             File_Open(pFile);
  171.             File_SetInt(0, 0);
  172.             File_SetInt(1, 0);
  173.         #else
  174.             // ---> DOF2
  175.             DOF2_SetInt(pFile, "pTime", 0);
  176.             DOF2_SetInt(pFile, "pVip", 0);
  177.             DOF2_SaveFile();
  178.         #endif
  179.         return 1;
  180.     }
  181.  
  182.     bCMD[tempovip]>(playerid:params[]:help) {
  183.         if(help) return SendClientMessage(playerid, -1, "Este comando é usado para ver o tempo Vip!");
  184.         if(!pVip[playerid][1]) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Você não é um VIP!");
  185.  
  186.         new pStr[45];
  187.         if(pVip[playerid][1]) {
  188.             if(gettime() >= pVip[playerid][0]) {
  189.  
  190.                 new pFile[64], pNome[21];
  191.                 GetPlayerName(playerid, pNome, 20);
  192.                 format(pFile, 64, Arquivo, pNome);
  193.  
  194.                 pVip[playerid][0] = 0;
  195.                 pVip[playerid][1] = 0;
  196.                 #if pSAVE == 1
  197.                     File_Open(pFile);
  198.                     File_SetInt(0, 0);
  199.                     File_SetInt(1, 0);
  200.                 #else
  201.                     DOF2_SetInt(pFile, "pTime", 0);
  202.                     DOF2_SetInt(pFile, "pVip", 0);
  203.                     DOF2_SaveFile();
  204.                 #endif
  205.                 return SendClientMessage(playerid, 0xFF0000FF, "[INFO] Seu VIP expirou!!");
  206.             }
  207.             format(pStr, sizeof(pStr), "[INFO] Restam %d dias para acabar o seu VIP!", (((pVip[playerid][0] - gettime()) / 60) / 60) / 24);
  208.             SendClientMessage(playerid, 0x00FF00FF, pStr);
  209.         }
  210.         return 1;
  211.     }
  212.    
  213.     bCMD[vips]>(playerid:params[]:help) {
  214.         if(help) return SendClientMessage(playerid, -1, "Este comando é usado para ver os Vips Online!");
  215.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Você não é um Admin!");
  216.  
  217.         new pStr[512];
  218.         for(new i = (MAX_PLAYERS - 1), pNome[24]; i > -1; --i) if(IsPlayerConnected(i) && pVip[playerid][0]) GetPlayerName(i, pNome, 24), strcat(pStr, pNome), strcat(pStr, "\n");
  219.         if(!pStr[0] || (pStr[0] == '\1' && !pStr[1])) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Nenhum Vip Online!");
  220.         ShowPlayerDialog(playerid, 5845, DIALOG_STYLE_MSGBOX, "Vips Online", pStr, "Fechar", #);
  221.         return 1;
  222.     }
  223.  
  224.     bCMD[comprarvip]>(playerid:params[]:help) {
  225.         if(help) return SendClientMessage(playerid, -1, "Este comando é usado para comprar Vip!");
  226.        
  227.         new sVip[7], pDias;
  228.         if(sscanf(params, "s[7]i", sVip, pDias)) return SendClientMessage(playerid, 0xFFFFFFFF, "[USO] /comprarvip [Vip(Ouro, Prata e Bronze)] [Dias]");
  229.  
  230.         new File: pArq = fopen(Vip_List, io_write), pNome[21], pStr[64];
  231.         GetPlayerName(playerid, pNome, 20);
  232.         format(pStr, 64, "Nome: %s, Vip: %s e Dias: %i\r\n", pNome, sVip, pDias);
  233.         fwrite(pArq, pStr);
  234.         fclose(pArq);
  235.         return SendClientMessage(playerid, -1, "Você foi colocado na lista de espera para adquirir Vip, Aguarde..");
  236.     }
  237.  
  238.     bCMD[darvipoff]>(playerid:params[]:help) {
  239.         if(help) return SendClientMessage(playerid, -1, "Este comando é usado para dar vip off!");
  240.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Você não é um Admin!");
  241.  
  242.         new pNome[21], sVip, pDias;
  243.         if(sscanf(params, "s[21]ii", pNome, sVip, pDias)) return SendClientMessage(playerid, 0xFFFFFFFF, "[USO] /darvipoff [Nick] [Vip(1-Bronze, 2-Prata e 3-Ouro)] [Dias]");
  244.         if(!(sVip > 0 && sVip < 4)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Vip somente de 1-3!");
  245.         if(pDias < 1) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Dias maiores que 0!");
  246.  
  247.         new pFile[64];
  248.         format(pFile, 64, Arquivo, pNome);
  249.         if(!fexist(pFile))  return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Essa conta não existe!");
  250.  
  251.         #if pSAVE == 1
  252.             // ---> bLines
  253.             File_Open(pFile);
  254.             File_SetInt(0, (gettime() + (pDias * 24 * 60 * 60)));
  255.             File_SetInt(1, sVip);
  256.         #else
  257.             // ---> DOF2
  258.             DOF2_SetInt(pFile, "pTime", (gettime() + (pDias * 24 * 60 * 60)));
  259.             DOF2_SetInt(pFile, "pVip", sVip);
  260.             DOF2_SaveFile();
  261.         #endif
  262.  
  263.         format(pFile, 33, "[INFO] Você setou o VIP de %s para %s por %d dias!!", pNome, (sVip == 1 ? ("Bronze") : sVip == 2  ? ("Prata") : ("Ouro")), pDias);
  264.         SendClientMessage(playerid, 0x00FF00FF, pFile);
  265.         return 1;
  266.     }
  267. #endif
  268.  
  269. #if pCMD == 2
  270.     // ---> iCmd
  271.     scmd(darvip, playerid, erro)<GiveID, sVip, pDias>scanf("uii", GiveID, sVip, pDias) {
  272.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Você não é um Admin!");
  273.  
  274.         if(erro) return SendClientMessage(playerid, 0xFFFFFFFF, "[USO] /darvip [Id/Nick] [Vip(1-Bronze, 2-Prata e 3-Ouro)] [Dias]");
  275.         if(!IsPlayerConnected(GiveID)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Jogador Offline!");
  276.         if(!(sVip > 0 && sVip < 4)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Vip somente de 1-3!");
  277.         if(pDias < 1) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Dias maiores que 0!");
  278.  
  279.         new pStr[33];
  280.         format(pStr, sizeof(pStr), "[INFO] Você recebeu VIP %s por %d dias!!", (sVip == 1 ? ("Bronze") : sVip == 2  ? ("Prata") : ("Ouro")), pDias);
  281.         SendClientMessage(GiveID, 0x00FF00FF, pStr);
  282.  
  283.         new pFile[64], pNome[21];
  284.         GetPlayerName(GiveID, pNome, 20);
  285.         format(pFile, 64, Arquivo, pNome);
  286.  
  287.         pVip[GiveID][0] = (gettime() + (pDias * 24 * 60 * 60));
  288.         pVip[GiveID][1] = sVip;
  289.         #if pSAVE == 1
  290.             // ---> bLines
  291.             File_Open(pFile);
  292.             File_SetInt(0, pVip[GiveID][0]);
  293.             File_SetInt(1, pVip[GiveID][1]);
  294.         #else
  295.             // ---> DOF2
  296.             DOF2_SetInt(pFile, "pTime", pVip[GiveID][0]);
  297.             DOF2_SetInt(pFile, "pVip", pVip[GiveID][1]);
  298.             DOF2_SaveFile();
  299.         #endif
  300.         return 1;
  301.     }
  302.  
  303.     scmd(tirarvip, playerid, erro)<GiveID>scanf("u", GiveID) {
  304.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Você não é um Admin!");
  305.  
  306.         if(erro) return SendClientMessage(playerid, 0xFFFFFFFF, "[USO] /tirarvip [Id/Nick]");
  307.         if(!IsPlayerConnected(GiveID)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Jogador Offline!");
  308.  
  309.         new pFile[64], pNome[21], pStr[32];
  310.         GetPlayerName(GiveID, pNome, 20);
  311.         format(pFile, 64, Arquivo, pNome);
  312.  
  313.         format(pStr, sizeof(pStr), "[INFO] Você perdeu seu VIP %s!!", (pVip[GiveID][1] == 1 ? ("Bronze") : pVip[GiveID][1] == 2  ? ("Prata") : ("Ouro")));
  314.         SendClientMessage(GiveID, 0xFF0000FF, pStr);
  315.  
  316.         pVip[GiveID][0] = 0;
  317.         pVip[GiveID][1] = 0;
  318.         #if pSAVE == 1
  319.             // ---> bLines
  320.             File_Open(pFile);
  321.             File_SetInt(0, 0);
  322.             File_SetInt(1, 0);
  323.         #else
  324.             // ---> DOF2
  325.             DOF2_SetInt(pFile, "pTime", 0);
  326.             DOF2_SetInt(pFile, "pVip", 0);
  327.             DOF2_SaveFile();
  328.         #endif
  329.         return 1;
  330.     }
  331.  
  332.     cmd(tempovip, playerid, params[]) {
  333.         if(!pVip[playerid][1]) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Você não é um VIP!");
  334.  
  335.         new pStr[45];
  336.         if(pVip[playerid][1]) {
  337.             if(gettime() >= pVip[playerid][0]) {
  338.    
  339.                 new pFile[64], pNome[21];
  340.                 GetPlayerName(playerid, pNome, 20);
  341.                 format(pFile, 64, Arquivo, pNome);
  342.  
  343.                 pVip[playerid][0] = 0;
  344.                 pVip[playerid][1] = 0;
  345.                 #if pSAVE == 1
  346.                     File_Open(pFile);
  347.                     File_SetInt(0, 0);
  348.                     File_SetInt(1, 0);
  349.                 #else
  350.                     DOF2_SetInt(pFile, "pTime", 0);
  351.                     DOF2_SetInt(pFile, "pVip", 0);
  352.                     DOF2_SaveFile();
  353.                 #endif
  354.                 return SendClientMessage(playerid, 0xFF0000FF, "[INFO] Seu VIP expirou!!");
  355.             }
  356.             format(pStr, sizeof(pStr), "[INFO] Restam %d dias para acabar o seu VIP!", (((pVip[playerid][0] - gettime()) / 60) / 60) / 24);
  357.             SendClientMessage(playerid, 0x00FF00FF, pStr);
  358.         }
  359.         return 1;
  360.     }
  361.    
  362.     cmd(vips, playerid, params[]) {
  363.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Você não é um Admin!");
  364.  
  365.         new pStr[512];
  366.         for(new i = (MAX_PLAYERS - 1), pNome[24]; i > -1; --i) if(IsPlayerConnected(i) && pVip[playerid][0]) GetPlayerName(i, pNome, 24), strcat(pStr, pNome), strcat(pStr, "\n");
  367.         if(!pStr[0] || (pStr[0] == '\1' && !pStr[1])) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Nenhum Vip Online!");
  368.         ShowPlayerDialog(playerid, 5845, DIALOG_STYLE_MSGBOX, "Vips Online", pStr, "Fechar", #);
  369.         return 1;
  370.     }
  371.    
  372.     scmd(comprarvip, playerid, erro)<sVip[7], pDias>scanf("s[7]i", sVip, pDias) {
  373.         if(erro) return SendClientMessage(playerid, 0xFFFFFFFF, "[USO] /comprarvip [Vip(Ouro, Prata e Bronze)] [Dias]");
  374.  
  375.         new File: pArq = fopen(Vip_List, io_write), pNome[21], pStr[64];
  376.         GetPlayerName(playerid, pNome, 20);
  377.         format(pStr, 64, "Nome: %s, Vip: %s e Dias: %i\r\n", pNome, sVip, pDias);
  378.         fwrite(pArq, pStr);
  379.         fclose(pArq);
  380.         return SendClientMessage(playerid, -1, "Você foi colocado na lista de espera para adquirir Vip, Aguarde..");
  381.     }
  382.    
  383.     scmd(darvipoff, playerid, erro)<pNome[21], sVip, pDias>scanf("s[21]ii", pNome, sVip, pDias) {
  384.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Você não é um Admin!");
  385.  
  386.         if(erro) return SendClientMessage(playerid, 0xFFFFFFFF, "[USO] /darvipoff [Nick] [Vip(1-Bronze, 2-Prata e 3-Ouro)] [Dias]");
  387.         if(!(sVip > 0 && sVip < 4)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Vip somente de 1-3!");
  388.         if(pDias < 1) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Dias maiores que 0!");
  389.  
  390.         new pFile[64];
  391.         format(pFile, 64, Arquivo, pNome);
  392.         if(!fexist(pFile))  return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Essa conta não existe!");
  393.  
  394.         #if pSAVE == 1
  395.             // ---> bLines
  396.             File_Open(pFile);
  397.             File_SetInt(0, (gettime() + (pDias * 24 * 60 * 60)));
  398.             File_SetInt(1, sVip);
  399.         #else
  400.             // ---> DOF2
  401.             DOF2_SetInt(pFile, "pTime", (gettime() + (pDias * 24 * 60 * 60)));
  402.             DOF2_SetInt(pFile, "pVip", sVip);
  403.             DOF2_SaveFile();
  404.         #endif
  405.        
  406.         format(pFile, 33, "[INFO] Você setou o VIP de %s para %s por %d dias!!", pNome, (sVip == 1 ? ("Bronze") : sVip == 2  ? ("Prata") : ("Ouro")), pDias);
  407.         SendClientMessage(playerid, 0x00FF00FF, pFile);
  408.         return 1;
  409.     }
  410.    
  411.     public OnPlayerCallCommand(playerid, cmdtext[]) return 1;
  412. #endif
  413.  
  414. #if pCMD == 3
  415.     // ---> ZCMD
  416.     CMD:darvip(playerid, params[]) {
  417.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Você não é um Admin!");
  418.  
  419.         new GiveID, sVip, pDias;
  420.         if(sscanf(params, "uii", GiveID, sVip, pDias)) return SendClientMessage(playerid, 0xFFFFFFFF, "[USO] /darvip [Id/Nick] [Vip(1-Bronze, 2-Prata e 3-Ouro)] [Dias]");
  421.         if(!IsPlayerConnected(GiveID)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Jogador Offline!");
  422.         if(!(sVip > 0 && sVip < 4)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Vip somente de 1-3!");
  423.         if(pDias < 1) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Dias maiores que 0!");
  424.  
  425.         new pStr[33];
  426.         format(pStr, sizeof(pStr), "[INFO] Você recebeu VIP %s por %d dias!!", (sVip == 1 ? ("Bronze") : sVip == 2  ? ("Prata") : ("Ouro")), pDias);
  427.         SendClientMessage(GiveID, 0x00FF00FF, pStr);
  428.  
  429.         new pFile[64], pNome[21];
  430.         GetPlayerName(GiveID, pNome, 20);
  431.         format(pFile, 64, Arquivo, pNome);
  432.  
  433.         pVip[GiveID][0] = (gettime() + (pDias * 24 * 60 * 60));
  434.         pVip[GiveID][1] = sVip;
  435.         #if pSAVE == 1
  436.             // ---> bLines
  437.             File_Open(pFile);
  438.             File_SetInt(0, pVip[GiveID][0]);
  439.             File_SetInt(1, pVip[GiveID][1]);
  440.         #else
  441.             // ---> DOF2
  442.             DOF2_SetInt(pFile, "pTime", pVip[GiveID][0]);
  443.             DOF2_SetInt(pFile, "pVip", pVip[GiveID][1]);
  444.             DOF2_SaveFile();
  445.         #endif
  446.         return 1;
  447.     }
  448.  
  449.     CMD:tirarvip(playerid, params[]) {
  450.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Você não é um Admin!");
  451.  
  452.         new GiveID;
  453.         if(sscanf(params, "u", GiveID)) return SendClientMessage(playerid, 0xFFFFFFFF, "[USO] /tirarvip [Id/Nick]");
  454.         if(!IsPlayerConnected(GiveID)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Jogador Offline!");
  455.  
  456.         new pFile[64], pNome[21], pStr[32];
  457.         GetPlayerName(GiveID, pNome, 20);
  458.         format(pFile, 64, Arquivo, pNome);
  459.        
  460.         format(pStr, sizeof(pStr), "[INFO] Você perdeu seu VIP %s!!", (pVip[GiveID][1] == 1 ? ("Bronze") : pVip[GiveID][1] == 2  ? ("Prata") : ("Ouro")));
  461.         SendClientMessage(GiveID, 0xFF0000FF, pStr);
  462.  
  463.         pVip[GiveID][0] = 0;
  464.         pVip[GiveID][1] = 0;
  465.         #if pSAVE == 1
  466.             // ---> bLines
  467.             File_Open(pFile);
  468.             File_SetInt(0, 0);
  469.             File_SetInt(1, 0);
  470.         #else
  471.             // ---> DOF2
  472.             DOF2_SetInt(pFile, "pTime", 0);
  473.             DOF2_SetInt(pFile, "pVip", 0);
  474.             DOF2_SaveFile();
  475.         #endif
  476.         return 1;
  477.     }
  478.  
  479.     CMD:tempovip(playerid) {
  480.         if(!pVip[playerid][1]) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Você não é um VIP!");
  481.  
  482.         new pStr[45];
  483.         if(pVip[playerid][1]) {
  484.             if(gettime() >= pVip[playerid][0]) {
  485.  
  486.                 new pFile[64], pNome[21];
  487.                 GetPlayerName(playerid, pNome, 20);
  488.                 format(pFile, 64, Arquivo, pNome);
  489.  
  490.                 pVip[playerid][0] = 0;
  491.                 pVip[playerid][1] = 0;
  492.                 #if pSAVE == 1
  493.                     File_Open(pFile);
  494.                     File_SetInt(0, 0);
  495.                     File_SetInt(1, 0);
  496.                 #else
  497.                     DOF2_SetInt(pFile, "pTime", 0);
  498.                     DOF2_SetInt(pFile, "pVip", 0);
  499.                     DOF2_SaveFile();
  500.                 #endif
  501.                 return SendClientMessage(playerid, 0xFF0000FF, "[INFO] Seu VIP expirou!!");
  502.             }
  503.             format(pStr, sizeof(pStr), "[INFO] Restam %d dias para acabar o seu VIP!", (((pVip[playerid][0] - gettime()) / 60) / 60) / 24);
  504.             SendClientMessage(playerid, 0x00FF00FF, pStr);
  505.         }
  506.         return 1;
  507.     }
  508.    
  509.     CMD:vips(playerid, params[]) {
  510.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Você não é um Admin!");
  511.  
  512.         new pStr[512];
  513.         for(new i = (MAX_PLAYERS - 1), pNome[24]; i > -1; --i) if(IsPlayerConnected(i) && pVip[playerid][0]) GetPlayerName(i, pNome, 24), strcat(pStr, pNome), strcat(pStr, "\n");
  514.         if(!pStr[0] || (pStr[0] == '\1' && !pStr[1])) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Nenhum Vip Online!");
  515.         ShowPlayerDialog(playerid, 5845, DIALOG_STYLE_MSGBOX, "Vips Online", pStr, "Fechar", #);
  516.         return 1;
  517.     }
  518.  
  519.     CMD:comprarvip(playerid, params[]) {
  520.         new sVip[7], pDias;
  521.         if(sscanf(params, "s[7]i", sVip, pDias)) return SendClientMessage(playerid, 0xFFFFFFFF, "[USO] /comprarvip [Vip(Ouro, Prata e Bronze)] [Dias]");
  522.  
  523.         new File: pArq = fopen(Vip_List, io_write), pNome[21], pStr[64];
  524.         GetPlayerName(playerid, pNome, 20);
  525.         format(pStr, 64, "Nome: %s, Vip: %s e Dias: %i\r\n", pNome, sVip, pDias);
  526.         fwrite(pArq, pStr);
  527.         fclose(pArq);
  528.         return SendClientMessage(playerid, -1, "Você foi colocado na lista de espera para adquirir Vip, Aguarde..");
  529.     }
  530.  
  531.     CMD:darvipoff(playerid, params[]) {
  532.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Você não é um Admin!");
  533.  
  534.         new pNome[21], sVip, pDias;
  535.         if(sscanf(params, "s[21]ii", pNome, sVip, pDias)) return SendClientMessage(playerid, 0xFFFFFFFF, "[USO] /darvipoff [Nick] [Vip(1-Bronze, 2-Prata e 3-Ouro)] [Dias]");
  536.         if(!(sVip > 0 && sVip < 4)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Vip somente de 1-3!");
  537.         if(pDias < 1) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Dias maiores que 0!");
  538.  
  539.         new pFile[64];
  540.         format(pFile, 64, Arquivo, pNome);
  541.         if(!fexist(pFile))  return SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Essa conta não existe!");
  542.  
  543.         #if pSAVE == 1
  544.             // ---> bLines
  545.             File_Open(pFile);
  546.             File_SetInt(0, (gettime() + (pDias * 24 * 60 * 60)));
  547.             File_SetInt(1, sVip);
  548.         #else
  549.             // ---> DOF2
  550.             DOF2_SetInt(pFile, "pTime", (gettime() + (pDias * 24 * 60 * 60)));
  551.             DOF2_SetInt(pFile, "pVip", sVip);
  552.             DOF2_SaveFile();
  553.         #endif
  554.  
  555.         format(pFile, 33, "[INFO] Você setou o VIP de %s para %s por %d dias!!", pNome, (sVip == 1 ? ("Bronze") : sVip == 2  ? ("Prata") : ("Ouro")), pDias);
  556.         SendClientMessage(playerid, 0x00FF00FF, pFile);
  557.         return 1;
  558.     }
  559. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement