16.12.2015, 14:48
NEVERMIND FIXED IT
what i'm trying to do here is to make if the player is going 150km/h with his car so if he hits something that the car explodes
i don't really know why i choose this callback but i thought it would work my getplayerspeed script
what i'm trying to do here is to make if the player is going 150km/h with his car so if he hits something that the car explodes
PHP код:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
if(GetPlayerSpeed(playerid) >= 150)
{
new Float:vhealth;
if(GetVehicleHealth(GetPlayerVehicleID(playerid), vhealth) <= 500)
{
new Float:pos[3];
CreateExplosionForPlayer(playerid, pos[0],pos[1],pos[2], 0, 15.0);
}
}
}
PHP код:
stock GetPlayerSpeed(playerid)
{
new Float:ST[4];
if(IsPlayerInAnyVehicle(playerid))
GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 179.28625;
return floatround(ST[3]);
}