22.03.2014, 16:02
Quote:
Can someone show code how can I make that player receive damage based on how much vehicle took damage at crash? Please
|
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;
}