02.04.2013, 15:25
(
Последний раз редактировалось EiresJason; 02.04.2013 в 16:56.
)
Hi there!
Okay. I have a command (/eat) which allows players to type /eat inside a interior, at the moment, it is the pizza stack in idlewood. A dialog appears and players can scroll between five different 'meals' which costs a different price, and heals a different amount of hp.
Everything works perfectly apart one thing. When a player eats a meal which would increase their HP above 100.
For example; I have 85 HP, and i want to buy a supersize meal which heals 40 health. I would end up with 125 hp.
I have it so if you purchase a meal after you have exceeded 100hp, it will bring it back down to 100 hp.
Example; I have 85 HP, and i have just bought a meal that would heal me for 40 health, i end up with 125 hp and i think to myself, "Il eat another meal, so that way i would have 165 hp". If a player does this, their HP is set to 100.
To sum it up, i need to fix my script so peoples HP do not exceed 100 health.
Any help would be greatly appreciated!
Thanks a lot.
This is my /eat command.
This is my code for when you click on a meal.
I removed the rest of the other cases to keep the code neater and shorter.
Again, thanks for any help.
Okay. I have a command (/eat) which allows players to type /eat inside a interior, at the moment, it is the pizza stack in idlewood. A dialog appears and players can scroll between five different 'meals' which costs a different price, and heals a different amount of hp.
Everything works perfectly apart one thing. When a player eats a meal which would increase their HP above 100.
For example; I have 85 HP, and i want to buy a supersize meal which heals 40 health. I would end up with 125 hp.
I have it so if you purchase a meal after you have exceeded 100hp, it will bring it back down to 100 hp.
Example; I have 85 HP, and i have just bought a meal that would heal me for 40 health, i end up with 125 hp and i think to myself, "Il eat another meal, so that way i would have 165 hp". If a player does this, their HP is set to 100.
To sum it up, i need to fix my script so peoples HP do not exceed 100 health.
Any help would be greatly appreciated!
Thanks a lot.
This is my /eat command.
pawn Код:
CMD:eat(playerid, params[])
{ //new hp = GetPlayerHealth(playerid,PlayerInfo[playerid][pHealth]);
if(IsPlayerInRangeOfPoint(playerid, 2.0,375.3056,-119.3129,1001.4995)) //idlewood pizza stack
{
GetPlayerHealth(playerid,PlayerInfo[playerid][pHealth]);
SetPlayerHealth(playerid,PlayerInfo[playerid][pHealth]);
ShowPlayerDialog(playerid, DIALOG_IDLESTACKEAT, DIALOG_STYLE_LIST, ""COL_WHITE"Please choose a meal!", ""COL_WHITE"Small meal: $5\nMedium meal: $8\nLarge meal: $10\nExtra large meal: $12\nSupersize meal: $15", "Purchase", "Cancel");
//if(hp >= 100) return SetPlayerHealth(playerid,100);
}
return 1;
}
pawn Код:
Fixed.
Again, thanks for any help.