02.04.2014, 21:31
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?
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;
}