Advertisement
Rhay_Fither

Sistema de Gold - v2.0 [By: Rhay_Fither]

Sep 11th, 2012
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 12.58 KB | None | 0 0
  1. #include <a_samp>
  2. #define FILTERSCRIPT
  3. #include <zcmd>
  4. #include <Dini>
  5. #include <sscanf>
  6.  
  7. //New's
  8. new Text:Textdraw1[MAX_PLAYERS];
  9. new Text:Textdraw0[MAX_PLAYERS];
  10. new Gold[MAX_PLAYERS];
  11. new tGold[MAX_PLAYERS];
  12.  
  13. #define PosPremios                                  1214.8124,-1675.5703,11.7969
  14. #define DIALOG_PREMIOS                              2095
  15.  
  16. public OnFilterScriptInit()
  17. {
  18.     print("\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
  19.     print("=[FS] Sistema de Gold - v2.0 [CARREGADO]=");
  20.     print("=-=-=-=-=-=[ By: Rhay_Fither ]=-=-=-=-=-=");
  21.     print("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n");
  22.  
  23.     if(!fexist("Golds.txt")) dini_Create("Golds.txt");
  24.     AddStaticPickup(1247,1,PosPremios);
  25.     Create3DTextLabel("{FFFF00}Premios Gold\n{87CEEB}Aperte 'F' ou 'Enter'", -1, PosPremios, 30.0, 0);
  26.     return 1;
  27. }
  28.  
  29. public OnPlayerConnect(playerid)
  30. {
  31.     if(dini_Isset("Golds.txt",PlayerName(playerid))) Gold[playerid] = (playerid,dini_Int("Golds.txt",PlayerName(playerid)));
  32.     return 1;
  33. }
  34.  
  35. public OnPlayerDisconnect(playerid, reason)
  36. {
  37.     dini_IntSet("Golds.txt",PlayerName(playerid),Gold[playerid]);
  38.     return 1;
  39. }
  40.  
  41. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  42. {
  43.     if ((newkeys == KEY_SECONDARY_ATTACK))  // Key F / Enter
  44.     {
  45.         cmd_premio(playerid);
  46.     }
  47.     return 1;
  48. }
  49.  
  50. public OnPlayerSpawn(playerid)
  51. {
  52.     //Timer's
  53.     SetTimerEx("Timer",60000,true,"i",playerid); //TROQUE O '10000' PELO TEMPO QUE ELE GANHA [0/3], NO CASO AQUI É 1 MINUTO, NA TEXTDRAWN TEM 0/3, E QUANDO CHEGAR A 3 MINUTOS GANHA 1 GOLD
  54.     SetTimer("ActualizarTextDraws",true,60000);
  55.     //Gold
  56.     Textdraw0[playerid] = TextDrawCreate(551.000000, 291.000000, "Gold: 0");
  57.     TextDrawBackgroundColor(Textdraw0[playerid], 255);
  58.     TextDrawFont(Textdraw0[playerid], 3);
  59.     TextDrawLetterSize(Textdraw0[playerid], 0.500000, 1.000000);
  60.     TextDrawColor(Textdraw0[playerid], 65535);
  61.     TextDrawSetOutline(Textdraw0[playerid], 0);
  62.     TextDrawSetProportional(Textdraw0[playerid], 1);
  63.     TextDrawSetShadow(Textdraw0[playerid], 1);
  64.     //tGold
  65.     Textdraw1[playerid] = TextDrawCreate(551.000000, 268.000000, "0/3");
  66.     TextDrawBackgroundColor(Textdraw1[playerid], 255);
  67.     TextDrawFont(Textdraw1[playerid], 1);
  68.     TextDrawLetterSize(Textdraw1[playerid], 0.280000, 2.100000);
  69.     TextDrawColor(Textdraw1[playerid], -16776961);
  70.     TextDrawSetOutline(Textdraw1[playerid], 0);
  71.     TextDrawSetProportional(Textdraw1[playerid], 1);
  72.     TextDrawSetShadow(Textdraw1[playerid], 1);
  73.     return 1;
  74. }
  75.  
  76.  
  77. public OnPlayerEnterCheckpoint(playerid)
  78. {
  79.     DisablePlayerCheckpoint(playerid); // Destruirá ao Ficar em Cima Dele.
  80.     GameTextForPlayer(playerid, "~y~] Premios Gold ]~n~~w~Aperte '~b~F~w~' Para Abrir o Menu de Premios", 5000, 3);
  81.     return 1;
  82. }
  83.  
  84. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  85. {
  86.     if(dialogid == DIALOG_PREMIOS)
  87.     {
  88.         if(response)
  89.         {
  90.             if(listitem == 0)
  91.             {
  92.                 if(Gold[playerid] >= 10)
  93.                 {
  94.                     Gold[playerid] -= 10;
  95.                     new String[128];
  96.                     GivePlayerMoney(playerid, 1000);
  97.                     SendClientMessage(playerid, -1, "{7FFFD4} Você ganhou {7CFC00}R${AFEEEE} 1000,00");
  98.                     format(String, sizeof(String), "{7FFFD4}Você Gastou {AFEEEE}10{7FFFD4} Gold's, e agora tem {AFEEEE}%d{7FFFD4} de Gold!", Gold[playerid]);
  99.                     SendClientMessage(playerid, -1, String);
  100.                 }
  101.                 else
  102.                 {
  103.                     SendClientMessage(playerid, -1, "{FFA500}[ERRO] {E0FFFF}Você não tem 10 Gold's!");
  104.                 }
  105.             }
  106.             else if (listitem == 1)
  107.             {
  108.                 if(Gold[playerid] >= 20)
  109.                 {
  110.                     Gold[playerid] -= 20;
  111.                     new String[128];
  112.                     GivePlayerMoney(playerid, 2000);
  113.                     SendClientMessage(playerid, -1, "{7FFFD4} Você ganhou {7CFC00}R${AFEEEE} 2000,00");
  114.                     format(String, sizeof(String), "{7FFFD4}Você Gastou {AFEEEE}20{7FFFD4} Gold's, e agora tem {AFEEEE}%d{7FFFD4} de Gold!", Gold[playerid]);
  115.                     SendClientMessage(playerid, -1, String);
  116.                 }
  117.                 else
  118.                 {
  119.                     SendClientMessage(playerid, -1, "{FFA500}[ERRO] {E0FFFF}Você não tem 20 Gold's!");
  120.                 }
  121.             }
  122.             else if (listitem == 2)
  123.             {
  124.                 if(Gold[playerid] >= 50)
  125.                 {
  126.                     Gold[playerid] -= 50;
  127.                     new String[128];
  128.                     GivePlayerMoney(playerid, 10000);
  129.                     SendClientMessage(playerid, -1, "{7FFFD4} Você ganhou {7CFC00}R${AFEEEE} 10000,00");
  130.                     format(String, sizeof(String), "{7FFFD4}Você Gastou {AFEEEE}50{7FFFD4} Gold's, e agora tem {AFEEEE}%d{7FFFD4} de Gold!", Gold[playerid]);
  131.                     SendClientMessage(playerid, -1, String);
  132.                 }
  133.                 else
  134.                 {
  135.                     SendClientMessage(playerid, -1, "{FFA500}[ERRO] {E0FFFF}Você não tem 50 Gold's!");
  136.                 }
  137.             }
  138.             else if (listitem == 3)
  139.             {
  140.                 if(Gold[playerid] >= 100)
  141.                 {
  142.                     Gold[playerid] -= 100;
  143.                     new String[128];
  144.                     GivePlayerMoney(playerid, 30000);
  145.                     SendClientMessage(playerid, -1, "{7FFFD4} Você ganhou {7CFC00}R${AFEEEE} 30000,00");
  146.                     format(String, sizeof(String), "{7FFFD4}Você Gastou {AFEEEE}100{7FFFD4} Gold's, e agora tem {AFEEEE}%d{7FFFD4} de Gold!", Gold[playerid]);
  147.                     SendClientMessage(playerid, -1, String);
  148.                 }
  149.                 else
  150.                 {
  151.                     SendClientMessage(playerid, -1, "{FFA500}[ERRO] {E0FFFF}Você não tem 100 Gold's!");
  152.                 }
  153.             }
  154.             else if (listitem == 4)
  155.             {
  156.                 if(Gold[playerid] >= 500)
  157.                 {
  158.                     Gold[playerid] -= 500;
  159.                     new String[128];
  160.                     GivePlayerMoney(playerid, 200000);
  161.                     SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
  162.                     SendClientMessage(playerid, -1, "{7FFFD4} Você ganhou {7CFC00}R${AFEEEE} 200000,00{7FFFD4} e {AFEEEE}1{7FFFD4} Nível");
  163.                     format(String, sizeof(String), "{7FFFD4}Você Gastou {AFEEEE}500{7FFFD4} Gold's, e agora tem {AFEEEE}%d{7FFFD4} de Gold!", Gold[playerid]);
  164.                     SendClientMessage(playerid, -1, String);
  165.                 }
  166.                 else
  167.                 {
  168.                     SendClientMessage(playerid, -1, "{FFA500}[ERRO] {E0FFFF}Você não tem 500 Gold's!");
  169.                 }
  170.             }
  171.             else if (listitem == 5)
  172.             {
  173.                 if(Gold[playerid] >= 750)
  174.                 {
  175.                     Gold[playerid] -= 750;
  176.                     new String[128];
  177.                     GivePlayerMoney(playerid, 500000);
  178.                     SetPlayerScore(playerid, GetPlayerScore(playerid) + 3);
  179.                     SendClientMessage(playerid, -1, "{7FFFD4} Você ganhou {7CFC00}R${AFEEEE} 500000,00{7FFFD4} e {AFEEEE}3{7FFFD4} Níveis");
  180.                     format(String, sizeof(String), "{7FFFD4}Você Gastou {AFEEEE}750{7FFFD4} Gold's, e agora tem {AFEEEE}%d{7FFFD4} de Gold!", Gold[playerid]);
  181.                     SendClientMessage(playerid, -1, String);
  182.                 }
  183.                 else
  184.                 {
  185.                     SendClientMessage(playerid, -1, "{FFA500}[ERRO] {E0FFFF}Você não tem 750 Gold's!");
  186.                 }
  187.             }
  188.             else if (listitem == 6)
  189.             {
  190.                 if(Gold[playerid] >= 1000)
  191.                 {
  192.                     Gold[playerid] -= 1000;
  193.                     new String[128];
  194.                     GivePlayerMoney(playerid, 1000000);
  195.                     SetPlayerScore(playerid, GetPlayerScore(playerid) + 10);
  196.                     SendClientMessage(playerid, -1, "{7FFFD4} Você ganhou {7CFC00}R${AFEEEE} 1.000.000,00{7FFFD4} e {AFEEEE}10{7FFFD4} Níveis");
  197.                     format(String, sizeof(String), "{7FFFD4}Você Gastou {AFEEEE}1000{7FFFD4} Gold's, e agora tem {AFEEEE}%d{7FFFD4} de Gold!", Gold[playerid]);
  198.                     SendClientMessage(playerid, -1, String);
  199.                 }
  200.                 else
  201.                 {
  202.                     SendClientMessage(playerid, -1, "{FFA500}[ERRO] {E0FFFF}Você não tem 1000 Gold's!");
  203.                 }
  204.             }
  205.         }
  206.         return 1;
  207.     }
  208.     return 1;
  209. }
  210.  
  211. //Comandos
  212.  
  213. CMD:retirargold(playerid, params[])
  214. {
  215.     new id, QuantiadeGold;
  216.     if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "{FFA500}[ERRO]{E0FFFF}Você não é administrador!");
  217.     if (sscanf(params, "ud", id, QuantiadeGold)) return SendClientMessage(playerid, -1, "{FFA500}[ERRO]{E0FFFF} USE: /retirargold [ID] [GOLD]");
  218.     if (!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "{FFA500}[ERRO]{E0FFFF} O Player não está connectado!");
  219.     Gold[id] -= QuantiadeGold;
  220.     return 1;
  221. }
  222.  
  223. CMD:premio(playerid)
  224. {
  225.     if(IsPlayerInRangeOfPoint(playerid, 2.0, PosPremios))
  226.     {
  227.         new ListaPremios[4000];
  228.         strcat(ListaPremios,"{7CFC00}R${F8F8FF} 1.000,00{FFFF00} [10 Gold's]\n");
  229.         strcat(ListaPremios,"{7CFC00}R${F8F8FF} 2.000,00{FFFF00} [20 Gold's]\n");
  230.         strcat(ListaPremios,"{7CFC00}R${F8F8FF} 10.000,00{FFFF00} [50 Gold's]\n");
  231.         strcat(ListaPremios,"{7CFC00}R${F8F8FF} 30.000,00{FFFF00} [100 Gold's]\n");
  232.         strcat(ListaPremios,"{7CFC00}R${F8F8FF} 200.000,00 + 1 Nível{FFFF00} [500 Gold's]\n");
  233.         strcat(ListaPremios,"{7CFC00}R${F8F8FF} 500.000,00 + 3 Níveis{FFFF00} [750 Gold's]\n");
  234.         strcat(ListaPremios,"{7CFC00}R${F8F8FF} 1.000.000,00 + 10 Níveis{FFFF00} [1000 Gold's]");
  235.         ShowPlayerDialog(playerid, DIALOG_PREMIOS, DIALOG_STYLE_LIST, "Premios Gold", ListaPremios, "Selecionar", "Fechar");
  236.     }
  237.     return 1;
  238. }
  239.  
  240. CMD:ajudagold(playerid)
  241. {
  242.     new AjudaPlayer[1000];
  243.     new AjudaAdmin[1000];
  244.     if (IsPlayerAdmin(playerid))
  245.     {
  246.         strcat(AjudaAdmin,"{FFD700}/dargold {FFFFFF}- {FFEFD5}Para dar Gold ao um Player.\n");
  247.         strcat(AjudaAdmin,"{FFD700}/setargold {FFFFFF}- {FFEFD5}Para setar o Gold de um Player\n");
  248.         strcat(AjudaAdmin,"{FFD700}/retirargold {FFFFFF}- {FFEFD5}Para retirar Gold de um Player.");
  249.         ShowPlayerDialog(playerid, 3442, DIALOG_STYLE_MSGBOX, "{FFD700}Ajuda Gold",AjudaAdmin, "Fechar", "");
  250.     }
  251.     else
  252.     {
  253.         strcat(AjudaPlayer,"{FFA500}Informações:\n");
  254.         strcat(AjudaPlayer,"{7FFFD4}A cada {AFEEEE}3 {7FFFD4}Minutos você ganha um Gold.\n");
  255.         strcat(AjudaPlayer,"{7FFFD4}Você pode pegar premios em um local, digite: {FFD700}/gpsgold {7FFFD4} para encontra-lo\n");
  256.         strcat(AjudaPlayer,"{FFA500} \n");
  257.         strcat(AjudaPlayer,"{FFA500}Comandos:\n");
  258.         strcat(AjudaPlayer,"{FFD700}/meugold {FFFFFF}- {FFEFD5}Para ver a Quantidade de Gold que você tem.\n");
  259.         strcat(AjudaPlayer,"{FFD700}/gpsgold {FFFFFF}- {FFEFD5}Local onde se pega premios (Dependendo de Quantos Gold's Você Tem).\n");
  260.         ShowPlayerDialog(playerid, 3442, DIALOG_STYLE_MSGBOX, "{FFD700}Ajuda Gold",AjudaPlayer, "Fechar", "");
  261.     }
  262.     return 1;
  263. }
  264.  
  265. CMD:gpsgold(playerid)
  266. {
  267.     SetPlayerCheckpoint(playerid, PosPremios,8.0);//Checkpoint Onde aparecerar
  268.     SendClientMessage(playerid, -1, "{FFD700} Um ponto {FFA500}vermelho {FFD700}foi marcado no mapa, vá até ele!");
  269.     return 1;
  270. }
  271.  
  272. CMD:meugold(playerid)
  273. {
  274.     new String[128];
  275.     new MyGold;
  276.     MyGold = Gold[playerid];
  277.     format(String, sizeof(String), "{7FFFD4}Você tem {AFEEEE}%d{7FFFD4} de Gold!", MyGold);
  278.     SendClientMessage(playerid, -1, String);
  279.     return 1;
  280. }
  281.  
  282. CMD:setargold(playerid, params[])
  283. {
  284.     new id, dargold;
  285.     if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "{FFA500}[ERRO] {E0FFFF}Você não é administrador!");
  286.     if (sscanf(params, "ud", id, dargold)) return SendClientMessage(playerid, -1, "{FFA500}[ERRO] {E0FFFF}USE: /setargold [ID] [GOLD]");
  287.     if (!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "{FFA500}[ERRO] {E0FFFF} O Player não está connectado!");
  288.     Gold[id] = dargold;
  289.     return 1;
  290. }
  291.  
  292. CMD:dargold(playerid, params[])
  293. {
  294.     new ID, GoldQuantia;
  295.     if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "{FFA500}[ERRO] {E0FFFF}Você não é administrador!");
  296.     if (sscanf(params, "ud", ID, GoldQuantia)) return SendClientMessage(playerid, -1, "{FFA500}[ERRO] {E0FFFF}USE: /dargold [ID] [GOLD]");
  297.     if (!IsPlayerConnected(ID)) return SendClientMessage(playerid, -1, "{FFA500}[ERRO]{E0FFFF} O Player não está connectado!");
  298.     Gold[ID] += GoldQuantia;
  299.     return 1;
  300. }
  301.  
  302. //Stock's
  303. stock PlayerName(playerid)
  304. {
  305.     new PlayerNameGold[MAX_PLAYERS];
  306.     GetPlayerName(playerid, PlayerNameGold, MAX_PLAYERS);
  307.     return PlayerNameGold;
  308. }
  309.  
  310. //Forward's
  311. forward ActualizarTextDraws();
  312. public ActualizarTextDraws()
  313. {
  314.     new String[100];
  315.  
  316.     for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
  317.     {
  318.         if(IsPlayerConnected(playerid))
  319.         {
  320.             format(String, sizeof(String), "Gold: %d", Gold[playerid]);
  321.             TextDrawSetString(Textdraw0[playerid], String);
  322.             TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
  323.             format(String, sizeof(String), "  %d / 3", tGold[playerid]);
  324.             TextDrawSetString(Textdraw1[playerid], String);
  325.             TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
  326.         }
  327.     }
  328. }
  329.  
  330. forward Timer(playerid);
  331. public Timer(playerid)
  332. {
  333.     tGold[playerid]++;
  334.     if(tGold[playerid] == 3)
  335.     {
  336.         Gold[playerid]++;
  337.         SendClientMessage(playerid,-1,"{FF3D3D}[INFO]{FFFFFF} Parabéns, você ganhou 1 Gold!");
  338.         tGold[playerid] = 0;
  339.     }
  340.     return 1;
  341. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement