Advertisement
DelKxD

Sistema de vip feitinho por: DelK ( O aprendiz )

Aug 1st, 2017
1,361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 13.36 KB | None | 0 0
  1. //Filterscript criado por DelK.
  2. //Perfil no fórum-samp: http://forum.sa-mp.com/member.php?u=297267
  3. //Creditos: DelK, Zeex, Y_Lees
  4. //===================Includes================//
  5. #include <a_samp>
  6. #include <zcmd>
  7. #include <dof2>
  8. #include <sscanf2>
  9. //================Definições===================//
  10. #define FILTERSCRIPT
  11. #define ConvertDays(%0) (gettime() + (86400 * (%0)))
  12. #define SendFormattedMessageToAll(%0,%1,%2) do{new _string[148]; format(_string,sizeof(_string),%1,%2); SendClientMessageToAll(%0,_string);} while(False)
  13. #define SendFormattedMessage(%0,%1,%2,%3) do{new _string[148]; format(_string,sizeof(_string),%2,%3); SendClientMessage(%0,%1,_string);} while(False)
  14. //================Cores============================//
  15. #define         CorErro             0xFF0000AA
  16. #define         CorUsoCorreto       0x3552F2FF
  17. #define         CorVermelho         0xFF0000AA
  18. #define         CorPrincipal        0x33AAFFFF
  19. //==============Fim das cores/inicio das variaveis================================//
  20. enum pDados
  21. {
  22.     Vip
  23. }
  24. new Player[MAX_PLAYERS][pDados];
  25. new Pegouequip[MAX_PLAYERS] = false, Pegoucolete[MAX_PLAYERS] = false, Pegouvida[MAX_PLAYERS] = false, False=false;
  26.  
  27. forward MensagemVip(const DString[]);
  28.  
  29. #if defined FILTERSCRIPT
  30.  
  31. public OnFilterScriptInit()
  32. {
  33.     print("¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨");
  34.     print("¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨");
  35.     print("¨¨¨¨¨Sistema de Vip por: DelK Carregado com Exîto.¨¨¨¨¨\n");
  36.     print("¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨[ Sistema DVip/v1.0 ]¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨");
  37.     print("¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨");
  38.     print("¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨");
  39.     return 1;
  40. }
  41.  
  42. public OnFilterScriptExit()
  43. {
  44.     return 1;
  45. }
  46.  
  47. #endif
  48.  
  49. public OnPlayerConnect(playerid)
  50. {
  51.     if(DOF2_FileExists(ArquivoVip(playerid)))
  52.     {
  53.         Player[playerid][Vip] = DOF2_GetInt(ArquivoVip(playerid),"Dias");
  54.         if(VerifyExpiredDays(Player[playerid][Vip]))
  55.         {
  56.             DOF2_RemoveFile(ArquivoVip(playerid));
  57.             Player[playerid][Vip] = 0;
  58.             SendClientMessage(playerid, -1, "Lamento mais seu tempo como um player {FFFF00}( Vip ) {FFFFFF}expirou!");
  59.         }
  60.         else
  61.         {
  62.             new DString[128];
  63.             format(DString, sizeof(DString), "Seu {FFFF00}( Vip ){1E90FF} expira em %s.", ConvertToDays(Player[playerid][Vip]));
  64.             SendClientMessage(playerid, CorPrincipal, DString);
  65.         }
  66.     }
  67.     return 1;
  68. }
  69.  
  70. public OnPlayerDisconnect(playerid, reason)
  71. {
  72.     return 1;
  73. }
  74.  
  75. public OnPlayerDeath(playerid, killerid, reason)
  76. {
  77.     Pegouequip[playerid] = false, Pegoucolete[playerid] = false, Pegouvida[playerid] = false;
  78.     return 1;
  79. }
  80.  
  81. CMD:cchave(playerid, params[])
  82. {
  83.     new chave[20], days, Arquivo[64];
  84.     if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, CorErro, "[ERRO]: Você não está logado na RCON");
  85.     if(sscanf(params, "s[20]d", chave, days)) return SendClientMessage(playerid, CorUsoCorreto, "Uso correto: /cchave [chave] [dias]");
  86.     SendFormattedMessage(CorPrincipal, "{F4A460}[INFO]: O Administrador %s criou a chave: %s | Com: %d Dias de vip.", Nome(playerid), chave, days);
  87.     format(Arquivo, sizeof(Arquivo), "Chaves/%s.ini", chave);
  88.     DOF2_CreateFile(Arquivo);
  89.     days = ConvertDays(days);
  90.     DOF2_SetInt(Arquivo, "Dias", days);
  91.     DOF2_SaveFile();
  92.     return 1;
  93. }
  94.  
  95. CMD:ativarchave(playerid, params[])
  96. {
  97.     new chave[20], days, Arquivo[64];
  98.     if(sscanf(params, "s[20]", chave)) return SendClientMessage(playerid, CorUsoCorreto, "Uso correto: /ativarchave [chave]");
  99.     format(Arquivo, sizeof(Arquivo), "Chaves/%s.ini", chave);
  100.     if(!DOF2_FileExists(Arquivo))
  101.     {
  102.         SendClientMessage(playerid, CorPrincipal," Está chave não existe/Ou já foi ativada.");
  103.         return 1;
  104.     }
  105.     days = DOF2_GetInt(Arquivo, "Dias");
  106.     SendFormattedMessageToAll(CorPrincipal, "{F4A460}[INFO]: %s Ativou uma chave vip | Com: %s de vip.", Nome(playerid), ConvertToDays(days));
  107.     Player[playerid][Vip] = days;
  108.     DOF2_RemoveFile(Arquivo);
  109.     return 1;
  110. }
  111.  
  112. CMD:setvip(playerid, params[])
  113. {
  114.     new id, days;
  115.     if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, CorErro, "[ERRO]: Você não está logado na RCON");
  116.     if(sscanf(params, "u[24]d", id, days)) return SendClientMessage(playerid, CorUsoCorreto, "Uso correto: /setvip [id] [dias]");
  117.     if(days < 0) return SendClientMessage(playerid, CorErro, "[ERRO]: Digite um numero de dias válidos!");
  118.     if(!(IsPlayerConnected(id))) return SendClientMessage(playerid, CorErro, "[ERRO]: Este jogador não está Logado.");
  119.     if(DOF2_FileExists(ArquivoVip(id))) return SendClientMessage(playerid, CorErro, "[ERRO]: Este jogador já é um {FFFF00}( Vip ).");
  120.     Player[id][Vip] = ConvertDays(days);
  121.     new DString[85];
  122.     format(DString, sizeof(DString), "[INFO]: Você recebeu %d dias de {FFFF00}( Vip ){FFFFFF} do administrador %s.", days, Nome(playerid));
  123.     SendClientMessage(id, -1, DString);
  124.     SendFormattedMessageToAll(CorPrincipal, "{F4A460}[INFO]: O Administrador %s tornou %s um membro {FFFF00}( Vip ) | {F4A460}Por: %d Dias.", Nome(playerid), Nome(id), days);
  125.     DOF2_CreateFile(ArquivoVip(id));
  126.     DOF2_SetInt(ArquivoVip(id), "Dias", Player[id][Vip]);
  127.     DOF2_SaveFile();
  128.     return true;
  129. }
  130.  
  131. CMD:tirarvip(playerid, params[])
  132. {
  133.     new DString[85] , id;
  134.     if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, CorErro, "[ERRO]: Você não está logado na RCON");
  135.     if(sscanf(params, "u", id)) return SendClientMessage(playerid, CorUsoCorreto, "Use /TirarVip [ID]");
  136.     if(!IsPlayerConnected(id)) return SendClientMessage(playerid, CorErro, "[ERRO]: ID inválido");
  137.     if(Player[id][Vip] == 0) return SendClientMessage(playerid, CorErro, "Este player não é um mebro {FFFF00}( Vip ).");
  138.     format(DString, sizeof(DString), "{FF0000} %s teve sua conta retirada da lista de {FFFF00}( Vips ).",Nome(id));
  139.     SendClientMessageToAll(CorPrincipal, DString);
  140.     DOF2_RemoveFile(ArquivoVip(id));
  141.     Player[id][Vip] = 0;
  142.     return 1;
  143. }
  144.  
  145. CMD:jetpackv(playerid)
  146. {
  147.     if(Player[playerid][Vip] < 1) return SendClientMessage(playerid, CorErro, "[ERRO]: Você não tem permissão para usar este comando.");
  148.     SetPlayerSpecialAction(playerid, 2);
  149.     new DString[44];
  150.     format(DString, sizeof(DString), " %s criou um jetpack {FFFF00}( Vip ).", Nome(playerid));
  151.     SendClientMessage(playerid, 0xC798FAAA, DString);
  152.     return 1;
  153. }
  154.  
  155. CMD:repararv(playerid)
  156. {
  157.     if(Player[playerid][Vip] < 1) return SendClientMessage(playerid, CorErro, "[ERRO]: Você não tem permissão para usar este comando.");
  158.     if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, CorErro, "ERRO: Você não pode utilizar esse comando fora de um veículo!");
  159.     SendClientMessage(playerid, CorPrincipal, "[INFO]: Veículo reparado com sucesso!");
  160.     RepairVehicle(GetPlayerVehicleID(playerid));
  161.     return 1;
  162. }
  163.  
  164. CMD:coletev(playerid)
  165. {
  166.     if(Player[playerid][Vip] < 1) return SendClientMessage(playerid, CorErro, "[ERRO]: Você não tem permissão para usar este comando.");
  167.     if(Pegoucolete[playerid] == 1) return SendClientMessage(playerid, CorErro, "[ERR]: Você só pode usar este comando 1 vez por morte.");
  168.     Pegoucolete[playerid] = true;
  169.     SetPlayerArmour(playerid, 100);
  170.     SendClientMessage(playerid, CorPrincipal, "[INFO]: Você encheu seu colete {FFFF00}( Vip ).");
  171.     return 1;
  172. }
  173.  
  174. CMD:vidav(playerid)
  175. {
  176.     if(Player[playerid][Vip] < 1) return SendClientMessage(playerid, CorErro, "[ERRO]: Você não tem permissão para usar este comando.");
  177.     if(Pegouvida[playerid] == 1) return SendClientMessage(playerid, CorErro, "[ERRO]: Você só pode usar este comando 1 vez por morte.");
  178.     Pegouvida[playerid] = true;
  179.     SetPlayerHealth(playerid, 100);
  180.     SendClientMessage(playerid, CorPrincipal, "[INFO]: Você encheu sua vida {FFFF00}( Vip ).");
  181.     return 1;
  182. }
  183.  
  184. CMD:equiparv(playerid)
  185. {
  186.     if(Player[playerid][Vip] < 1) return SendClientMessage(playerid, CorErro, "[ERRO]: Você não tem permissão para usar este comando.");
  187.     if(Pegouequip[playerid] == 1) return SendClientMessage(playerid, CorErro, "[ERR]: Você só pode usar este comando 1 vez por morte.");
  188.     Pegouequip[playerid] = true;
  189.     SetPlayerHealth(playerid, 100);
  190.     SetPlayerArmour(playerid, 100);
  191.     GivePlayerWeapon(playerid, 4, 1);//Faca
  192.     GivePlayerWeapon(playerid, 16, 10);//Granada
  193.     GivePlayerWeapon(playerid, 24, 800);//Desert
  194.     GivePlayerWeapon(playerid, 25, 800);//Showgun
  195.     GivePlayerWeapon(playerid, 29, 1000);//Mp5
  196.     GivePlayerWeapon(playerid, 31, 1000);//M4
  197.     GivePlayerWeapon(playerid, 34, 500);//Sniper
  198.     GivePlayerWeapon(playerid, 46, 1);//Jetpack
  199.     SendClientMessage(playerid, CorPrincipal, "[INFO]: Você pegou seu equipamento {FFFF00}( Vip ).");
  200.     return 1;
  201. }
  202.  
  203. CMD:tunarv(playerid)
  204. {
  205.     if(Player[playerid][Vip] < 1) return SendClientMessage(playerid, CorErro, "[ERRO]: Você não tem permissão para usar este comando.");
  206.     new vehicle;
  207.     vehicle = GetPlayerVehicleID(playerid);
  208.     ChangeVehiclePaintjob(vehicle,1);
  209.     AddVehicleComponent(vehicle,1035);
  210.     AddVehicleComponent(vehicle,1078);
  211.     AddVehicleComponent(vehicle,1010);
  212.     AddVehicleComponent(vehicle,1087);
  213.     AddVehicleComponent(vehicle,1046);
  214.     AddVehicleComponent(vehicle,1171);
  215.     AddVehicleComponent(vehicle,1149);
  216.     AddVehicleComponent(vehicle,1147);
  217.     AddVehicleComponent(vehicle,1036);
  218.     AddVehicleComponent(vehicle,1040);
  219.     SendClientMessage(playerid, CorPrincipal,"[Auto-Tunning]: Veiculo tunado com sucesso agora vá tirar uma marra {FFFF00}( Vip ).");
  220.     return 1;
  221. }
  222.  
  223. CMD:vips(playerid)
  224. {
  225.     SendClientMessage(playerid, 0xADFF2FFF, "Todos os {FFFF00}( Vips ).");
  226.     new count=0;
  227.     for(new i=0; i<MAX_PLAYERS; i++)
  228.     {
  229.         if(IsPlayerConnected(i))
  230.         {
  231.             if(Player[i][Vip] > 0)
  232.             {
  233.                 SendFormattedMessage(playerid, 0xE3E3E3FF, "{FFFF00}( Vip ):»{00CED1} %s Tempo restante %s", Nome(i), ConvertToDays(Player[playerid][Vip]));
  234.                 count++;
  235.             }
  236.         }
  237.     }
  238.     if(count == 0) return SendClientMessage(playerid, 0xE3E3E3FF, "Não tem nem um player {FFFF00}( Vip ).");
  239.     return 1;
  240. }
  241.  
  242. CMD:v(playerid, params[])
  243. {
  244.     new DString[100], texto[128];
  245.     if(sscanf(params, "s[128]", texto)) return SendClientMessage(playerid, CorUsoCorreto, "Uso correto: /v [texto]");
  246.     if(Player[playerid][Vip] < 1) return SendClientMessage(playerid, CorErro, "[ERRO]: Você não tem permissão para usar este comando.");
  247.     format(DString, sizeof(DString),"{FFFF00}( Chat-Vip ){FFFFFF}: {FFFF00}%s{FFFFFF}: %s ", Nome(playerid), texto);
  248.     MensagemVip(DString);
  249.     return 1;
  250. }
  251.  
  252. CMD:comandosv(playerid)
  253. {
  254.     if(Player[playerid][Vip] < 1) return SendClientMessage(playerid, CorErro, "[ERRO]: Você não tem permissão para usar este comando.");
  255.     new dialogrande[750];
  256.     strcat(dialogrande, "{FFFF00}»/setvip - {CD0000}Para setar vip a alguém«\n\n");
  257.     strcat(dialogrande, "{FFFF00}»/tirarvip - {CD0000}Para tirar vip de alguém«\n\n");
  258.     strcat(dialogrande, "{FFFF00}»/jetpackv - {CD0000}Para pegar uma mochila voadora«\n\n");
  259.     strcat(dialogrande, "{FFFF00}»/coletev - {CD0000}Para encher seu colete«\n\n");
  260.     strcat(dialogrande, "{FFFF00}»/vidav - {CD0000}Para encher sua vida«\n\n");
  261.     strcat(dialogrande, "{FFFF00}»/criarveh - {CD0000}Para criar um veículo exclusivo«\n\n");
  262.     strcat(dialogrande, "{FFFF00}»/delveh - {CD0000}Para deletar um veículo criado«\n\n");
  263.     strcat(dialogrande, "{FFFF00}»/equiparv - {CD0000}Para pegar um kit de armamento«\n\n");
  264.     strcat(dialogrande, "{FFFF00}»/tunarv - {CD0000}Para tunar seu veículo exclusivo«\n\n");
  265.     strcat(dialogrande, "{FFFF00}»/vips - {CD0000}Para ver a lista de {FFFF00}( Vips )«\n\n");
  266.     strcat(dialogrande, "{FFFF00}»/vipsoff - {CD0000}Lista de todos os {FFFF00}( Vips )«\n\n");
  267.     strcat(dialogrande, "{FFFF00}»/v - {CD0000}Para falar no chat dos {FFFF00}( Vips )«\n\n");
  268.     strcat(dialogrande, "{FFFF00}»/repararv - {CD0000}Para reparar seu veículo {FFFF00}( Vip )«");
  269.     ShowPlayerDialog(playerid, 9997, DIALOG_STYLE_MSGBOX, "Visualizando os comandos {FFFF00}( Vips ).", dialogrande, "Visto", "");
  270.     return 1;
  271. }
  272.  
  273. //============[ Stocks ]=======================//
  274. stock ArquivoVip(playerid)
  275. {
  276.     static Arquivo[33]; format(Arquivo, sizeof(Arquivo), "Vips/%s.ini", Nome(playerid)); return Arquivo;
  277. }
  278.  
  279. stock Nome(playerid)
  280. {
  281.     static Name[MAX_PLAYER_NAME]; GetPlayerName(playerid, Name, sizeof(Name)); return Name;
  282. }
  283.  
  284. stock VerifyExpiredDays(days)
  285.     return (days) < gettime();
  286.  
  287. stock ConvertToDays(n)
  288. {
  289.     #pragma tabsize 0
  290.     new t[5], DString[75];
  291.         t[4] = n-gettime();
  292.         t[0] = t[4] / 3600;
  293.         t[1] = ((t[4] / 60) - (t[0] * 60));
  294.         t[2] = (t[4] - ((t[0] * 3600) + (t[1] * 60)));
  295.         t[3] = (t[0]/24);
  296.  
  297.     if(t[3] > 0)
  298.         t[0] = t[0] % 24,
  299.         format(DString, sizeof(DString), "%ddias, %02dh %02dm e %02ds", t[3], t[0], t[1], t[2]);
  300.     else if(t[0] > 0)
  301.         format(DString, sizeof(DString), "%02dh %02dm e %02ds", t[0], t[1], t[2]);
  302.     else
  303.         format(DString, sizeof(DString), "%02dm e %02ds", t[1], t[2]);
  304.     return DString;
  305. }
  306.  
  307. //========================[ Fim das stocks/inicio das public ]==========================//
  308. public MensagemVip(const DString[])
  309. {
  310.     for(new i = 0; i <= MAX_PLAYERS; i++)
  311.     {
  312.         if(IsPlayerConnected(i) == 1)
  313.         {
  314.             if(Player[i][Vip] >= 1)
  315.             {
  316.                 SendClientMessage(i, CorPrincipal, DString);
  317.             }
  318.         }
  319.     }
  320.     return 1;
  321. }
  322. //=========================[ Fim das public/fim do FS ]===============================//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement