Advertisement
RockFire_

Vip system v0.1

Aug 11th, 2011
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.50 KB | None | 0 0
  1. #include <a_samp>
  2. #include <ZCMD>
  3. #include <YSI/y_ini>
  4.  
  5. native sscanf(const data[], const format[], {Float,_}:...);
  6.  
  7. #define MaxPlayers  (15)
  8.  
  9. #define ParseFile(%0,%1,%2) \
  10.     forward %0(playerid,%1,%2); \
  11.         public %0(playerid,%1,%2)
  12.  
  13. new VipPoints[MaxPlayers];
  14.  
  15. public OnFilterScriptInit()
  16. {
  17.     print("\n--------------------------------------");
  18.     print(" VIP System by RockFire loaded");
  19.     print("--------------------------------------\n");
  20.     return 1;
  21. }
  22.  
  23. public OnFilterScriptExit()
  24. {
  25.     return 1;
  26. }
  27.  
  28. CMD:xsetvip(playerid,params[])
  29. {
  30.     if(!IsPlayerAdmin(playerid))
  31.         return 0;
  32.        
  33.     new v[2];
  34.  
  35.     if(sscanf(params,"ii",v[0],v[1]))
  36.         return SendClientMessage(playerid,-1,"{94ED40}> /setvippoints [id] [pontos]");
  37.  
  38.     new sStr[128];
  39.    
  40.     format(sStr,128,"{94ED40}Você recebeu {FF5500}%i {94ED40}pontos de algum administrador, use '/vipmenu'",v[1]);
  41.     SendClientMessage(playerid,-1,sStr);
  42.     GetPlayerName(playerid,sStr,23);
  43.     format(sStr,128,"{94ED40}Você setou os pontos vips de {FF5500}%s {94ED40}para {FF5500}%i",sStr,v[1]);
  44.     ShowPlayerDialog(playerid,309,DIALOG_STYLE_MSGBOX,"VIP:",sStr,"Fechar","");
  45.    
  46.     VipPoints[playerid] = v[1];
  47.    
  48.     return 1;
  49. }
  50.  
  51. CMD:vipmenu(playerid,params[])
  52. {
  53.     if(VipPoints[playerid] <= 0) return 0;
  54.     ShowPlayerDialog(playerid,350,DIALOG_STYLE_LIST,"VIP:","Comprar veículo\nComprar nitro","OK","Cancelar");
  55.     return 1;
  56. }
  57.  
  58. CMD:vip(playerid,params[])
  59. {
  60.     new sStr[50];
  61.     format(sStr,50,"{FF5500}Você tem %i pontos",VipPoints[playerid]);
  62.     SendClientMessage(playerid,-1,sStr);
  63.     return 1;
  64. }
  65.  
  66. public OnPlayerConnect(playerid)
  67. {
  68.     INI_ParseFile("vip_list.txt","Vip",.bExtra = true, .extra = playerid);
  69.     return 1;
  70. }
  71.  
  72. public OnPlayerDisconnect(playerid,reason)
  73. {
  74.     new
  75.         sStr[23],
  76.         INI:File = INI_Open("vip_list.txt")
  77.     ;
  78.    
  79.     GetPlayerName(playerid,sStr,23);
  80.    
  81.     INI_RemoveEntry(File,sStr);
  82.     INI_WriteInt(File,sStr,VipPoints[playerid]);
  83.     INI_Close(File);
  84.    
  85.     return 1;
  86. }
  87.  
  88. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  89. {
  90.     switch(dialogid)
  91.     {
  92.         case 350:
  93.         {
  94.             switch(listitem)
  95.             {
  96.                 case 0:
  97.                 {
  98.                     if(response)
  99.                     {
  100.                         ShowPlayerDialog(playerid,351,DIALOG_STYLE_INPUT,"VIP:","Digite o modelo do carro abaixo","OK","Calcelar");
  101.                         return 1;
  102.                     }
  103.                 }
  104.                 case 1:
  105.                 {
  106.                     if(response)
  107.                     {
  108.                         if(VipPoints[playerid] <= 0)
  109.                             return 1;
  110.  
  111.                         if(!IsPlayerInAnyVehicle(playerid))
  112.                             return SendClientMessage(playerid,-1,"{FF5500}Você precisa estar em um veículo");
  113.  
  114.                         AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
  115.                         SendClientMessage(playerid,-1,"{FF5500}Você comprou nitro para seu carro, custo de 500 pontos vip");
  116.                         VipPoints[playerid] -= 500;
  117.                         return 1;
  118.                     }
  119.                 }
  120.             }
  121.         }
  122.         case 351:
  123.         {
  124.             if(IsPlayerInAnyVehicle(playerid))
  125.                 return SendClientMessage(playerid,-1,"{FF5500}Você está em um veículo");
  126.  
  127.             new Float:x[4];
  128.             GetPlayerPos(playerid,x[0],x[1],x[2]);
  129.             GetPlayerFacingAngle(playerid,x[3]);
  130.             PutPlayerInVehicle(playerid,CreateVehicle(strval(inputtext),x[0],x[1],x[2],x[3]+2,random(999),random(999),-1),0);
  131.             SendClientMessage(playerid,-1,"{FF5500}Você comprou um veículo, custo de 5000 pontos vip");
  132.             VipPoints[playerid] -= 5000;
  133.             return 1;
  134.         }
  135.     }
  136.     return 1;
  137. }
  138.  
  139. ParseFile(Vip,name[],value[])
  140. {
  141.     new sStr[23];
  142.     GetPlayerName(playerid,sStr,23);
  143.     INI_Int(sStr,"Points",VipPoints[playerid]);
  144.     return 1;
  145. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement