Advertisement
wBLinBOPE

Sistema de vip

Jul 26th, 2014
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 23.42 KB | None | 0 0
  1.  >>>>>>>>>>>>>>>>WBLIN<<<<<<<<<<<<<<<<(SISTEMA VIP)
  2. #include a_samp
  3. #include zcmd
  4. #include dof2
  5.  
  6. new pVip [ MAX_PLAYERS ] ;
  7. forward SalvarVip ( playerid ) ;
  8. forward CarregarVip ( playerid ) ;
  9.  
  10. public OnFilterScriptInit ( )
  11. {
  12.         print ( "** Filterscript de VIP ligado com sucesso! **" ) ;
  13.         return 1;
  14. }
  15.  
  16. public OnFilterScriptExit ( )
  17. {
  18.         print ( "** Filterscript de VIP desligado com sucesso! **" ) ;
  19.     DOF2_Exit();
  20.         return 1;
  21. }
  22.  
  23. public OnPlayerConnect ( playerid )
  24. {
  25.     CarregarVip ( playerid ) ;
  26.         return 1;
  27. }
  28.  
  29. public OnPlayerDisconnect ( playerid )
  30. {
  31.     SalvarVip ( playerid ) ;
  32.         return 1;
  33. }
  34.  
  35. public OnPlayerCommandPerformed ( playerid , cmdtext [ ] , success )
  36. {
  37.         return 1;
  38. }
  39.  
  40. //      * Inicio dos comandos *     //
  41. CMD :darvip ( playerid , params [ ] )
  42. {
  43.         if ( IsPlayerConnected ( playerid ) )
  44.         {
  45.                 if ( IsPlayerAdmin ( playerid ) )
  46.                 {
  47.                         new
  48.                             nom [ MAX_PLAYER_NAME ] ,
  49.                             str [ 79 ] ,
  50.                             pid ,
  51.                             level
  52.                         ;
  53.  
  54.             if ( sscanf ( params, "ui" , pid , level ) ) return SendClientMessage ( playerid , 0xBEBEBEAA , "USO CORRETO: /darvip [playerid] [level ~ 0 - 3]" ) ;
  55.             if ( level <= 0 && level >= 3 ) return SendClientMessage ( playerid , 0x8B1A1AAA , "[ERRO] Level de 0 à 3!" ) ;
  56.             if ( level >= 0 && level < 4)
  57.             {
  58.                                 pVip [ pid ] = level ;
  59.                                 GetPlayerName ( playerid , nom , sizeof ( nom ) ) ;
  60.                                 GetPlayerName ( pid , nom , sizeof ( nom ) ) ;
  61.                                 format ( str , sizeof ( str ) , "* Você setou o level vip de %s para %d." , pid , level ) ;
  62.                                 SendClientMessage ( playerid , 0x00FF00AA , str ) ;
  63.                                 format ( str , sizeof ( str ) , "* %s setou seu level vip para %d." , nom , level ) ;
  64.                                 SendClientMessage ( playerid , 0x00FF00AA , str ) ;
  65.                         }
  66.                 }
  67.                 else
  68.                         SendClientMessage ( playerid, 0x8B1A1AAA , "[ERRO] Você não está logado na RCON!" ) ;
  69.         }
  70.         else
  71.                 SendClientMessage ( playerid , 0x8B1A1AAA , "[ERRO] Player não conectado!" ) ;
  72.         return 1;
  73. }
  74. CMD :vips ( playerid , params [ ] )
  75. {
  76.     if ( IsPlayerConnected ( playerid ) )
  77.     {
  78.         new
  79.             pn [ MAX_PLAYER_NAME ] ,
  80.             str [ 56 ],
  81.             Count = 0
  82.         ;
  83.  
  84.         SendClientMessage ( playerid , 0x00FF00AA , "~~~~~~~~~~~~~~~~ Vips ~~~~~~~~~~~~~~~~~~" ) ;
  85.  
  86.         for ( new i = 0 ; i < MAX_PLAYERS; i++ )
  87.         {
  88.             if ( IsPlayerConnected ( i ) )
  89.             {
  90.                 GetPlayerName ( i , pn , sizeof ( pn ) ) ;
  91.                 if ( pVip [ i ] >= 1 )
  92.                 {
  93.                     Count ++ ;
  94.                     format ( str , sizeof ( str ) , "* Vips Online Level %d: %s" , pVip[i] , pn ) ;
  95.                     SendClientMessage ( playerid , -1 , str ) ;
  96.                 }
  97.             }
  98.         }
  99.         if ( Count == 0 )
  100.         {
  101.             SendClientMessage ( playerid , 0x8B1A1AAA , "* Nenhum player VIP Online" ) ;
  102.         }
  103.         SendClientMessage ( playerid , 0x00FF00AA , "~~~~~~~~~~~~~~~~ Vips ~~~~~~~~~~~~~~~~~~" ) ;
  104.     }
  105.     return 1;
  106. }
  107.  
  108. CMD :cvip ( playerid , params [ ] )
  109. {
  110.         if ( IsPlayerConnected ( playerid ) )
  111.         {
  112.             new
  113.                         pnom [ MAX_PLAYER_NAME ] ,
  114.                         texto [ 128 ] ,
  115.                         str [ 79 ]
  116.                 ;
  117.  
  118.         if ( pVip [ playerid ] >= 1 )
  119.         {
  120.             GetPlayerName ( playerid , pnom , sizeof ( pnom ) ) ;
  121.                         if ( sscanf ( params, "s" , texto ) ) return SendClientMessage ( playerid , 0x8B1A1AAA , "USO CORRETO: /cvip [texto]" ) ;
  122.                         format ( str , sizeof ( str ) , "I CHAT I Vip %s: %s" , pnom , texto ) ;
  123.                         for ( new i = 0 ; i < MAX_PLAYERS; i++ )
  124.                         {
  125.                         if ( pVip [ i ] > 0 )
  126.                                 {
  127.                                         SendClientMessage ( i , 0x00FF00AA, str ) ;
  128.                                 }
  129.                         }
  130.                 }
  131.         }
  132.         else
  133.             SendClientMessage ( playerid , 0x8B1A1AAA , "[ERRO] Você não é Vip!" ) ;
  134.         return 1;
  135. }
  136.  
  137. CMD :ajudavip ( playerid , params [ ] )
  138. {
  139.     if ( pVip [ playerid ] >= 1 )
  140.     {
  141.                 new
  142.                     dial [ 500 ]
  143.                 ;
  144.  
  145.                 format ( dial , sizeof ( dial ) , "{6495ED}Todos comandos vip\n{EE82EE}Kit Vip: {FFFFFF}/kitvip\n{EE82EE}Para vêr vips online: {FFFFFF}/vips\n{EE82EE}Chat vip: {FFFFFF}/cvip \n{EE82EE}Enche vida: {FFFFFF}/vidav \n{EE82EE}Enche Colete: {FFFFFF}/coletev\n{EE82EE}Jetpack: {FFFFFF}/jetpackv\n{EE82EE}Reparar Veiculo: {FFFFFF}/repararv" ) ;
  146.                 ShowPlayerDialog ( playerid , 999 , DIALOG_STYLE_MSGBOX , "{FFFF00}Comandos Vip" , dial , "OK" , "" ) ;
  147.         }
  148.         else
  149.             SendClientMessage ( playerid , 0x8B1A1AAA , "[ERRO] Você não é VIP!" ) ;
  150.         return 1;
  151. }
  152.  
  153. CMD :kitvip ( playerid , params [ ] )
  154. {
  155.         if ( IsPlayerConnected ( playerid ) )
  156.         {
  157.             new
  158.                         pnom [ MAX_PLAYER_NAME ] ,
  159.                         texto [ 128 ] ,
  160.                         str [ 79 ]
  161.                 ;
  162.  
  163.         if ( pVip [ playerid ] >= 1 )
  164.         {
  165.                         GivePlayerWeapon ( playerid , 24 , 9999 );
  166.                         GivePlayerWeapon ( playerid , 26 , 9999 );
  167.                         GivePlayerWeapon ( playerid , 28 , 9999 );
  168.                         GivePlayerWeapon ( playerid , 31 , 9999 );
  169.                         GivePlayerWeapon ( playerid , 34 , 9999 );
  170.             GetPlayerName ( playerid , pnom , sizeof ( pnom ) ) ;
  171.                         format ( str , sizeof ( str ) , "Vip %s pego o kit VIP" , pnom , texto ) ;
  172.                         for ( new i = 0 ; i < MAX_PLAYERS; i++ )
  173.                         {
  174.                         if ( pVip [ i ] > 1 )
  175.                                 {
  176.                                         SendClientMessage ( i , 0x00FFFFAA, str ) ;
  177.                                 }
  178.                         }
  179.                 }
  180.         }
  181.         else
  182.             SendClientMessage ( playerid , 0x8B1A1AAA , "[ERRO] Você não é VIP" ) ;
  183.         return 1;
  184. }
  185.  
  186. CMD :coletev ( playerid , params [ ] )
  187. {
  188.         if ( IsPlayerConnected ( playerid ) )
  189.         {
  190.             new
  191.                         pnom [ MAX_PLAYER_NAME ] ,
  192.                         texto [ 128 ] ,
  193.                         str [ 79 ]
  194.                 ;
  195.  
  196.         if ( pVip [ playerid ] >= 1 )
  197.         {
  198.                         SetPlayerArmour(playerid, 100);
  199.             GetPlayerName ( playerid , pnom , sizeof ( pnom ) ) ;
  200.                         format ( str , sizeof ( str ) , "Vip %s encheu o colete!" , pnom , texto ) ;
  201.                         for ( new i = 0 ; i < MAX_PLAYERS; i++ )
  202.                         {
  203.                         if ( pVip [ i ] > 1 )
  204.                                 {
  205.                                         SendClientMessage ( i , 0x00FFFFAA, str ) ;
  206.                                 }
  207.                         }
  208.                 }
  209.         }
  210.         else
  211.             SendClientMessage ( playerid , 0x8B1A1AAA , "[ERRO] Você não é VIP" ) ;
  212.         return 1;
  213. }
  214.  
  215. CMD :vidav ( playerid , params [ ] )
  216. {
  217.         if ( IsPlayerConnected ( playerid ) )
  218.         {
  219.             new
  220.                         pnom [ MAX_PLAYER_NAME ] ,
  221.                         texto [ 128 ] ,
  222.                         str [ 79 ]
  223.                 ;
  224.  
  225.         if ( pVip [ playerid ] >= 1 )
  226.         {
  227.                         SetPlayerHealth ( playerid , 100 );
  228.             GetPlayerName ( playerid , pnom , sizeof ( pnom ) ) ;
  229.                         format ( str , sizeof ( str ) , "Vip %s encheu a vida!" , pnom , texto ) ;
  230.                         for ( new i = 0 ; i < MAX_PLAYERS; i++ )
  231.                         {
  232.                         if ( pVip [ i ] > 1 )
  233.                                 {
  234.                                         SendClientMessage ( i , 0x00FFFFAA, str ) ;
  235.                                 }
  236.                         }
  237.                 }
  238.         }
  239.         else
  240.             SendClientMessage ( playerid , 0x8B1A1AAA , "[ERRO] Você não é VIP" ) ;
  241.         return 1;
  242. }
  243.  
  244. CMD :jetpackv ( playerid , params [ ] )
  245. {
  246.         if ( IsPlayerConnected ( playerid ) )
  247.         {
  248.             new
  249.                         pnom [ MAX_PLAYER_NAME ] ,
  250.                         texto [ 128 ] ,
  251.                         str [ 79 ]
  252.                 ;
  253.  
  254.         if ( pVip [ playerid ] >= 1 )
  255.         {
  256.             if(IsPlayerInAnyVehicle(playerid)) return  SendClientMessage(playerid, 0x8B1A1AAA, "Você Não Pode Usar JetPack em Um Veiculo !");
  257.                         new Float:X, Float:Y, Float:Z;
  258.             GetPlayerPos(playerid, X, Y, Z);
  259.                     CreatePickup(370, 3, X, Y, Z);
  260.             GetPlayerName ( playerid , pnom , sizeof ( pnom ) ) ;
  261.                         format ( str , sizeof ( str ) , "Vip %s pegou JetPack!" , pnom , texto ) ;
  262.                         for ( new i = 0 ; i < MAX_PLAYERS; i++ )
  263.                         {
  264.                         if ( pVip [ i ] > 1 )
  265.                                 {
  266.                                         SendClientMessage ( i , 0x00FFFFAA, str ) ;
  267.                                 }
  268.                         }
  269.                 }
  270.         }
  271.         else
  272.             SendClientMessage ( playerid , 0x8B1A1AAA , "[ERRO] Você não é VIP" ) ;
  273.         return 1;
  274. }
  275.  
  276. CMD :repararv ( playerid , params [ ] )
  277. {
  278.         if ( IsPlayerConnected ( playerid ) )
  279.         {
  280.             new
  281.                         pnom [ MAX_PLAYER_NAME ] ,
  282.                         texto [ 128 ] ,
  283.                         str [ 79 ]
  284.                 ;
  285.  
  286.         if ( pVip [ playerid ] >= 1 )
  287.         {
  288.                         if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0x8B1A1AAA, "Você não está em um veiculo!");
  289.             RepairVehicle(GetPlayerVehicleID(playerid));
  290.             GetPlayerName ( playerid , pnom , sizeof ( pnom ) ) ;
  291.                         format ( str , sizeof ( str ) , "Vip %s pegou JetPack!" , pnom , texto ) ;
  292.                         for ( new i = 0 ; i < MAX_PLAYERS; i++ )
  293.                         {
  294.                         if ( pVip [ i ] > 1 )
  295.                                 {
  296.                                         SendClientMessage ( i , 0x00FFFFAA, str ) ;
  297.                                 }
  298.                         }
  299.                 }
  300.         }
  301.         else
  302.             SendClientMessage ( playerid , 0x8B1A1AAA , "[ERRO] Você não é VIP" ) ;
  303.         return 1;
  304. }
  305. //      * Fim dos comandos *      //
  306.  
  307. public SalvarVip ( playerid )
  308. {
  309.     new
  310.                 ArquivoVIP [ 50 ] ,
  311.                 NomeP [ MAX_PLAYER_NAME ]
  312.         ;
  313.  
  314.     GetPlayerName ( playerid , NomeP , MAX_PLAYER_NAME ) ;
  315.     format ( ArquivoVIP , 50 , "Vips/%s" , NomeP ) ;
  316.     if ( !DOF2_FileExists ( ArquivoVIP ) ) return DOF2_CreateFile ( ArquivoVIP ) ;
  317.     DOF2_SetInt ( ArquivoVIP , "VipLevel" , pVip [ playerid ] ) ;
  318.     DOF2_SaveFile ( ) ;
  319.     return 1;
  320. }
  321.  
  322. public CarregarVip ( playerid )
  323. {
  324.     new
  325.                 ArquivoVIP [ 50 ] ,
  326.                 NomeP [ MAX_PLAYER_NAME ]
  327.         ;
  328.  
  329.     GetPlayerName ( playerid, NomeP, MAX_PLAYER_NAME ) ;
  330.     format ( ArquivoVIP , 50 , "Vips/%s" , NomeP ) ;
  331.     if ( DOF2_FileExists ( ArquivoVIP ) )
  332.     {
  333.         pVip [ playerid ] = ( playerid , DOF2_GetInt ( ArquivoVIP , "VipLevel" ) ) ;
  334.     }
  335.     return 1;
  336. }
  337.  
  338. stock sscanf(string[], format[], {Float,_}:...)
  339. {
  340.         #if defined isnull
  341.                 if (isnull(string))
  342.         #else
  343.                 if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
  344.         #endif
  345.                 {
  346.                         return format[0];
  347.                 }
  348.         #pragma tabsize 4
  349.         new
  350.                 formatPos = 0,
  351.                 stringPos = 0,
  352.                 paramPos = 2,
  353.                 paramCount = numargs(),
  354.                 delim = ' ';
  355.         while (string[stringPos] && string[stringPos] <= ' ')
  356.         {
  357.                 stringPos++;
  358.         }
  359.         while (paramPos < paramCount && string[stringPos])
  360.         {
  361.                 switch (format[formatPos++])
  362.                 {
  363.                         case '\0':
  364.                         {
  365.                                 return 0;
  366.                         }
  367.                         case 'i', 'd':
  368.                         {
  369.                                 new
  370.                                         neg = 1,
  371.                                         num = 0,
  372.                                         ch = string[stringPos];
  373.                                 if (ch == '-')
  374.                                 {
  375.                                         neg = -1;
  376.                                         ch = string[++stringPos];
  377.                                 }
  378.                                 do
  379.                                 {
  380.                                         stringPos++;
  381.                                         if ('0' <= ch <= '9')
  382.                                         {
  383.                                                 num = (num * 10) + (ch - '0');
  384.                                         }
  385.                                         else
  386.                                         {
  387.                                                 return -1;
  388.                                         }
  389.                                 }
  390.                                 while ((ch = string[stringPos]) > ' ' && ch != delim);
  391.                                 setarg(paramPos, 0, num * neg);
  392.                         }
  393.                         case 'h', 'x':
  394.                         {
  395.                                 new
  396.                                         num = 0,
  397.                                         ch = string[stringPos];
  398.                                 do
  399.                                 {
  400.                                         stringPos++;
  401.                                         switch (ch)
  402.                                         {
  403.                                                 case 'x', 'X':
  404.                                                 {
  405.                                                         num = 0;
  406.                                                         continue;
  407.                                                 }
  408.                                                 case '0' .. '9':
  409.                                                 {
  410.                                                         num = (num << 4) | (ch - '0');
  411.                                                 }
  412.                                                 case 'a' .. 'f':
  413.                                                 {
  414.                                                         num = (num << 4) | (ch - ('a' - 10));
  415.                                                 }
  416.                                                 case 'A' .. 'F':
  417.                                                 {
  418.                                                         num = (num << 4) | (ch - ('A' - 10));
  419.                                                 }
  420.                                                 default:
  421.                                                 {
  422.                                                         return -1;
  423.                                                 }
  424.                                         }
  425.                                 }
  426.                                 while ((ch = string[stringPos]) > ' ' && ch != delim);
  427.                                 setarg(paramPos, 0, num);
  428.                         }
  429.                         case 'c':
  430.                         {
  431.                                 setarg(paramPos, 0, string[stringPos++]);
  432.                         }
  433.                         case 'f':
  434.                         {
  435.  
  436.                                 new changestr[16], changepos = 0, strpos = stringPos;
  437.                                 while(changepos < 16 && string[strpos] && string[strpos] != delim)
  438.                                 {
  439.                                         changestr[changepos++] = string[strpos++];
  440.                                 }
  441.                                 changestr[changepos] = '\0';
  442.                                 setarg(paramPos,0,_:floatstr(changestr));
  443.                         }
  444.                         case 'p':
  445.                         {
  446.                                 delim = format[formatPos++];
  447.                                 continue;
  448.                         }
  449.                         case '\'':
  450.                         {
  451.                                 new
  452.                                         end = formatPos - 1,
  453.                                         ch;
  454.                                 while ((ch = format[++end]) && ch != '\'') {}
  455.                                 if (!ch)
  456.                                 {
  457.                                         return -1;
  458.                                 }
  459.                                 format[end] = '\0';
  460.                                 if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
  461.                                 {
  462.                                         if (format[end + 1])
  463.                                         {
  464.                                                 return -1;
  465.                                         }
  466.                                         return 0;
  467.                                 }
  468.                                 format[end] = '\'';
  469.                                 stringPos = ch + (end - formatPos);
  470.                                 formatPos = end + 1;
  471.                         }
  472.                         case 'u':
  473.                         {
  474.                                 new
  475.                                         end = stringPos - 1,
  476.                                         id = 0,
  477.                                         bool:num = true,
  478.                                         ch;
  479.                                 while ((ch = string[++end]) && ch != delim)
  480.                                 {
  481.                                         if (num)
  482.                                         {
  483.                                                 if ('0' <= ch <= '9')
  484.                                                 {
  485.                                                         id = (id * 10) + (ch - '0');
  486.                                                 }
  487.                                                 else
  488.                                                 {
  489.                                                         num = false;
  490.                                                 }
  491.                                         }
  492.                                 }
  493.                                 if (num && IsPlayerConnected(id))
  494.                                 {
  495.                                         setarg(paramPos, 0, id);
  496.                                 }
  497.                                 else
  498.                                 {
  499.                                         #if !defined foreach
  500.                                                 #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  501.                                                 #define __SSCANF_FOREACH__
  502.                                         #endif
  503.                                         string[end] = '\0';
  504.                                         num = false;
  505.                                         new
  506.                                                 name[MAX_PLAYER_NAME];
  507.                                         id = end - stringPos;
  508.                                         foreach (Player, playerid)
  509.                                         {
  510.                                                 GetPlayerName(playerid, name, sizeof (name));
  511.                                                 if (!strcmp(name, string[stringPos], true, id))
  512.                                                 {
  513.                                                         setarg(paramPos, 0, playerid);
  514.                                                         num = true;
  515.                                                         break;
  516.                                                 }
  517.                                         }
  518.                                         if (!num)
  519.                                         {
  520.                                                 setarg(paramPos, 0, INVALID_PLAYER_ID);
  521.                                         }
  522.                                         string[end] = ch;
  523.                                         #if defined __SSCANF_FOREACH__
  524.                                                 #undef foreach
  525.                                                 #undef __SSCANF_FOREACH__
  526.                                         #endif
  527.                                 }
  528.                                 stringPos = end;
  529.                         }
  530.                         case 's', 'z':
  531.                         {
  532.                                 new
  533.                                         i = 0,
  534.                                         ch;
  535.                                 if (format[formatPos])
  536.                                 {
  537.                                         while ((ch = string[stringPos++]) && ch != delim)
  538.                                         {
  539.                                                 setarg(paramPos, i++, ch);
  540.                                         }
  541.                                         if (!i)
  542.                                         {
  543.                                                 return -1;
  544.                                         }
  545.                                 }
  546.                                 else
  547.                                 {
  548.                                         while ((ch = string[stringPos++]))
  549.                                         {
  550.                                                 setarg(paramPos, i++, ch);
  551.                                         }
  552.                                 }
  553.                                 stringPos--;
  554.                                 setarg(paramPos, i, '\0');
  555.                         }
  556.                         default:
  557.                         {
  558.                                 continue;
  559.                         }
  560.                 }
  561.                 while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
  562.                 {
  563.                         stringPos++;
  564.                 }
  565.                 while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
  566.                 {
  567.                         stringPos++;
  568.                 }
  569.                 paramPos++;
  570.         }
  571.         do
  572.         {
  573.                 if ((delim = format[formatPos++]) > ' ')
  574.                 {
  575.                         if (delim == '\'')
  576.                         {
  577.                                 while ((delim = format[formatPos++]) && delim != '\'') {}
  578.                         }
  579.                         else if (delim != 'z')
  580.                         {
  581.                                 return delim;
  582.                         }
  583.                 }
  584.         }
  585.         while (delim > ' ');
  586.         return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement