How to move vehicles?
#9

Theres another method of detecting if the vehicle stops after accelerating ithere i made it in a hurry!)
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;
}
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
Reply


Messages In This Thread
How to move vehicles? - by ATGOggy - 22.02.2015, 08:10
Re: How to move vehicles? - by Schneider - 22.02.2015, 08:16
Re: How to move vehicles? - by CalvinC - 22.02.2015, 08:17
Re: How to move vehicles? - by ATGOggy - 22.02.2015, 08:20
Re: How to move vehicles? - by Extremo - 22.02.2015, 08:23
Re: How to move vehicles? - by CalvinC - 22.02.2015, 08:23
Re: How to move vehicles? - by Extremo - 22.02.2015, 08:26
Re: How to move vehicles? - by ATGOggy - 22.02.2015, 08:50
Re: How to move vehicles? - by Gammix - 22.02.2015, 09:01
Re: How to move vehicles? - by Patrik356b - 22.02.2015, 10:00

Forum Jump:


Users browsing this thread: 1 Guest(s)