Nando_Crazzy

Codigo - Teste

Aug 3rd, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 29.94 KB | None | 0 0
  1. /*
  2.  
  3.     #######################################################################################
  4.     ###                                                                                 ###
  5.     ###                                 Sistema VIP                                     ###
  6.     ###                                                                                 ###
  7.     ###         Todos os scripts feitos aqui são te total autoria do criador.          ###
  8.     ###         Este script está livre para edição e implementação em gamemodes.       ###
  9.     ###                                                                                 ###
  10.     ###                     Mantenha os devidos creditos no script.                     ###
  11.     ###                                                                                 ###
  12.     ###                      Criador, desenvolvedor e tester: Dry.                      ###
  13.     ###                                                                                 ###
  14.     #######################################################################################
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.     Funções:
  22.  
  23.         - IsPlayerVIP(playerid)                 - Chechar se um jogador é VIP.
  24.         - LoadPlayerVIP(playerid)               - Carregar dados de VIP de um jogador a partir do arquivo.
  25.         - SavePlayerVIP(playerid)               - Salvar dados de VIP dentro do arquivo.
  26.         - CreateVipKey(playerid, Key[], Days)   - Criar uma nova Key.
  27.         - UseVipKey(playerid, Key[])            - Usar determinada key.
  28.         - RemoveKey(playerid, Key[])            - Deletar uma key existente e não usada.
  29.         - GetExpirationDays(playerid)           - Getar quantos dias faltam para expirar o VIP.
  30.         - SetVipForPlayer(playerid, Days)       - Setar ou renovar o VIP de algum jogador.
  31.         - ShowWelcomeMessage(playerid)          - Abre uma mensagem de boas vindas, contendo algumas info.
  32.  
  33.     Comandos:
  34.  
  35.         - CMD:setvip [ID] [DIAS]        ( Admin )  // Setamos um jogador como VIP
  36.         - CMD:viphelp                   ( VIP )     // Algumas informações sobre o seu VIP.
  37.         - CMD:ativarvip                 ( Default )// Um dialog será aberto solicitando o código.
  38.         - CMD:novakey                   ( Admin ) // Uma nova key será criada na pasta "Keys" para livre uso.
  39.         - CMD:delkey [KEY]              ( Admin ) // Deletar uma key existente
  40.         - CMD:vips                      ( Default ) // Checar jogadores VIP online.
  41.  
  42.     Configurações:
  43.  
  44.         #define CHAT_MODEL 3                    - Modelo ao falar no chat. Preview In-Forúm
  45.         #define FULL_LIFE 1                     - Spawnar com COLETE E VIDA FULL
  46.         #define DEATH_RESPAWN_LOCAL 1           - Spawnar no local onde morreu
  47.  
  48.     Instalação:
  49.  
  50.         - Crie uma pasta chamada "Vips" localizada em scriptfiles.
  51.         - Dentro da mesma crie as seguintas pastas:
  52.  
  53.         * Users
  54.         * Keys
  55.  
  56.         - O precesso de criação de VIP's e keys é automatico, siga os passos e comandos dentro do game.
  57.         -Atenciosamente Dry ( Lucas ).
  58.  
  59. */
  60.  
  61. #include <a_samp>
  62. #include <dof2>
  63. #include <zcmd>
  64. #include <sscanf>
  65.     #define ENGINE::%0(%1) stock %0(%1)
  66.         #define Public::%0(%1) forward %0(%1); public %0(%1)
  67.             #define DIALOG_ATIV_KEY 779
  68.                 #define DIALOG_MAKE_KEY 779+1
  69.                     #define DIALOG_MAKE_DAYS 779+2
  70.                     #define DIALOG_CONFIRM 779+3
  71.                 //Folder's
  72.                 #define VIP_USERS "Vips/Users/%s.ini"
  73.             #define VIP_KEYS "Vips/Keys/%s.ini"
  74.         //Colors
  75.         #define Default 0xDE3A3AFF
  76.     #define Branco  0xFFFFFFFF
  77.     //Config
  78.         #define CHAT_MODEL 3
  79.             #define FULL_LIFE 1
  80.                 #define DEATH_RESPAWN_LOCAL 1
  81.                     #if DEATH_RESPAWN_LOCAL == 1// Usado para armazenar Locais de onde morreu
  82.                     new
  83.                         Float: X[MAX_PLAYERS],
  84.                             Float: Y[MAX_PLAYERS],
  85.                             Float: Z[MAX_PLAYERS],
  86.                         Interior[MAX_PLAYERS]
  87.                     ;
  88.                     #endif
  89.                 //Player Definitions
  90.                 enum PlayerParams
  91.                 {
  92.             bool:VIP,
  93.             dExpiration,
  94.         hExpiration
  95.         };
  96.     new
  97.     Player[MAX_PLAYERS][PlayerParams]
  98.     ;
  99.     new bool:VisibleWelcome[MAX_PLAYERS]
  100.     ;
  101.     new
  102.     Text:DrawWelcome[MAX_PLAYERS][6],
  103.     TimerDraw[MAX_PLAYERS],
  104.     cKey[MAX_PLAYERS][128],
  105.     cDays[MAX_PLAYERS]
  106. ;
  107. public OnFilterScriptInit()
  108. {
  109.     for ( new playerid = 0; playerid < GetMaxPlayers(); playerid++)
  110.     {
  111.         if ( IsPlayerConnected(playerid))
  112.         {
  113.             LoadPlayerVIP(playerid);
  114.         }
  115.     }
  116.     print("\n-- Laser Pointer by Skiaffo --\n");
  117.     new
  118.         p = GetMaxPlayers()
  119.         ;
  120.     for (new i=0; i < p; i++)
  121.     {
  122.         SetPVarInt(i, "laser", 0);
  123.         SetPVarInt(i, "color", 18643);
  124.     }
  125.     SetTimer("CheckVipsInGame", 60000, true);
  126.     print("VIP System Loaded");
  127.     return 1;
  128. }
  129.  
  130. Public::CheckVipsInGame()
  131. {
  132.     for ( new playerid = 0; playerid < GetMaxPlayers(); playerid++)
  133.     {
  134.         if ( IsPlayerConnected(playerid) && IsPlayerVIP(playerid))
  135.         {
  136.             if ( GetExpirationDays(playerid) <= 0)
  137.             {
  138.                 SetVipForPlayer(playerid, 0);
  139.             }
  140.         }
  141.     }
  142. }
  143.  
  144. public OnFilterScriptExit()
  145. {
  146.     for ( new playerid = 0; playerid < GetMaxPlayers(); playerid++) HiddenWelcome(playerid);
  147.     new
  148.         p = GetMaxPlayers()
  149.         ;
  150.     for (new i=0; i < p; i++)
  151.     {
  152.         SetPVarInt(i, "laser", 0);
  153.         RemovePlayerAttachedObject(i, 0);
  154.     }
  155.     print("VIP System UnLoaded.");
  156.     DOF2_Exit();
  157.     return 1;
  158. }
  159.  
  160. public OnPlayerConnect(playerid)
  161. {
  162.     LoadPlayerVIP(playerid);
  163.     return 1;
  164. }
  165.  
  166. public OnPlayerDisconnect(playerid, reason)
  167. {
  168.     HiddenWelcome(playerid);
  169.     Player[playerid][VIP] = false;
  170.     SetPVarInt(playerid, "laser", 0);
  171.     RemovePlayerAttachedObject(playerid, 0);
  172.     return 1;
  173. }
  174.  
  175. public OnPlayerSpawn(playerid)
  176. {
  177.     if ( IsPlayerVIP(playerid))
  178.     {
  179.         #if FULL_LIFE == 1
  180.         {
  181.             SetPlayerHealth(playerid, 100.0);
  182.             SetPlayerArmour(playerid, 100.0);
  183.         }
  184.         #endif
  185.         #if DEATH_RESPAWN_LOCAL == 1
  186.         {
  187.             SetPlayerInterior(playerid, Interior[playerid]);
  188.             SetPlayerPos(playerid, X[playerid], Y[playerid], Z[playerid]);
  189.         }
  190.         #endif
  191.     }
  192.     if(!GetPVarInt(playerid, "color")) SetPVarInt(playerid, "color", 18643);
  193.     return 1;
  194. }
  195.  
  196. public OnPlayerUpdate(playerid) {
  197.         if (GetPVarInt(playerid, "laser")) {
  198.                 RemovePlayerAttachedObject(playerid, 0);
  199.                 if ((IsPlayerInAnyVehicle(playerid)) || (IsPlayerInWater(playerid))) return 1;
  200.                 switch (GetPlayerWeapon(playerid)) {
  201.                         case 23: {
  202.                                 if (IsPlayerAiming(playerid)) {
  203.                                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  204.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP standing aiming
  205.                                                 0.108249, 0.030232, 0.118051, 1.468254, 350.512573, 364.284240);
  206.                                         } else {
  207.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP crouched aiming
  208.                                                 0.108249, 0.030232, 0.118051, 1.468254, 349.862579, 364.784240);
  209.                                         }
  210.                                 } else {
  211.                                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  212.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP standing not aiming
  213.                                                 0.078248, 0.027239, 0.113051, -11.131746, 350.602722, 362.384216);
  214.                                         } else {
  215.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP crouched not aiming
  216.                                                 0.078248, 0.027239, 0.113051, -11.131746, 350.602722, 362.384216);
  217.                         }       }       }
  218.                         case 27: {
  219.                                 if (IsPlayerAiming(playerid)) {
  220.                                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  221.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS standing aiming
  222.                                                 0.588246, -0.022766, 0.138052, -11.531745, 347.712585, 352.784271);
  223.                                         } else {
  224.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS crouched aiming
  225.                                                 0.588246, -0.022766, 0.138052, 1.468254, 350.712585, 352.784271);
  226.                                         }
  227.                                 } else {
  228.                                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  229.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS standing not aiming
  230.                                                 0.563249, -0.01976, 0.134051, -11.131746, 351.602722, 351.384216);
  231.                                         } else {
  232.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS crouched not aiming
  233.                                                 0.563249, -0.01976, 0.134051, -11.131746, 351.602722, 351.384216);
  234.                         }       }       }
  235.                         case 30: {
  236.                                 if (IsPlayerAiming(playerid)) {
  237.                                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  238.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK standing aiming
  239.                                                 0.628249, -0.027766, 0.078052, -6.621746, 352.552642, 355.084289);
  240.                                         } else {
  241.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK crouched aiming
  242.                                                 0.628249, -0.027766, 0.078052, -1.621746, 356.202667, 355.084289);
  243.                                         }
  244.                                 } else {
  245.                                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  246.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK standing not aiming
  247.                                                 0.663249, -0.02976, 0.080051, -11.131746, 358.302734, 353.384216);
  248.                                         } else {
  249.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK crouched not aiming
  250.                                                 0.663249, -0.02976, 0.080051, -11.131746, 358.302734, 353.384216);
  251.                         }       }       }
  252.                         case 31: {
  253.                                 if (IsPlayerAiming(playerid)) {
  254.                                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  255.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 standing aiming
  256.                                                 0.528249, -0.020266, 0.068052, -6.621746, 352.552642, 355.084289);
  257.                                         } else {
  258.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 crouched aiming
  259.                                                 0.528249, -0.020266, 0.068052, -1.621746, 356.202667, 355.084289);
  260.                                         }
  261.                                 } else {
  262.                                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  263.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 standing not aiming
  264.                                                 0.503249, -0.02376, 0.065051, -11.131746, 357.302734, 354.484222);
  265.                                         } else {
  266.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 crouched not aiming
  267.                                                 0.503249, -0.02376, 0.065051, -11.131746, 357.302734, 354.484222);
  268.                         }       }       }
  269.             case 34: {
  270.                 if (IsPlayerAiming(playerid)) {
  271.                     /*if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  272.                         SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper standing aiming
  273.                         0.528249, -0.020266, 0.068052, -6.621746, 352.552642, 355.084289);
  274.                     } else {
  275.                         SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper crouched aiming
  276.                         0.528249, -0.020266, 0.068052, -1.621746, 356.202667, 355.084289);
  277.                     }*/
  278.                     return 1;
  279.                 } else {
  280.                     if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  281.                         SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper standing not aiming
  282.                         0.658248, -0.03276, 0.133051, -11.631746, 355.302673, 353.584259);
  283.                     } else {
  284.                         SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper crouched not aiming
  285.                         0.658248, -0.03276, 0.133051, -11.631746, 355.302673, 353.584259);
  286.             }   }   }
  287.                         case 29: {
  288.                                 if (IsPlayerAiming(playerid)) {
  289.                                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  290.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 standing aiming
  291.                                                 0.298249, -0.02776, 0.158052, -11.631746, 359.302673, 357.584259);
  292.                                         } else {
  293.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 crouched aiming
  294.                                                 0.298249, -0.02776, 0.158052, 8.368253, 358.302673, 352.584259);
  295.                                         }
  296.                                 } else {
  297.                                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  298.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 standing not aiming
  299.                                                 0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222);
  300.                                         } else {
  301.                                                 SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 crouched not aiming
  302.                                                 0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222);
  303.         }       }       }       }       }
  304.         return 1;
  305. }
  306.  
  307. public OnPlayerDeath(playerid, killerid, reason)
  308. {
  309.     #if DEATH_RESPAWN_LOCAL == 1
  310.     {
  311.         if ( IsPlayerVIP(playerid))
  312.         {
  313.             GetPlayerPos(playerid, X[playerid], Y[playerid], Z[playerid]);
  314.             Interior[playerid] = GetPlayerInterior(playerid);
  315.         }
  316.     }
  317.     #endif
  318.     return 1;
  319. }
  320.  
  321. public OnPlayerText(playerid, text[])
  322. {
  323.     if ( IsPlayerVIP(playerid))
  324.     {
  325.         new Name[24];
  326.         GetPlayerName(playerid, Name, 24);
  327.         #if CHAT_MODEL == 1
  328.         {
  329.             new dStr[128];
  330.             format ( dStr, 128, "[%d]%s[V.I.P]: {FFFFFF}%s", playerid, Name, text);
  331.             SendClientMessageToAll(GetPlayerColor(playerid), dStr);
  332.             return 0;
  333.         }
  334.         #endif
  335.         #if CHAT_MODEL == 2
  336.         {
  337.             new dStr[128];
  338.             format ( dStr, 128, "%s[%d][V.I.P]: {FFFFFF}%s", Name, playerid, text);
  339.             SendClientMessageToAll(GetPlayerColor(playerid), dStr);
  340.             return 0;
  341.         }
  342.         #endif
  343.         #if CHAT_MODEL == 3
  344.         {
  345.             new dStr[128];
  346.             format ( dStr, 128, "{F9BD0B}VIP {FFFFFF}%s diz: {FFFFFF}%s", Name, text);
  347.             SendClientMessageToAll(GetPlayerColor(playerid), dStr);
  348.             return 0;
  349.         }
  350.         #endif
  351.     }
  352.     return 1;
  353. }
  354.  
  355. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  356. {
  357.     if ( dialogid == DIALOG_ATIV_KEY && response)
  358.     {
  359.         UseVipKey(playerid, inputtext);
  360.         return 1;
  361.     }
  362.     if ( dialogid == DIALOG_MAKE_KEY && response )
  363.     {
  364.         format ( cKey[playerid], 128, inputtext);
  365.         new Str[128];
  366.         format ( Str, sizeof Str, "{FFFFFF}Seu novo codigo VIP: {DE3A3A}%s\n\n{FFFFFF}Agora nos informe a quantidade de dias do VIP:", cKey[playerid]);
  367.         ShowPlayerDialog(playerid, DIALOG_MAKE_DAYS, DIALOG_STYLE_INPUT, "Criação de Nova Key", Str, "Criar", "Cancelar");
  368.         return true;
  369.     }
  370.     if ( dialogid == DIALOG_MAKE_DAYS && response )
  371.     {
  372.         if ( !IsNumeric(inputtext)) return SendClientMessage(playerid, Default, "Dias são compostos de números.");
  373.         cDays[playerid] = strval(inputtext);
  374.         new Str[500];
  375.         format ( Str, sizeof Str,  "{FFFFFF}Informações de sua nova key:\n\nCódigo: {DE3A3A}%s\n{FFFFFF}Vencimento: {DE3A3A}%d dias\n\n{FFFFFF}Deseja criar ?", cKey[playerid], cDays[playerid]);
  376.         ShowPlayerDialog(playerid, DIALOG_CONFIRM, DIALOG_STYLE_MSGBOX, "{FFFFFF}Criação de Nova Key",Str, "Sim", "Não");
  377.         return 1;
  378.     }
  379.     if ( dialogid == DIALOG_CONFIRM && response)
  380.     {
  381.         CreateVipKey(playerid, cKey[playerid], cDays[playerid]);
  382.         return 1;
  383.     }
  384.     return 1;
  385. }
  386. CMD:laseron(playerid)
  387. {
  388.     SetPVarInt(playerid, "laser", 1);
  389.     SetPVarInt(playerid, "color", GetPVarInt(playerid, "color"));
  390.     return 1;
  391. }
  392. CMD:laseroff(playerid)
  393. {
  394.     SetPVarInt(playerid, "laser", 0);
  395.     RemovePlayerAttachedObject(playerid, 0);
  396.     return 1;
  397. }
  398. CMD:lasercol(playerid, params[])
  399. {
  400.     new
  401.         iCOR[15]
  402.     ;
  403.     if (sscanf(params, "s", iCOR)) return SendClientMessage(playerid, 0x00E800FF, "Usage: /lasercol [color]");
  404.     if (!strcmp(iCOR, "red", true)) SetPVarInt(playerid, "color", 18643);
  405.     else if (!strcmp(iCOR, "blue", true)) SetPVarInt(playerid, "color", 19080);
  406.     else if (!strcmp(iCOR, "pink", true)) SetPVarInt(playerid, "color", 19081);
  407.     else if (!strcmp(iCOR, "orange", true)) SetPVarInt(playerid, "color", 19082);
  408.     else if (!strcmp(iCOR, "green", true)) SetPVarInt(playerid, "color", 19083);
  409.     else if (!strcmp(iCOR, "yellow", true)) SetPVarInt(playerid, "color", 19084);
  410.     else SendClientMessage(playerid, 0x00E800FF, "Colour not available!");
  411.     return
  412.     true
  413.     ;
  414. }
  415. CMD:ativarvip(playerid)
  416. {
  417.     ShowPlayerDialog(playerid, DIALOG_ATIV_KEY, DIALOG_STYLE_INPUT, "{FFFFFF}Ativar VIP", "{FFFFFF}Bem vindo.\nNos informe sua key para ativar seu beneficio VIP:", "Ativar", "Sair");
  418.     return 1;
  419. }
  420.  
  421. CMD:novakey(playerid, params[])
  422. {
  423.     if ( !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, Default, "Você não tem perissão para isso.");
  424.     ShowPlayerDialog(playerid, DIALOG_MAKE_KEY, DIALOG_STYLE_INPUT, "{FFFFFF}Criação de Nova Key", "{FFFFFF}Nos informe um novo código VIP:", "Criar", "Cancelar");
  425.     return 1;
  426. }
  427.  
  428. CMD:viphelp(playerid)
  429. {
  430.     if ( !IsPlayerVIP(playerid)) return SendClientMessage(playerid, Default, "[Erro]{FFFFFF} Você não é vip.");
  431.     new Str[1028]; format ( Str, sizeof Str, "{FFFFFF}Confira aqui comandos e status do seu VIP.\n\nSeu VIP expira em: %d dias.\n\nContate um administrador para renovar seu plano.", GetExpirationDays(playerid));
  432.     ShowPlayerDialog(playerid, 775+1, DIALOG_STYLE_MSGBOX, "{FFFFFF}Informações do VIP", Str, "Sair", "");
  433.     return 1;
  434. }
  435.  
  436. CMD:delkey(playerid, params[])
  437. {
  438.     if ( !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, Default, "Você não tem perissão para isso.");
  439.     new Key[128];
  440.     if ( sscanf ( params, "s", Key)) return SendClientMessage(playerid, Default, "[Erro]{FFFFFF} Nos informe o nome da key.");
  441.     RemoveKey(playerid, Key);
  442.     return 1;
  443. }
  444.  
  445. CMD:setvip(playerid, params[])
  446. {
  447.     if ( !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, Default, "[Vip] {FFFFFF}Você não tem permissão para isso.");
  448.     new Nome, Dias;
  449.     if ( sscanf ( params, "id", Nome, Dias)) return SendClientMessage(playerid, Default, "[Vip] {FFFFFF}Use: /setvip [ID/NAME] [DIAS]");
  450.     SetVipForPlayer(Nome, Dias);
  451.     return 1;
  452. }
  453.  
  454. CMD:vips(playerid)
  455. {
  456.     new Name[24], Str[128];
  457.     SendClientMessage(playerid, Default, "VIP's Online:");
  458.     for ( new i = 0; i < GetMaxPlayers(); i++)
  459.     {
  460.         if ( IsPlayerConnected(i) && IsPlayerVIP(i))
  461.         {
  462.             GetPlayerName(i, Name, 24);
  463.             format ( Str, sizeof Str, "[V.I.P]{FFFFFF} %s ID: %d", Name, i);
  464.             SendClientMessage(i, Default, Str);
  465.         }
  466.     }
  467.     return 1;
  468. }
  469.  
  470. ENGINE::IsPlayerVIP(playerid)
  471. {
  472.     if ( Player[playerid][VIP] == false ) return 0;
  473.     return 1;
  474. }
  475.  
  476. ENGINE::LoadPlayerVIP(playerid)
  477. {
  478.     new Name[24], dStr[128];
  479.     GetPlayerName(playerid, Name, sizeof Name);
  480.     format ( dStr, sizeof dStr, VIP_USERS, Name);
  481.     if ( !DOF2::FileExists(dStr)) return true;
  482.     Player[playerid][VIP] = true;
  483.     Player[playerid][dExpiration] = DOF2::GetInt(dStr, "Day_Expiration");
  484.     Player[playerid][hExpiration] = DOF2::GetInt(dStr, "Hour_Expiration");
  485.     ShowWelcomeMessage(playerid);
  486.     return true;
  487. }
  488.  
  489. ENGINE::SavePlayerVIP(playerid)
  490. {
  491.     if ( IsPlayerVIP(playerid))
  492.     {
  493.         new Name[24], Str[128];
  494.         GetPlayerName(playerid, Name, 24);
  495.         format ( Str, sizeof Str, VIP_USERS, Name);
  496.         if ( !DOF2::FileExists(Str)) DOF2::CreateFile(Str);
  497.         if ( !DOF2::FileExists(Str)) return printf ( "O arquivo de VIP %s não pode ser criado ( PASTA INEXISTENTE )", Name);
  498.         DOF2::SetInt(Str, "Day_Expiration", Player[playerid][dExpiration]);
  499.         DOF2::SetInt(Str, "Hour_Expiration", Player[playerid][hExpiration]);
  500.         DOF2::SaveFile();
  501.     }
  502.     return 1;
  503. }
  504.  
  505. ENGINE::CreateVipKey(playerid, Key[], Days)
  506. {
  507.     new Str[128];
  508.     format ( Str, sizeof Str, VIP_KEYS, Key);
  509.     if ( DOF2::FileExists(Str))
  510.     {
  511.         new Dayss = DOF2::GetInt(Str, "VIP_Days");
  512.         format ( Str, sizeof Str, "[Erro]{FFFFFF} [ %s ] - [ %d dias ]",Key, Dayss);
  513.         SendClientMessage(playerid, Default, "[Erro] {FFFFFF}Um codigo semelhante ja está criado.");
  514.         SendClientMessage(playerid, Default, Str);
  515.         return 1;
  516.     }
  517.     if ( Days <= 0) return SendClientMessage(playerid, Default, "[Erro]{FFFFFF} Impossível realizar esta operação.");
  518.     DOF2::CreateFile(Str);
  519.     DOF2::SetInt(Str, "VIP_Days", Days);
  520.     DOF2::SaveFile();
  521.     format ( Str, sizeof Str, "[VIP]{FFFFFF} [ %s ] - [ %d dias ]", Key, Days);
  522.     SendClientMessage(playerid, Default, "[VIP]{FFFFFF} Um novo código VIP foi criado.");
  523.     SendClientMessage(playerid, Default, "[VIP]{FFFFFF} Use /ativarvip para usa-lo");
  524.     SendClientMessage(playerid, Default, Str);
  525.     return 1;
  526. }
  527.  
  528. ENGINE::UseVipKey(playerid, Key[])
  529. {
  530.     new Str[128];
  531.     format ( Str, sizeof Str, VIP_KEYS, Key);
  532.     if ( !DOF2::FileExists(Str))
  533.     {
  534.         SendClientMessage(playerid, Default, "************************************************");
  535.         SendClientMessage(playerid, Default, " O codigo fornecido já foi usado ou não existe.");
  536.         SendClientMessage(playerid, Default, " Não tem um código VIP ? Contate um adminstrador.");
  537.         SendClientMessage(playerid, Default, "************************************************");
  538.         return 1;
  539.     }
  540.     new Days = DOF2::GetInt(Str, "VIP_Days");
  541.     SetVipForPlayer(playerid, Days);
  542.     DOF2::RemoveFile(Str);
  543.     new Name[24]; GetPlayerName(playerid, Name, 24);
  544.     printf ("O jogador %s ativou o codigo %s com %d dias", Name, Key, Days);
  545.     return 1;
  546. }
  547.  
  548. ENGINE::RemoveKey(playerid, Key[])
  549. {
  550.     new Str[128];
  551.     format ( Str, sizeof Str, VIP_KEYS, Key);
  552.     if ( !DOF2::FileExists(Str)) return SendClientMessage(playerid, Default, "Key Inexistente");
  553.     DOF2::RemoveFile(Str);
  554.     format (Str, sizeof Str, "[VIP KEY]{FFFFFF} O codigo %s foi removido.", Key);
  555.     SendClientMessage(playerid, Default, Str);
  556.     return 1;
  557. }
  558.  
  559. ENGINE::GetExpirationDays(playerid)
  560. {
  561.     new Days = 0;
  562.     if ( IsPlayerVIP(playerid))
  563.     {
  564.         Days = Player[playerid][dExpiration] - getdate();
  565.     }
  566.     return Days;
  567. }
  568.  
  569. ENGINE::SetVipForPlayer(playerid, Days)
  570. {
  571.     if ( !IsPlayerConnected(playerid)) return 1;
  572.     if ( Days == 0 )
  573.     {
  574.         new Nome[24], Str[128];
  575.         GetPlayerName(playerid, Nome, 24);
  576.         format ( Str, sizeof Str, VIP_USERS, Nome);
  577.         DOF2::RemoveFile(Str);
  578.         Player[playerid][VIP] = false;
  579.         SendClientMessage(playerid, Default, "[Vip] {FFFFFF}Informamos que seu VIP expirou.");
  580.         SendClientMessage(playerid, Default, "[Vip] {FFFFFF}Contate um administrador o mais rapido possível para renova-lo.");
  581.         SendClientMessage(playerid, Default, "[Vip] {FFFFFF}Obrigado por colaborar com nosso servidor.");
  582.         return 1;
  583.     }
  584.     new Str[128];
  585.     if ( Player[playerid][VIP] == true )
  586.     {
  587.         format ( Str, sizeof Str, "[Vip] {FFFFFF}Seu VIP foi renovado. ( %d dias )", Days);
  588.         Player[playerid][dExpiration] += Days;
  589.         Player[playerid][hExpiration] = gettime();
  590.     }
  591.     else
  592.     {
  593.         format ( Str, sizeof Str, "[Vip] {FFFFFF}Seu VIP foi ativado. ( %d dias )", Days);
  594.         Player[playerid][dExpiration] = getdate() + Days;
  595.         Player[playerid][hExpiration] = gettime();
  596.     }
  597.     Player[playerid][VIP] = true;
  598.     SavePlayerVIP(playerid);
  599.     SendClientMessage(playerid, Default, "[Vip] {FFFFFF}Obrigado por adquirir nosso plano VIP.");
  600.     SendClientMessage(playerid, Default, "[Vip] {FFFFFF}Use: /viphelp para mais informações.");
  601.     SendClientMessage(playerid, Default, Str);
  602.     return 1;
  603. }
  604.  
  605. ENGINE::ShowWelcomeMessage(playerid)
  606. {
  607.     if ( IsPlayerVIP(playerid))
  608.     {
  609.         if ( VisibleWelcome[playerid] == false )
  610.         {
  611.             DrawWelcome[playerid][0]                    =TextDrawCreate(579.000000, 301.000000, "_");
  612.             TextDrawBackgroundColor     (DrawWelcome[playerid][0], 255);
  613.             TextDrawFont                (DrawWelcome[playerid][0], 1);
  614.             TextDrawLetterSize          (DrawWelcome[playerid][0], 0.500000, 7.199999);
  615.             TextDrawColor               (DrawWelcome[playerid][0], -1);
  616.             TextDrawSetOutline          (DrawWelcome[playerid][0], 0);
  617.             TextDrawSetProportional     (DrawWelcome[playerid][0], 1);
  618.             TextDrawSetShadow           (DrawWelcome[playerid][0], 1);
  619.             TextDrawUseBox              (DrawWelcome[playerid][0], 1);
  620.             TextDrawBoxColor            (DrawWelcome[playerid][0], -1010580690);
  621.             TextDrawTextSize            (DrawWelcome[playerid][0], 433.000000, 0.000000);
  622.  
  623.             DrawWelcome[playerid][1]                    =TextDrawCreate(579.000000, 301.000000, "_");
  624.             TextDrawBackgroundColor     (DrawWelcome[playerid][1], 255);
  625.             TextDrawFont                (DrawWelcome[playerid][1], 1);
  626.             TextDrawLetterSize          (DrawWelcome[playerid][1], 0.500000, 0.899999);
  627.             TextDrawColor               (DrawWelcome[playerid][1], -1);
  628.             TextDrawSetOutline          (DrawWelcome[playerid][1], 0);
  629.             TextDrawSetProportional     (DrawWelcome[playerid][1], 1);
  630.             TextDrawSetShadow           (DrawWelcome[playerid][1], 1);
  631.             TextDrawUseBox              (DrawWelcome[playerid][1], 1);
  632.             TextDrawBoxColor            (DrawWelcome[playerid][1], -1010580685);
  633.             TextDrawTextSize            (DrawWelcome[playerid][1], 433.000000, 0.000000);
  634.  
  635.             DrawWelcome[playerid][2]                    =TextDrawCreate(437.000000, 301.000000, "Bem Vindo Novamente");
  636.             TextDrawBackgroundColor     (DrawWelcome[playerid][2], -1010580736);
  637.             TextDrawFont                (DrawWelcome[playerid][2], 2);
  638.             TextDrawLetterSize          (DrawWelcome[playerid][2], 0.159999, 0.899999);
  639.             TextDrawColor               (DrawWelcome[playerid][2], -1);
  640.             TextDrawSetOutline          (DrawWelcome[playerid][2], 0);
  641.             TextDrawSetProportional     (DrawWelcome[playerid][2], 1);
  642.             TextDrawSetShadow           (DrawWelcome[playerid][2], 1);
  643.  
  644.             DrawWelcome[playerid][3]                    =TextDrawCreate(437.000000, 318.000000, "Seu VIP ainda esta ativo.");
  645.             TextDrawBackgroundColor     (DrawWelcome[playerid][3], -1010580736);
  646.             TextDrawFont                (DrawWelcome[playerid][3], 2);
  647.             TextDrawLetterSize          (DrawWelcome[playerid][3], 0.149999, 0.799999);
  648.             TextDrawColor               (DrawWelcome[playerid][3], -1);
  649.             TextDrawSetOutline          (DrawWelcome[playerid][3], 0);
  650.             TextDrawSetProportional     (DrawWelcome[playerid][3], 1);
  651.             TextDrawSetShadow           (DrawWelcome[playerid][3], 1);
  652.  
  653.             DrawWelcome[playerid][4]                    =TextDrawCreate(437.000000, 329.000000, "Use: /viphelp para mais info.");
  654.             TextDrawBackgroundColor     (DrawWelcome[playerid][4], -1010580736);
  655.             TextDrawFont                (DrawWelcome[playerid][4], 2);
  656.             TextDrawLetterSize          (DrawWelcome[playerid][4], 0.149999, 0.799999);
  657.             TextDrawColor               (DrawWelcome[playerid][4], -1);
  658.             TextDrawSetOutline          (DrawWelcome[playerid][4], 0);
  659.             TextDrawSetProportional     (DrawWelcome[playerid][4], 1);
  660.             TextDrawSetShadow           (DrawWelcome[playerid][4], 1);
  661.  
  662.             DrawWelcome[playerid][5]                    =TextDrawCreate(437.000000, 356.000000, "Seu vip expira em: ... dias");
  663.             TextDrawBackgroundColor     (DrawWelcome[playerid][5], -1010580736);
  664.             TextDrawFont                (DrawWelcome[playerid][5], 2);
  665.             TextDrawLetterSize          (DrawWelcome[playerid][5], 0.149999, 0.799999);
  666.             TextDrawColor               (DrawWelcome[playerid][5], -1);
  667.             TextDrawSetOutline          (DrawWelcome[playerid][5], 0);
  668.             TextDrawSetProportional     (DrawWelcome[playerid][5], 1);
  669.             TextDrawSetShadow           (DrawWelcome[playerid][5], 1);
  670.             new Str[128];
  671.             format ( Str, sizeof Str, "Seu VIP expira em: %d dias.", GetExpirationDays(playerid));
  672.             TextDrawSetString(DrawWelcome[playerid][5], Str);
  673.             for ( new t = 0; t < 6; t++) TextDrawShowForPlayer(playerid, DrawWelcome[playerid][t]);
  674.             VisibleWelcome[playerid] = true;
  675.             TimerDraw[playerid] = SetTimerEx("HiddenWelcome", 6000, false, "i", playerid);
  676.             if ( GetExpirationDays(playerid) < 5)
  677.             {
  678.                 format ( Str, sizeof Str, "[Vip] {FFFFFF}Seu VIP expira em %d dias.", GetExpirationDays(playerid));
  679.                 SendClientMessage(playerid, Default, Str);
  680.             }
  681.         }
  682.     }
  683. }
  684.  
  685. Public::HiddenWelcome(playerid)
  686. {
  687.     if ( VisibleWelcome[playerid] == true )
  688.     {
  689.         for ( new t = 0; t < 6; t++) TextDrawDestroy(DrawWelcome[playerid][t]);
  690.         TimerDraw[playerid] = 0;
  691.         VisibleWelcome[playerid] = false;
  692.     }
  693. }
  694.  
  695. ENGINE::IsNumeric(const string[])
  696. {
  697.         for (new i = 0, j = strlen(string); i < j; i++)
  698.         {
  699.                 if (string[i] > '9' || string[i] < '0') return 0;
  700.         }
  701.         return 1;
  702. }
  703. ENGINE::IsPlayerInWater(playerid) {
  704.         new anim = GetPlayerAnimationIndex(playerid);
  705.         if (((anim >=  1538) && (anim <= 1542)) || (anim == 1544) || (anim == 1250) || (anim == 1062)) return 1;
  706.         return 0;
  707. }
  708.  
  709. ENGINE::IsPlayerAiming(playerid) {
  710.     new anim = GetPlayerAnimationIndex(playerid);
  711.     if (((anim >= 1160) && (anim <= 1163)) || (anim == 1167) || (anim == 1365) ||
  712.     (anim == 1643) || (anim == 1453) || (anim == 220)) return 1;
  713.     return 0;
  714. }
  715.  
  716.  
  717. /*---------------------------------- FIM ------------------------------------@\
  718.                                 @FREE_SCRIPER                                
  719.                                 @MODULOS                                    
  720.                                 @FILTERSCRIPTS                            
  721. ------------------------------- @MAPAS  -------------------------------------*/
Advertisement
Add Comment
Please, Sign In to add comment