Weapon X2 damage
#5

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.
Reply


Messages In This Thread
Weapon X2 damage - by Dan. - 23.07.2012, 16:03
Re: Weapon X2 damage - by Vince - 23.07.2012, 16:09
Re: Weapon X2 damage - by Roko_foko - 23.07.2012, 16:16
Re: Weapon X2 damage - by Dan. - 23.07.2012, 16:18
Re: Weapon X2 damage - by leonardo1434 - 23.07.2012, 16:53

Forum Jump:


Users browsing this thread: 1 Guest(s)