22.02.2015, 09:01
Theres another method of detecting if the vehicle stops after accelerating it
here i made it in a hurry!)
Not recommended though.
EDIT: use NPC recording to do so. Or make use of RNPC or FCNPC plugin.
in game npc recorder: https://sampforum.blast.hk/showthread.php?tid=299207

pawn Код:
new bool:moved[MAX_VEHICLES];
public OnGameModeInit()
{
SetTimer("OnTimePass", 1000, true);
return 1;
}
stock MoveVehicle(id, Float:x, Float:y, Float:z)
{
moved[id] = true;
return SetVehicleVelocity(id, x, y, z);
}
forward OnTimePass();
public OnTimePass()
{
for(new i; i < MAX_VEHICLES; i++)
{
if(moved[i])
{
new Float:f[3];
GetVehicleVelocity(i, f[0], f[1], f[2]);
if(f[0] == 0.0 && f[1] == 0.0 && f[2] == 0.0)
{
moved[i] = false;
CallLocalFunction("OnVehicleMoved", "d", i);
}
}
}
return 1;
}
forward OnVehicleMoved(id);
public OnVehicleMoved(id)
{
//do your stuff here. "id" refers to vehicle id and this callback is called when a vehicle stops after being accelerated
return 1;
}
EDIT: use NPC recording to do so. Or make use of RNPC or FCNPC plugin.
in game npc recorder: https://sampforum.blast.hk/showthread.php?tid=299207