Seatbelt..
#7

Quote:
Originally Posted by Lajko1
Посмотреть сообщение
Can someone show code how can I make that player receive damage based on how much vehicle took damage at crash? Please
Use this under OnPlayerUpdate or change it and use it OnVehicleDamageStatusUpdate
pawn Код:
if(IsPlayerInAnyVehicle(playerid) == 1 && Seatbelt[playerid] == 0 && !IsBicycle(vehicleid))
    {
        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; //To aviod that a player dies when he enters a vehicle
    }
    return 1;
}
Reply


Messages In This Thread
Seatbelt.. - by Lajko1 - 21.03.2014, 18:02
Re: Seatbelt.. - by ]Rafaellos[ - 21.03.2014, 18:40
Re: Seatbelt.. - by Lajko1 - 21.03.2014, 18:56
Re: Seatbelt.. - by Matess - 21.03.2014, 19:27
Re: Seatbelt.. - by Lajko1 - 21.03.2014, 19:53
Re: Seatbelt.. - by Lajko1 - 22.03.2014, 15:51
Re: Seatbelt.. - by caki - 22.03.2014, 16:02

Forum Jump:


Users browsing this thread: 2 Guest(s)