17.05.2018, 20:43
No, there is no function. BUT
You can try making a 1 second timer that is looping
and check the player pos, speed and vehicle id.
You can try making a 1 second timer that is looping
PHP код:
SetTimer("Loop", 1000, 1); //under ongamemodeinit
PHP код:
forward Loop();
public Loop(){
for(new playerid; playerid < MAX_PLAYERS; playerid++){
if(GetPlayerVehicleID(playerid) == JobVehicle[playerid] /*for example*/ && InJob[playerid] == 1 && IsPlayerInRangeOfPoint(playerid, 10, x, y, z) && GetVehicleSpeed(GetPlayerVehicleID(playerid)) > 10){
DestroyObject(TheObjectThatThePlayerMustDestroy[playerid]);
//when the object is destroyed
}
}
}
stock GetVehicleSpeed(vehicleid)
{
if(vehicleid != INVALID_VEHICLE_ID)
{
new Float:Pos[3],Float:VS ;
GetVehicleVelocity(vehicleid, Pos[0], Pos[1], Pos[2]);
VS = floatsqroot(Pos[0]*Pos[0] + Pos[1]*Pos[1] + Pos[2]*Pos[2])*200;
return floatround(VS,floatround_round);
}
return INVALID_VEHICLE_ID;
}