Advertisement
Guest User

Sistema de VIP com Salvamento

a guest
Jan 20th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.53 KB | None | 0 0
  1. #include <a_samp>
  2. #include <sscanf>
  3. #include <zcmd>
  4. #include <Dini>
  5.  
  6. main()
  7. {
  8.     print("\n----------------------------------");
  9.     print(" Blank Gamemode by your name here");
  10.     print("----------------------------------\n");
  11. }
  12.  
  13. #define CONTAS "Vips/%s.ini"
  14.  
  15. new Vip[MAX_PLAYERS];
  16. new Nome[MAX_PLAYERS];
  17.  
  18. #define Neons 0
  19.  
  20. public OnGameModeInit()
  21. {
  22.     SetGameModeText("[CVS] Sistema VIP");
  23.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  24.     return 1;
  25. }
  26.  
  27. public OnGameModeExit()
  28. {
  29.  
  30.     for(new i=0; i<MAX_PLAYERS; i++)
  31.     SalvarVip(i);
  32.  
  33.     return 1;
  34. }
  35.  
  36. public OnPlayerConnect(playerid)
  37. {
  38.     new string[128];
  39.     GetPlayerName(playerid, Nome, MAX_PLAYER_NAME);
  40.     format(string, -1, "[CVS] Sistema Vip: O Jogador Vip %s conectou no servidor", Nome[playerid]);
  41.     SendClientMessageToAll(-1, string);
  42.    
  43.     return 1;
  44. }
  45.  
  46. public OnPlayerDisconnect(playerid, reason)
  47. {
  48.     new string[128];
  49.     GetPlayerName(playerid, Nome, MAX_PLAYER_NAME);
  50.     format(string, -1, "[CVS] Sistema Vip: O Jogador Vip %s desconectou do servidor", Nome[playerid]);
  51.     SendClientMessageToAll(-1, string);
  52.    
  53.     SalvarVip(playerid);
  54.    
  55.     return 1;
  56. }
  57.  
  58. public OnPlayerText(playerid, text[])
  59. {
  60.     SetPlayerColor(playerid, 0xFFBEFFE2);
  61.     return 1;
  62. }
  63.  
  64. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  65. {
  66.     if(dialogid == Neons)
  67.     {
  68.         if(response)
  69.         {
  70.             if(listitem == 0)
  71.             {
  72.             SetPVarInt(playerid, "neon2", CreateObject(18647,0,0,0,0,0,0));
  73.             SetPVarInt(playerid, "neon3", CreateObject(18647,0,0,0,0,0,0));
  74.             AttachObjectToVehicle(GetPVarInt(playerid, "neon2"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  75.             AttachObjectToVehicle(GetPVarInt(playerid, "neon3"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  76.             SendClientMessage(playerid, -1,"Você adicionou em seu veiculo um neon 'Rosa'");
  77.             }
  78.             if(listitem == 1)
  79.             {
  80.             SetPVarInt(playerid, "neon4", CreateObject(18647,0,0,0,0,0,0));
  81.             SetPVarInt(playerid, "neon5", CreateObject(18647,0,0,0,0,0,0));
  82.             AttachObjectToVehicle(GetPVarInt(playerid, "neon4"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  83.             AttachObjectToVehicle(GetPVarInt(playerid, "neon5"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  84.             SendClientMessage(playerid, -1,"Você adicionou em seu veiculo um neon 'Verde'");
  85.             }
  86.             if(listitem == 2)
  87.             {
  88.             SetPVarInt(playerid, "neon6", CreateObject(18647,0,0,0,0,0,0));
  89.             SetPVarInt(playerid, "neon7", CreateObject(18647,0,0,0,0,0,0));
  90.             AttachObjectToVehicle(GetPVarInt(playerid, "neon6"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  91.             AttachObjectToVehicle(GetPVarInt(playerid, "neon7"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  92.             SendClientMessage(playerid, -1,"Você adicionou em seu veiculo um neon 'Amarelo'");
  93.             }
  94.             if(listitem == 3)
  95.             {
  96.             SetPVarInt(playerid, "neon8", CreateObject(18647,0,0,0,0,0,0));
  97.             SetPVarInt(playerid, "neon9", CreateObject(18647,0,0,0,0,0,0));
  98.             AttachObjectToVehicle(GetPVarInt(playerid, "neon8"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  99.             AttachObjectToVehicle(GetPVarInt(playerid, "neon9"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  100.             SendClientMessage(playerid, -1,"Você adicionou em seu veiculo um neon 'Vermelho'");
  101.             }
  102.         }
  103.     }
  104.     return 1;
  105. }
  106.  
  107. CMD:DarVip(playerid, params[])
  108. {
  109.     if(IsPlayerAdmin(playerid))
  110.     {
  111.     new id, level, string[128];
  112.     if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, -1, "[CVS] Sistema de Vip: /DarVip [id] [level]");
  113.     Vip[id] = level;
  114.     format(string, 100, "Você deu %d level de VIP para o %s", level, Nome);
  115.     SendClientMessage(playerid, -1, string);
  116.     }
  117.     return 1;
  118. }
  119.  
  120. CMD:TirarVip(playerid, params[])
  121. {
  122.     if(IsPlayerAdmin(playerid))
  123.     {
  124.     new id, Tirar, string[128];
  125.     if(sscanf(params, "ud", id, Tirar)) return SendClientMessage(playerid, -1, "[CVS] Sistema de Vip: /TirarVip [id]");
  126.     Vip[id] = Tirar;
  127.     format(string, 100, "Você tirou o vip de %s", Tirar, Nome);
  128.     SendClientMessage(playerid, -1, string);
  129.     }
  130.     return 1;
  131. }
  132.  
  133. // Agora os comandos dos players vip.
  134.  
  135. CMD:neons(playerid, params[])
  136. {
  137.     if(Vip[playerid] == 0)
  138.     {
  139.     SendClientMessage(playerid, -1,"Você não é um player vip");
  140.     }
  141.     if(Vip[playerid] == 1)
  142.     ShowPlayerDialog(playerid, Neons, DIALOG_STYLE_MSGBOX,"[CVS] Sistema Vip - Neons","Rosa\nVerde\nAmarelo\nVermelho","Colocar","Sair");
  143.     return 1;
  144. }
  145.  
  146. CMD:kitvip(playerid, params[])
  147. {
  148.     if(Vip[playerid] == 0)
  149.     {
  150.     SendClientMessage(playerid, -1,"Você não é um player vip");
  151.     }
  152.     if(Vip[playerid] == 1)
  153.     GivePlayerWeapon(playerid, 3, 1);
  154.     GivePlayerWeapon(playerid, 24, 150);
  155.     GivePlayerWeapon(playerid, 25, 60);
  156.     GivePlayerWeapon(playerid, 30, 500);
  157.     GivePlayerWeapon(playerid, 24, 60);
  158.     return 1;
  159. }
  160.  
  161.  
  162. CMD:reparar(playerid, params[])
  163. {
  164.     if(Vip[playerid] == 0)
  165.     {
  166.     SendClientMessage(playerid, -1,"Você não é um player vip");
  167.     }
  168.     if(Vip[playerid] == 1)
  169.     RepairVehicle(GetPlayerVehicleID(playerid));
  170.     SendClientMessage(playerid, -1,"Você reparou seu veiculo");
  171.     return 1;
  172. }
  173.  
  174. CMD:jetpack(playerid, params[])
  175. {
  176.     if(Vip[playerid] == 0)
  177.     {
  178.     SendClientMessage(playerid, -1,"Você não é um player vip");
  179.     }
  180.     if(Vip[playerid] == 1)
  181.     SetPlayerSpecialAction(playerid, 2);
  182.     SendClientMessage(playerid, -1,"Você pegou um jetpack");
  183.     return 1;
  184. }
  185.  
  186. CMD:comandosvip(playerid, params[])
  187. {
  188.     if(Vip[playerid] == 0)
  189.     {
  190.     SendClientMessage(playerid, -1,"Você não é um player vip");
  191.     }
  192.     if(Vip[playerid] == 1)
  193.     SendClientMessage(playerid, -1,"/Neons /KitVip /Reparar /JetPack");
  194.     return 1;
  195. }
  196.  
  197. CMD:souvip(playerid, params[])
  198. {
  199.     new string[128];
  200.     if(Vip[playerid] == 0)
  201.     {
  202.     SendClientMessage(playerid, -1,"Você não é um player vip");
  203.     }
  204.     if(Vip[playerid] == 1)
  205.     format(string, -1, "Sou um player vip, seja um também /Forum.", Nome[playerid]);
  206.     SendClientMessageToAll(-1, string);
  207.     return 1;
  208. }
  209.  
  210. SalvarVip(playerid)
  211. {
  212.     GetPlayerName(playerid, Nome, sizeof(Nome));
  213.     new String[50];
  214.     format(String, sizeof(String), CONTAS, Nome);
  215.     dini_IntSet(String,"Vip", Vip[playerid]);
  216.     return 1;
  217. }
  218.  
  219. stock PlayerName(playerid)
  220. {
  221.     new Nome[MAX_PLAYER_NAME];
  222.     GetPlayerName(playerid, Nome, MAX_PLAYER_NAME);
  223.     return Nome;
  224. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement