23.07.2012, 16:53
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID)
{
new Float:HP, Float: damage;
GetPlayerHealth(playerid, HP);//lets say it is 100.
damage = floatdiv(HP, amount);
// lets say the damage was 50.
//100/50 = 2 of hp.
SetPlayerHealth(playerid, damage); // so the player gonna have 2 of hp.
}
return 1;
}
an simple example of what you're doing.
pawn Код:
public OnFilterScriptInit()
{
new Float:Number1 = 100.0, Float:Number2 = 50.0;
new Float:Result;
new l[5];
Result = floatdiv(Number1, Number2);
format(l,5,"%0.2f",Result);
printf(l);
}
//it gonna print 2.00 which is 2.