25.06.2014, 12:42
I have food system that is taking every minute 1 % of food and textdraw to show how many % you have...
Now when i am the only player in the server all works fine, but when there are multiple players then it dont show player HIS hunger, but somone elses... i think that is showing the last players hunger to everyone(player with the highest ID)
Here is the script:
Now when i am the only player in the server all works fine, but when there are multiple players then it dont show player HIS hunger, but somone elses... i think that is showing the last players hunger to everyone(player with the highest ID)
Here is the script:
Код:
forward TimerMin(); //This is a 1 minute timer...
public TimerMin()
{
for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
{
if(pInfo[i][Hunger] >= 1) // If player have more than 1% of hunger.
{
pInfo[i][Hunger] --;
TextDrawHideForPlayer(i,hrana);
new hranastr[124];
format(hranastr, sizeof(hranastr), "Hrana: %i %", pInfo[i][Hunger]); // Textdraw for display % of hunger.
TextDrawSetString(hrana, hranastr);
TextDrawShowForPlayer(i, hrana);
if(pInfo[i][Hunger] == 1)
{
SendClientMessage(i, COLOR_YELLOW, "Lačni ste. Morate jesti!"); // Warns the player if he have 1% of hunger.
}
}
else if(pInfo[i][Hunger] == 0) // If player have 0% of hunger...
{
new Float:health;
GetPlayerHealth(i,health);
SetPlayerHealth(i, health - 9); // Take 9 players health...
}
}
return 1;
}

