Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <Dini>
- //NEWS
- new Text:Textdraw1[MAX_PLAYERS];
- new Text:Textdraw0[MAX_PLAYERS];
- new Gold[MAX_PLAYERS];
- new tGold[MAX_PLAYERS];
- //DEFINES
- #define Cor 0xFF00EBFF
- public OnPlayerSpawn(playerid)
- {
- 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
- SetTimer("ActualizarTextDraws",true,60000);
- ///////////////////////// Gold ////////////////////////////////////////////////
- Textdraw0[playerid] = TextDrawCreate(551.000000, 291.000000, "Gold: 0");
- TextDrawBackgroundColor(Textdraw0[playerid], 255);
- TextDrawFont(Textdraw0[playerid], 3);
- TextDrawLetterSize(Textdraw0[playerid], 0.500000, 1.000000);
- TextDrawColor(Textdraw0[playerid], 65535);
- TextDrawSetOutline(Textdraw0[playerid], 0);
- TextDrawSetProportional(Textdraw0[playerid], 1);
- TextDrawSetShadow(Textdraw0[playerid], 1);
- //////////////////////////tGold//////////////////////////////////////////////
- Textdraw1[playerid] = TextDrawCreate(551.000000, 268.000000, "0/3");
- TextDrawBackgroundColor(Textdraw1[playerid], 255);
- TextDrawFont(Textdraw1[playerid], 1);
- TextDrawLetterSize(Textdraw1[playerid], 0.280000, 2.100000);
- TextDrawColor(Textdraw1[playerid], -16776961);
- TextDrawSetOutline(Textdraw1[playerid], 0);
- TextDrawSetProportional(Textdraw1[playerid], 1);
- TextDrawSetShadow(Textdraw1[playerid], 1);
- return 1;
- }
- forward ActualizarTextDraws();
- public ActualizarTextDraws()
- {
- new String[100];
- for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
- {
- if(IsPlayerConnected(playerid))
- {
- format(String, sizeof(String), "Gold: %d", Gold[playerid]);
- TextDrawSetString(Textdraw0[playerid], String);
- TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
- format(String, sizeof(String), " %d / 3", tGold[playerid]);
- TextDrawSetString(Textdraw1[playerid], String);
- TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
- }
- }
- }
- forward Timer(playerid);
- public Timer(playerid)
- {
- tGold[playerid]++;
- if(tGold[playerid] == 3)
- {
- Gold[playerid]++;
- SendClientMessage(playerid,Cor,"{FF3D3D}[INFO]{FFFFFF} Parabéns, você ganhou 1 Gold!");
- tGold[playerid] = 0;
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- if(dini_Isset("Golds.dkn",PlayerName(playerid))) Gold[playerid] = (playerid,dini_Int("Golds.dkn",PlayerName(playerid)));
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- dini_IntSet("Golds.dkn",PlayerName(playerid),Gold[playerid]);
- return 1;
- }
- public OnGameModeInit()
- {
- if(!fexist("Golds.dkn")) dini_Create("Golds.dkn");
- return 1;
- }
- stock PlayerName(playerid)
- {
- new PlayerNameGold[MAX_PLAYERS];
- GetPlayerName(playerid, PlayerNameGold, MAX_PLAYERS);
- return PlayerNameGold;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/premio", cmdtext, true) == 0) //DIALOG PREMIOS
- {
- ShowPlayerDialog(playerid, 2014, DIALOG_STYLE_LIST, "GOLD - Premio", "{7CFC00}R${F8F8FF}1.000.000,00{FFFF00} [1000 Gold's]", "Selecionar", "Fechar");
- return 1;
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == 2014)
- {
- if(response)
- {
- if(listitem == 0)
- {
- if(Gold[playerid] > 1000)
- {
- //COLOQUE AQUI OQUE ELE VAI GANHAR SE SELECINAR O ITEM, EXEMPLO:
- GivePlayerMoney(playerid, 1000000);
- Gold[playerid] = 0; //VAI ZERAR O GOLD
- }
- else
- {
- SendClientMessage(playerid, Cor, "{FF3D3D}[ERRO]{FFFFFF} Você não tem 1000 de Gold."); //MENSAGEM SE O PLAYER NÃO TIVER 1000 DE GOLD
- }
- }
- }
- return 1;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement