02.02.2014, 13:36
Hey guys I want to make if player is driving fast and if he crash he will be thrown out of car here is the code:
But when I crash into the object with high speed sometimes I'm thrown out of car and sometimes not, why?
But when I crash into the object with high speed sometimes I'm thrown out of car and sometimes not, why?
pawn Код:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
if(SeatBelt[playerid] == 0)
{
new Float:phealth;
new Float:vhealth;
GetPlayerHealth(playerid, phealth);
new veh = GetPlayerVehicleID(playerid);
GetVehicleHealth(veh, vhealth);
SetPlayerHealth(playerid, phealth - vhealth /100);
new Float:Velocity[3];
GetVehicleVelocity(veh, Velocity[0], Velocity[1], Velocity[2]);
if(Velocity[1] > 0.5)
{
new Float:pos[3];
GetPlayerPos(playerid, pos[0],pos[1],pos[2]);
SetPlayerPos(playerid, pos[0],pos[1],pos[2]+0.4);
ApplyAnimation(playerid,"ped","CAR_fallout_LHS",4.1,0,1,1,1,1,1);
SendClientMessage(playerid,-1,"You've been thrown from the vehicle! Press shift to get up.");
}
else if(Velocity[0] > 0.5)
{
new Float:pos[3];
GetPlayerPos(playerid, pos[0],pos[1],pos[2]);
SetPlayerPos(playerid, pos[0],pos[1],pos[2]+0.4);
ApplyAnimation(playerid,"ped","CAR_fallout_LHS",4.1,0,1,1,1,1,1);
SendClientMessage(playerid,-1,"You've been thrown from the vehicle! Press shift to get up.");
}
}
else
{
}
return 1;
}