SA-MP Forums Archive
How to alternate between 2 locations - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to alternate between 2 locations (/showthread.php?tid=339169)



How to alternate between 2 locations - Deal-or-die - 02.05.2012

Hey,
How can i get a vehicle spawn (from dealership) to alternate between two different cords?

pawn Код:
GrottiVehicleSpawnLoc()
{
      533.1320,-1316.8053,16.9984,92.6
      537.8416,-1321.7615,16.9943,92.6
}



Re: How to alternate between 2 locations - niels44 - 02.05.2012

explain a bit more please? i dont understand you


Re: How to alternate between 2 locations - ViniBorn - 02.05.2012

pawn Код:
new Float:GrottiVehicleSpawnLoc[2][4] = {
{533.1320,-1316.8053,16.9984,92.6},
{537.8416,-1321.7615,16.9943,92.6}
};

CreateVehicle(522,GrottiVehicleSpawnLoc[0][0],GrottiVehicleSpawnLoc[0][1],GrottiVehicleSpawnLoc[0][2]GrottiVehicleSpawnLoc[0][3],-1,-1,-1);



Re: How to alternate between 2 locations - PrawkC - 02.05.2012

pawn Код:
new spawnIdx; // Global variable, used to determin last spawned index

new Float:VehicleSpawnLocs[2][3] =
{
      {533.1320,-1316.8053,16.9984,92.6},
      {537.8416,-1321.7615,16.9943,92.6}
};

stock GrottiSpawnVehicle(Your Params Here)
{
    if(spawnIdx > sizeof(VehicleSpawnLocs))
    {
        spawnIdx = 0;
    }
    else
    {
        spawnIdx++;
    }
    new Float:x = VehicleSpawnLocs[spawnIdx][0],
    Float:y = VehicleSpawnLocs[spawnIdx][1],
    Float:z = VehicleSpawnLocs[spawnIdx][2];
    CreateVehicle(...)
}
Something like that