17.04.2015, 01:43
Hey guys, I am having some issues setting a variable and I have no idea what I am doing wrong. I've tried doing this a bunch of ways but for some reason nothing seems to work. I feel ridiculous asking such a simple question but like i said I just cant get it.
I want to pay a player based on how much health their vehicle has when they enter a checkpoint. So I have everything done except for setting the price to the health. What I want is for the variable price to be set to a quarter of what the current vehicles health is. I have:
Something like this, what I am having trouble with is literally setting price to a quarter of health.. Thanks guys..
I want to pay a player based on how much health their vehicle has when they enter a checkpoint. So I have everything done except for setting the price to the health. What I want is for the variable price to be set to a quarter of what the current vehicles health is. I have:
pawn Код:
new price, Float:Health; // How much you'll earn & vehicle HP
new vehicleid = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehicleid, Health);
if(Health < 255) format(string,sizeof(string),"Vehicle is too damaged to receive a bonus.");
else
{
price = Health/4;
format(string,sizeof(string),"+ ~g~$%d~w~ added to your next paycheck.",price);
}