health -
oscar7610 - 08.04.2012
How can I increase players health like by +5 or 10 when they buy a drink?
Re: health -
Boooth - 08.04.2012
Do you currently have a system for purchasing drinks?
if so, I need to know what variable you use for health.
But it will look something like this;
Код:
playerVariables[playerid][pHealth] += 5;
Add that to the command for purchasing a drink, should work but again you need to adapt it to your script.
Re: health -
oscar7610 - 08.04.2012
No im using just a dialog. no zcmd nothing.
Re: health -
Kitten - 08.04.2012
pawn Код:
new Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health + 5.0);
Re: health -
[DOG]irinel1996 - 08.04.2012
pawn Код:
new Float:Health;
GetPlayerHealth(playerid, Health);
SetPlayerHealth(playerid, Health+10.0);
if(Health > 100.0)
{
SetPlayerHealth(playerid, 100.0);
}
_______________
EDIT: Haha, too late.
Re: health -
oscar7610 - 08.04.2012
C:\Users\Oscar\Desktop\*\Modern Life Roleplay [Oscar]\Modern Life Roleplay [Oscar]\pawno\include\func.inc(109) : warning 219: local variable "health" shadows a variable at a preceding level
C:\Users\Oscar\Desktop\*\Modern Life Roleplay [Oscar]\Modern Life Roleplay [Oscar]\pawno\include\func.inc(387) : warning 219: local variable "health" shadows a variable at a preceding level
C:\Users\Oscar\Desktop\*\Modern Life Roleplay [Oscar]\Modern Life Roleplay [Oscar]\pawno\include\func.inc(453) : warning 219: local variable "health" shadows a variable at a preceding level
C:\Users\Oscar\Desktop\*\Modern Life Roleplay [Oscar]\Modern Life Roleplay [Oscar]\pawno\include\func.inc(492) : warning 219: local variable "health" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Warnings.
Re: health -
Kitten - 08.04.2012
You already got the health variable defined,
pawn Код:
new Float:healthtwo;
GetPlayerHealth(playerid, healthtwo);
SetPlayerHealth(playerid, healthtwo + 5.0);
Re: health -
[DOG]irinel1996 - 08.04.2012
Try this:
pawn Код:
new Float:DrinkH;
GetPlayerHealth(playerid, DrinkH);
SetPlayerHealth(playerid, DrinkH+10.0);
if(DrinkH > 100.0)
{
SetPlayerHealth(playerid, 100.0);
}
or just delete the
new Float:health; that you added.
I think you should use my method because if you drink too much you'll get more life than normal, mine sets it to normal. Your choose.
Best regards!
Re: health -
oscar7610 - 08.04.2012
I found one that works thanks anyway rep + for helping me.
new Float:hp;
GetPlayerHealth(playerid,hp);
SetPlayerHealth(playerid,hp+5);
Re: health -
oscar7610 - 08.04.2012
Now I need to know how to save current position when disconnect.