SA-MP Forums Archive
SetVehicleVirtualWorld wont work?? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SetVehicleVirtualWorld wont work?? (/showthread.php?tid=88214)



SetVehicleVirtualWorld wont work?? - Luciano - 25.07.2009

Hey guys I have a code here that i've been trying to fix for a long time now and i can't figure it out?

Код:
new Float:vehicles[14][4] = {
{388.4015,2537.7161,16.9140,179.3938},
{404.4426,2452.0791,17.4188,0.4300},
{365.7660,2536.3887,16.7421,182.6629},
{325.3318,2536.8289,17.5101,178.4121},
{290.4969,2540.0361,17.2736,178.7922},
{421.6918,2533.8464,16.1341,91.3846},
{-507.3837,2630.3984,52.9713,89.1986},
{-520.2582,2612.5879,53.3101,268.7889},
{-539.8851,2575.5542,53.2462,89.0322},
{-520.8671,2569.4358,53.2054,90.4277},
{-25.7535,2322.8506,23.8180,268.5762},
{-40.9095,2347.0725,23.9208,86.7227},
{-154.4853,2684.8879,62.2158,0.1440},
{-275.7067,2723.8491,62.9846,269.5266}
};

new vehicleids[] = {
556,519,417,476,593,521,521,439,
402,603,481,424,405,455
};
Thats at the top of the script

Код:
OnFilterScriptInit()
{
SpawnVehicles();
}
Код:
public SpawnVehicles()
{
    new veh;
	for(new i=0;i<sizeof(vehicleids);i++)
	{
	  veh = AddStaticVehicle(vehicleids[i],vehicles[i][0],vehicles[i][1],vehicles[i][2],vehicles[i][3],-1,-1);
 	}
 	for(new i=0;i<sizeof(vehicleids);i++)
	{
	  SetVehicleVirtualWorld(veh,1);
 	}
}
The vehicle spawns just fine but it doesn't spawn in VirtualWorld 1? (The default VW is 0 so 1 is dif)


Re: SetVehicleVirtualWorld wont work?? - abhinavdabral - 25.07.2009

Try this, I am 85% sure that this will help you
pawn Код:
public SpawnVehicles()
{
    new veh;
    for(new i=0;i<sizeof(vehicleids);i++)
    {
      veh = AddStaticVehicle(vehicleids[i],vehicles[i][0],vehicles[i][1],vehicles[i][2],vehicles[i][3],-1,-1);
      SetVehicleVirtualWorld(veh,1);
    }
}



Re: SetVehicleVirtualWorld wont work?? - Luciano - 25.07.2009

This is what we had before, but it didn't work. Anyone else?


Re: SetVehicleVirtualWorld wont work?? - yezizhu - 25.07.2009

open http://forum.sa-mp.com/index.php?topic=82288.0 then search SetVehicleVirtualWorld
I'd suggest you to use a timer


Re: SetVehicleVirtualWorld wont work?? - Luciano - 25.07.2009

Hey I searched it and did what you said but its in OnFilterScriptInit, same thing?


Re: SetVehicleVirtualWorld wont work?? - yezizhu - 25.07.2009

Quote:
Originally Posted by Luciano
Hey I searched it and did what you said but its in OnFilterScriptInit, same thing?
I think he didn't explain well.
It won't work when (re)starting server.

Quote:

I'd suggest you to use a timer