[HELP] Hungry system
#1

Hello everyone, hunger installing the system on the server encounter the following problem: Then hungry progress is 0 nothing happens, Should decrease heal. SORRY FOR MY BAD ENGLISH ;/

// Hungry System By RipLagger
// Full Credited To Include Maker

#define FILTERSCRIPT

#include <a_samp>
#include <ProgressBar>
#include <dini>
#include <zcmd>

#if defined FILTERSCRIPT

#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA

new Text:Hungry;
new Bar:hungry[MAX_PLAYERS] = {INVALID_BAR_ID, ...};
forward ProgressBar();
forward update();

enum PlayerStats
{
Hunger
};
new PInfo[MAX_PLAYERS][PlayerStats];


public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Loading Hungry System By RipLagger");
print("--------------------------------------\n");
SetTimer("ProgressBar", 180000, 1);
SetTimer("update", 5000, 1);

for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
new Float:health;
GetPlayerHealth(playerid, health);
new HungryTime = SetPlayerHealth(playerid, health-5);
if(GetProgressBarValue(hungry[playerid]) <= 0)
{
SetTimer("HungryTime", 30000, 1);
SendClientMessage(playerid, COLOR_BLUE, "You Are Hungry Now, Go To The Restaurant To Eat Some Food");
SendClientMessage(playerid, COLOR_BLUE, "If You're Not Going To Eat, You Will Lose Your Health Every 30 Seconds");
}
if(GetProgressBarValue(hungry[playerid]) <= 0)
{
SetProgressBarValue(hungry[playerid], 0);
}
if(GetProgressBarValue(hungry[playerid]) > 0)
{
KillTimer(HungryTime);
}
}

Hungry = TextDrawCreate(538, 114, "Hunger");
TextDrawColor(Hungry, 0xFFFF00AA);
TextDrawBackgroundColor(Hungry, -1);
TextDrawLetterSize(Hungry, 0.46, 1);
TextDrawSetOutline(Hungry, 1);
TextDrawSetProportional(Hungry, 0);
TextDrawSetShadow(Hungry, 2);
TextDrawUseBox(Hungry, 0);

print("\n--------------------------------------");
print(" Loaded Hungry System By RipLagger|Warning dont remove any credits");
print("--------------------------------------\n");

return 1;
}

public ProgressBar()
{
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
SetProgressBarValue(hungry[playerid], GetProgressBarValue(hungry[playerid])-2);
}
return 1;
}

public update()
{
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
UpdateProgressBar(hungry[playerid], playerid);
}
return 1;
}

#endif

public OnPlayerConnect(playerid)
{
PInfo[playerid][Hunger] = 100;
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
new file[256],n[MAX_PLAYER_NAME];
GetPlayerName(playerid,n,MAX_PLAYER_NAME);
format(file,sizeof(file),"Stats/%s.txt",n);
PInfo[playerid][Hunger] = floatround(GetProgressBarValue(hungry[playerid]));
if(dini_Exists(file))
{
dini_IntSet(file,"Hunger",floatround(GetProgressBa rValue(hungry[playerid])));
return 1;
}
return 1;
}

public OnPlayerSpawn(playerid)
{
new file[256],n[MAX_PLAYER_NAME];
GetPlayerName(playerid,n,MAX_PLAYER_NAME);
format(file,sizeof(file),"Stats/%s.txt",n);
if(!dini_Exists(file))
{
dini_Create(file);
dini_IntSet(file,"Hunger",100);
}
hungry[playerid] = CreateProgressBar(528.00, 115.00, 76.50, 8.50, 0x0000BBAA, 100.0);
ShowProgressBarForPlayer(playerid, hungry[playerid]);
TextDrawShowForPlayer(playerid, Hungry);
SetProgressBarValue(hungry[playerid], dini_Int(file,"Hunger"));
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
SetProgressBarValue(hungry[playerid], 100);
return 1;
}

CMD:eat(playerid,params[])
{
new Float:health;
GetPlayerHealth(playerid,health);
if(IsPlayerInRangeOfPoint(playerid, 20, 366.0248, -73.3478, 1001.507)
{
GivePlayerMoney(playerid, -50);
SetPlayerHealth(playerid,health+6);
SetProgressBarValue(hungry[playerid], GetProgressBarValue(hungry[playerid])+15);
return SendClientMessage(playerid, COLOR_BLUE, "Thanks For Buying Burger Enjoy The Food");
}
if(IsPlayerInRangeOfPoint(playerid, 50, 372.3520, -131.6510, 1001.4922))
{
GivePlayerMoney(playerid, -70);
SetPlayerHealth(playerid,health+15);
SetProgressBarValue(hungry[playerid], GetProgressBarValue(hungry[playerid])+25);
return SendClientMessage(playerid, COLOR_BLUE, "Thanks For Buying Pizza Enjoy The Food");
}
if(!IsPlayerInRangeOfPoint(playerid, 50, 365.7158, -9.8873, 1001.8516))
{
GivePlayerMoney(playerid, -35);
SetPlayerHealth(playerid,health+4);
SetProgressBarValue(hungry[playerid], GetProgressBarValue(hungry[playerid])+12);
return SendClientMessage(playerid, COLOR_BLUE, "Thanks For Buying Fried Chicken Enjoy The Food");
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)