Help with damage
#1

Hey guys I'm using this code for my /sb command so when player crashes with car he lose HP...
What I want to make is that Passengers will lose HP also
Crashing with motorbikes must be more efficient - now it doesn't have effect if player crashes how can I improve that?

pawn Код:
public OnPlayerUpdate(playerid)
{
    if(IsPlayerInAnyVehicle(playerid) == 1 && SeatBelt[playerid] == 0)
    {
        new Float:TempCarHealth;
        GetVehicleHealth(GetPlayerVehicleID(playerid), TempCarHealth);
        new Float:Difference = floatsub(CarHealth[playerid], TempCarHealth);
        if((floatcmp(CarHealth[playerid], TempCarHealth) == 1) && (floatcmp(Difference,100.0) == 1))
        {
            Difference = floatdiv(Difference, 10.0);
            new Float:OldHealth;
            GetPlayerHealth(playerid, OldHealth);
            SetPlayerHealth(playerid, floatsub(OldHealth, Difference));
        }
        CarHealth[playerid] = TempCarHealth;
    }
    else
    {
        CarHealth[playerid] = 0.0;
    }
Reply


Messages In This Thread
Help with damage - by Lajko1 - 02.04.2014, 21:31
Re: Help with damage - by Bingo - 02.04.2014, 22:19
Re: Help with damage - by Lajko1 - 03.04.2014, 12:00

Forum Jump:


Users browsing this thread: 1 Guest(s)