12.01.2013, 20:15
Is it possible to do?
PHP код:
OnVehicleCrashWithObject(objectid, Float: speed, Float: impactforce)
OnVehicleCrashWithObject(objectid, Float: speed, Float: impactforce)
new Float: vehHealth, v = GetPlayerVehicleID(playerid); GetVehicleHealth(GetPlayerVehicleID(playerid), vehHealth); new Float: force = CarHealth[playerid] - vehHealth;
if(impactforce == 100)
{
SetPlayerHealth(playerid, 10);
new Float: CarHealth[MAX_PLAYERS];
GetVehicleSpeed(v)
{
new Float: vehiclesVelocity[3];
GetVehicleVelocity(v, vehiclesVelocity[0], vehiclesVelocity[1], vehiclesVelocity[2]);
return floatround(floatsqroot((vehiclesVelocity[0]*vehiclesVelocity[0]+vehiclesVelocity[1]*vehiclesVelocity[1]))*100.0*1.6);
}
if(IsPlayerInAnyVehicle(playerid))
{
new Float: vehHealth, v = GetPlayerVehicleID(playerid);
GetVehicleHealth(GetPlayerVehicleID(playerid), vehHealth);
if(vehHealth > 250)
{
new Float: dif = CarHealth[playerid] - vehHealth;
if(dif > 150)
{
new Float: curHealth;
GetPlayerHealth(playerid, curHealth);
}
CarHealth[playerid] = vehHealth;
}
}