Rhay_Fither

Sistema de Gold - v2.0 [TextDrawn encima do Radar]

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