Hunger Pronlem
#1

Guys, i have a hunger problem here... The hunger bar is keep decreasing but when i go /eat in a restaurant it doesnt increasing... I dont know why... And here's the code of that
Код:
CMD:eat(playerid,params[])
{
    new idx = GetPlayerVirtualWorld(playerid)-100;
	if(PlayerInfo[playerid][pHunger] < 100 )
	{
	    if(GetPVarInt(playerid, "OverHungry") != 0 || GetPVarType(playerid, "OverHungry")!=0)
	    {
     		KillTimer(GetPVarInt(playerid, "OverHungry"));
			DeletePVar(playerid, "OverHungry");
		}
	    if(GetPVarInt(playerid, "HungerTimer") == 0 || GetPVarType(playerid, "HungerTimer")==0)
	    {
		    new hunger = SetTimerEx("HungerTime", 80*1000, 1, "d", playerid);
			SetPVarInt(playerid, "HungerTimer", hunger);
		}
		if(IsAtFoodStore(playerid))
		{
		    if(idx>0 && BizInfo[idx][bProducts] <=0)
			{
			    SendClientMessageEx(playerid, COLOR_GRAD2, "   This business doesnt have products!");
		        return 1;
			}
			if(idx>0 && BizInfo[idx][bProducts] >0)
			{
				GivePlayerCash(playerid, -1000);
		        BizInfo[idx][bMoney] += 1000;
				BizInfo[idx][bProducts] -= 5;
				BizInfo[idx][bSold] ++;
			}
			PlayerInfo[playerid][pHunger]+=200;
		    SendClientMessage(playerid, COLOR_WHITE, "You are eating here!");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_BLUE, "Your stomach is full!");
  	}
	return 1;
}
Reply
#2

And i have a bug hre that i can do /eat everywhere :/ this is the code
Код:
IsAtFoodStore(playerid)
{
	if(IsPlayerConnected(playerid))
	{
		if(IsPlayerInRangeOfPoint(playerid, 10.0,427.73, 2445.20, 711.31) || IsPlayerInRangeOfPoint(playerid, 20, 366.0248, -73.3478, 1001.5078) || IsPlayerInRangeOfPoint(playerid, 50, 372.3520, -131.6510, 1001.4922) || IsPlayerInRangeOfPoint(playerid, 50, 365.7158, -9.8873, 1001.8516))
		{
			return 1;
		}
	}
	return 0;
}
Reply
#3

Anyone know how to fix this?
Reply
#4

you may use this:
https://sampforum.blast.hk/showthread.php?tid=352345
can remove that if you don't need that commands
Reply
#5

Thanks but how can i remove the Hunger System from my script?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)