Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**********************************[ INCLUDES ]*********************************/
- #include <a_samp>
- #define FILTERSCRIPT
- #include <sscanf>
- #include <zcmd>
- #include <progress>
- #include <DOF2>
- /**********************************[ OUTROS ]***********************************/
- #define tSpeed(%0) %0*500 // Muito rápido
- #define tSegundos(%0) %0*1000 // Segundos
- #define tMinutos(%0) %0*60000 // Minutos
- #define SendClientMessageEx(%0,%1,%2,%3); format(StringRhay, sizeof StringRhay, %2, %3); SendClientMessage(%0, %1, StringRhay);
- #define VerificarConexao(%0,%1); if(!IsPlayerConnected(%0)) return SendClientMessage(%1, COLOR_ERRO, "| ERRO | Player não connectado!");
- #define VerificarAdmin(%0,%1); if(!IsPlayerAdmin(%0)) return SendClientMessage(%1, COLOR_ERRO, "| ERRO | Você não tem autorização");
- /********************************[ MODIFICAÇÕES ]*******************************/
- #define TEMPO_AUMENTAR_FOME 5 //Em minutos!
- #define DINHEIRO_PERDIDO_AO_MORRER 500 //Quanto dinheiro o player irá perder ao morrer de fome!
- /***********************************[ NEW's ]***********************************/
- new Bar:BarraFome[MAX_PLAYERS], Fome[MAX_PLAYERS], StringRhay[128], bool:MorreuFome[MAX_PLAYERS];
- /**********************************[ CORES's ]**********************************/
- #define COLOR_INFO 0x8470FFFF
- #define COLOR_ERRO 0xFF3030FF
- /************************************[ FIM ]************************************/
- public OnFilterScriptInit()
- {
- print("\n|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|");
- print("| [FS] Sistema de Fome - v1.0 |");
- print("| By: Rhay_Fither |");
- print("| LIGADO COM SUCESSO! |");
- print("|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- DOF2_Exit();
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new rArquivo[40];
- BarraFome[playerid] = CreateProgressBar(549.00, 59.00, 55.50, 2.50, 0x8470FFFF, 100.0);
- SetTimerEx("AumentarFome", tMinutos(TEMPO_AUMENTAR_FOME), true, "i", playerid);
- SetTimerEx("AtualizarFome", tSegundos(1), true, "i");
- format(rArquivo, sizeof(rArquivo), "FomeSystem/%s.ini", rPlayerName(playerid)); //Formatamos o arquivo de acordo com o nome do player (Contas/NOME)
- Fome[playerid] = DOF2_GetInt(rArquivo, "Fome");
- HideProgressBarForPlayer(playerid, BarraFome[playerid]);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- HideProgressBarForPlayer(playerid, BarraFome[playerid]);
- new rArquivo[40];
- format(rArquivo, sizeof(rArquivo), "FomeSystem/%s.ini", rPlayerName(playerid));
- if(DOF2_FileExists(rArquivo))
- {
- DOF2_SetInt(rArquivo, "Fome", Fome[playerid]);
- }
- else
- {
- DOF2_CreateFile(rArquivo);
- DOF2_SetInt(rArquivo, "Fome", Fome[playerid]);
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- ShowProgressBarForPlayer(playerid, BarraFome[playerid]);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(MorreuFome[playerid] == true)
- {
- SetTimerEx("ResetarFome", tSpeed(1), false, "i", playerid);
- MorreuFome[playerid] = false;
- }
- return 1;
- }
- CMD:setarfome(playerid, params[])
- {
- new rID, rFome;
- VerificarAdmin(playerid, playerid);
- if(sscanf(params, "ud", rID, rFome)) return SendClientMessage(playerid, COLOR_ERRO, "| ERRO | Use: /setarfome [ID] [FOME]");
- VerificarConexao(rID, playerid);
- Fome[rID] = rFome;
- SendClientMessageEx(rID, COLOR_INFO, "| INFO | O Admin %s setou sua fome para %d.",rPlayerName(playerid), rFome);
- SendClientMessageEx(playerid, 0x7FFF00FF, "| INFO | Fome do player %s setada para %d com sucesso.", rPlayerName(playerid), rFome);
- return 1;
- }
- CMD:comer(playerid)
- {
- Fome[playerid] = 0;
- GivePlayerMoney(playerid, -50);
- return 1;
- }
- forward AumentarFome(playerid);
- public AumentarFome(playerid)
- {
- Fome[playerid] += 5;
- SetProgressBarValue(BarraFome[playerid], Fome[playerid]);
- UpdateProgressBar(BarraFome[playerid], playerid);
- if(Fome[playerid] == 95)
- {
- SendClientMessageEx(playerid, COLOR_INFO, "| INFO | %s, você está com muita fome, se não comer, morrerá!", rPlayerName(playerid));
- }
- return 1;
- }
- forward AtualizarFome(playerid);
- public AtualizarFome(playerid)
- {
- SetProgressBarValue(BarraFome[playerid], Fome[playerid]);
- UpdateProgressBar(BarraFome[playerid], playerid);
- if(Fome[playerid] >= 100)
- {
- MorreuFome[playerid] = true;
- HideProgressBarForPlayer(playerid, BarraFome[playerid]);
- SetPlayerHealth(playerid, 0);
- GivePlayerMoney(playerid, -DINHEIRO_PERDIDO_AO_MORRER);
- SendClientMessageEx(playerid, COLOR_INFO, "| INFO | Você morreu de fome e por isso perdeu {00FF00}R$%d{8470FF}!", DINHEIRO_PERDIDO_AO_MORRER);
- }
- return 1;
- }
- forward ResetarFome(playerid);
- public ResetarFome(playerid)
- {
- Fome[playerid] = 0;
- return 1;
- }
- stock rPlayerName(playerid)
- {
- new NomeDaStock[MAX_PLAYER_NAME];
- GetPlayerName(playerid, NomeDaStock, MAX_PLAYER_NAME);
- return NomeDaStock;
- }
Advertisement
Add Comment
Please, Sign In to add comment