SA-MP Forums Archive
SetVehicleVirtualWorld??!! - 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??!! (/showthread.php?tid=157256)



SetVehicleVirtualWorld??!! - Sir_bomber - 06.07.2010

Hey, so I have the AddStaticVehicle(vehID, pos);

But I have forgot how to put this vehicles into Another VirtualWorld like 3...

Can anyone help?


Re: SetVehicleVirtualWorld??!! - mprofitt - 06.07.2010

https://sampwiki.blast.hk/wiki/SetVehicleVirtualWorld


Re: SetVehicleVirtualWorld??!! - Sir_bomber - 06.07.2010

ofc i have looked there... but it doesnt understand how it can help me... I haven't told the server which car I wanna change virtual world !!


Re: SetVehicleVirtualWorld??!! - Sir_bomber - 06.07.2010

Should I make like

On top of script

new car;

under OnGameModeInit

car = AddStaticVehicle(carID, pos);
SetVehicleVirtualWorld(car, 3);




Re: SetVehicleVirtualWorld??!! - Kayla.S - 06.07.2010

^Yes. Here's what mine looks like for example.

new Loopcar;

Loopcar = AddStaticVehicle(502,885.3165,417.1170,1299.5947+7 ,358.0520,-1,-1);
SetVehicleVirtualWorld( Loopcar, 1 );


Re: SetVehicleVirtualWorld??!! - Sir_bomber - 06.07.2010

Thanks


Re: SetVehicleVirtualWorld??!! - Sir_bomber - 06.07.2010

Is there any quicker way to do this?? Ive got this

AddStaticVehicle(560,2710.01684570,903.94171143,10 .56890488,170.00000000,-1,-1 ); //Sultan
AddStaticVehicle(560,2692.02661133,905.01483154,10 .33053398,170.00000000,-1,-1 ); //Sultan
AddStaticVehicle(560,2681.75781250,825.51080322,10 .75943851,249.99694824,-1,-1 ); //Sultan
AddStaticVehicle(560,2676.15039062,828.71319580,10 .75943851,219.99389648,-1,-1 ); //Sultan
AddStaticVehicle(468,2707.08007812,903.39086914,10 .24124432,180.00000000,-1,-1 ); //Sanchez
AddStaticVehicle(468,2701.01660156,897.88964844,10 .01576424,180.00000000,-1,-1 ); //Sanchez
AddStaticVehicle(468,2716.01562500,897.61871338,10 .65095901,180.00000000,-1,-1 ); //Sanchez
AddStaticVehicle(468,2715.43334961,906.78430176,10 .65843773,180.00000000,-1,-1 ); //Sanchez
AddStaticVehicle(468,2691.82543945,898.87725830,10 .04993629,180.00000000,-1,-1 ); //Sanchez
AddStaticVehicle(455,2708.75439453,841.82275391,10 .67576790,270.00000000,-1,-1 ); //Flatbed
AddStaticVehicle(455,2692.62207031,841.08526611,9. 05722332,270.00000000,-1,-1 ); //Flatbed
AddStaticVehicle(455,2649.72705078,823.20806885,9. 39031219,270.00000000,-1,-1 ); //Flatbed
AddStaticVehicle(455,2658.26635742,818.13763428,11 .52446270,180.00000000,-1,-1 ); //Flatbed
AddStaticVehicle(455,2657.70263672,807.91015625,11 .52446270,180.00000000,-1,-1 ); //Flatbed
AddStaticVehicle(455,2684.96875000,886.64715576,10 .50569153,238.00000000,-1,-1 ); //Flatbed
AddStaticVehicle(409,2705.25097656,893.74462891,10 .04279137,270.00000000,-1,-1 ); //Stretch
AddStaticVehicle(409,2693.52832031,894.37445068,10 .10895920,240.00000000,-1,-1 ); //Stretch
AddStaticVehicle(409,2700.66821289,841.63946533,9. 09645271,259.99633789,-1,-1 ); //Stretch
AddStaticVehicle(409,2671.63623047,873.17504883,10 .86454678,219.99145508,-1,-1 ); //Stretch
AddStaticVehicle(409,2678.30664062,868.77252197,10 .86454678,255.99023438,-1,-1 ); //Stretch
AddStaticVehicle(468,2681.42065430,821.79833984,10 .71446323,180.00000000,-1,-1 ); //Sanchez
AddStaticVehicle(468,2676.43115234,823.22210693,10 .71446323,180.00000000,-1,-1 ); //Sanchez
AddStaticVehicle(468,2651.87133789,814.27081299,5. 07579660,190.00000000,-1,-1 ); //Sanchez
AddStaticVehicle(468,2654.69165039,810.57519531,5. 07579660,189.99755859,-1,-1 ); //Sanchez
AddStaticVehicle(468,2647.96752930,814.43170166,5. 07579660,189.99755859,-1,-1 ); //Sanchez

and i want ALL of them to be in virtual world 3...


Re: SetVehicleVirtualWorld??!! - Kayla.S - 06.07.2010

Unfortunately I don't think there is. I've had to do it that way as well. :/

If you just copy and paste most of it, and just change the pos's and numbers it doesn't take too long, but ya wish there was an easier way.


Re: SetVehicleVirtualWorld??!! - Toni - 06.07.2010

I'm not sure exactly (I haven't got much experience with loops yet) but try
pawn Код:
for(new v = 0; v < MAX_VEHICLES; v++)
    {
        AddStaticVehicle(560,2710.01684570,903.94171143,10.56890488,170.00000000,-1,-1 ); //Sultan
        AddStaticVehicle(560,2692.02661133,905.01483154,10.33053398,170.00000000,-1,-1 ); //Sultan
        AddStaticVehicle(560,2681.75781250,825.51080322,10.75943851,249.99694824,-1,-1 ); //Sultan
        AddStaticVehicle(560,2676.15039062,828.71319580,10.75943851,219.99389648,-1,-1 ); //Sultan
        AddStaticVehicle(468,2707.08007812,903.39086914,10.24124432,180.00000000,-1,-1 ); //Sanchez
        AddStaticVehicle(468,2701.01660156,897.88964844,10.01576424,180.00000000,-1,-1 ); //Sanchez
        AddStaticVehicle(468,2716.01562500,897.61871338,10.65095901,180.00000000,-1,-1 ); //Sanchez
        AddStaticVehicle(468,2715.43334961,906.78430176,10.65843773,180.00000000,-1,-1 ); //Sanchez
        AddStaticVehicle(468,2691.82543945,898.87725830,10.04993629,180.00000000,-1,-1 ); //Sanchez
        AddStaticVehicle(455,2708.75439453,841.82275391,10.67576790,270.00000000,-1,-1 ); //Flatbed
        AddStaticVehicle(455,2692.62207031,841.08526611, 9.05722332,270.00000000,-1,-1 ); //Flatbed
        AddStaticVehicle(455,2649.72705078,823.20806885,9.39031219,270.00000000,-1,-1 ); //Flatbed
        AddStaticVehicle(455,2658.26635742,818.13763428,11.52446270,180.00000000,-1,-1 ); //Flatbed
        AddStaticVehicle(455,2657.70263672,807.91015625,11.52446270,180.00000000,-1,-1 ); //Flatbed
        AddStaticVehicle(455,2684.96875000,886.64715576,10.50569153,238.00000000,-1,-1 ); //Flatbed
        AddStaticVehicle(409,2705.25097656,893.74462891,10.04279137,270.00000000,-1,-1 ); //Stretch
        AddStaticVehicle(409,2693.52832031,894.37445068,10.10895920,240.00000000,-1,-1 ); //Stretch
        AddStaticVehicle(409,2700.66821289,841.63946533,9.09645271,259.99633789,-1,-1 ); //Stretch
        AddStaticVehicle(409,2671.63623047,873.17504883,10.86454678,219.99145508,-1,-1 ); //Stretch
        AddStaticVehicle(409,2678.30664062,868.77252197,10.86454678,255.99023438,-1,-1 ); //Stretch
        AddStaticVehicle(468,2681.42065430,821.79833984,10.71446323,180.00000000,-1,-1 ); //Sanchez
        AddStaticVehicle(468,2676.43115234,823.22210693,10.71446323,180.00000000,-1,-1 ); //Sanchez
        AddStaticVehicle(468,2651.87133789,814.27081299,5.07579660,190.00000000,-1,-1 ); //Sanchez
        AddStaticVehicle(468,2654.69165039,810.57519531,5.07579660,189.99755859,-1,-1 ); //Sanchez
        AddStaticVehicle(468,2647.96752930,814.43170166,5.07579660,189.99755859,-1,-1 ); //Sanchez
        SetVehicleVirtualWorld(v, 3);
    }
Just experimenting. It can compile, but it is not tested.


Re: SetVehicleVirtualWorld??!! - Sir_bomber - 06.07.2010

Ok, I'll try... I'll tell if not working :P


Re: SetVehicleVirtualWorld??!! - Sir_bomber - 06.07.2010

Doesnt work


Re: SetVehicleVirtualWorld??!! - VirSpectorX - 06.07.2010

Try this:
Код:
for(new i=#your first car id you want to change the virtual world#; i <= #your last car id you want to change the virtual world#; i++)
{
SetVehicleVirtualWorld(i, #virtual world id#);
}
For example, you want to put Vehicle ID 5 until ID 15 to go to virtual world number 9, so you do this:
Код:
for(new i=5; i <= 15; i++)
{
SetVehicleVirtualWorld(i, 9);
}
Or, if you want all the cars to go to virtual world number 9:
Код:
for(new i=0; i < MAX_VEHICLES; i++) //if you use MAX_VEHICLES, use '<' instead of '<=')
{
SetVehicleVirtualWorld(i, 9);
}



Re: SetVehicleVirtualWorld??!! - CaHbKo - 06.07.2010

@Toni123, What you do is create all those cars 2000 times (but only 2000 will be created), and set ALL of them to world 3.

@vir9000, it should work.


Re: SetVehicleVirtualWorld??!! - Matthias_ - 06.07.2010

Why not use a simple array?

pawn Код:
new aVehicles[5];

aVehicles[0] = AddStaticVehicle(...);
aVehicles[1] = AddStaticVehicle(...);
aVehicles[2] = AddStaticVehicle(...);
aVehicles[3] = AddStaticVehicle(...);
aVehicles[4] = AddStaticVehicle(...);

for(i = 0; i < 6; i++)
{
   SetVehicleVirtualWorld(aVehicles[i], 3);
}



Re: SetVehicleVirtualWorld??!! - straco - 06.07.2010

Try this for all your cars.
you save one line and varilable

SetVehicleVirtualWorld(AddStaticVehicle(502,885.31 65,417.1170,1299.5947+7 ,358.0520,-1,-1), 3 );


Re: SetVehicleVirtualWorld??!! - Sir_bomber - 06.07.2010

Yeah thats smart straco


Re: SetVehicleVirtualWorld??!! - RyDeR` - 06.07.2010

You can use this:
pawn Код:
AddStaticVehicleInWorld(modelid, Float: x, Float: y, Float: z, Float: ang, color1, color2, worldid) return \
    SetVehicleVirtualWorld(AddStaticVehicle(modelid, x, y, z, ang, color1, color2), worldid);
Usage:
~~~~~
AddStaticVehicleInWorld(560,2710.01684570,903.9417 1143,10.56890488,170.00000000,-1,-1, 3); // This will create a vehicle in virtual world 3 (see last parameter)


Re: SetVehicleVirtualWorld??!! - Sir_bomber - 06.07.2010

Yeah, U is genious


Re: SetVehicleVirtualWorld??!! - Jefff - 06.07.2010

pawn Код:
SetVehicleVirtualWorld(AddStaticVehicleEx(560,2710.01684570,903.94171143,10.56890488,170.00000000,-1,-1,300),3);//Sultan
SetVehicleVirtualWorld(AddStaticVehicleEx(560,2692.02661133,905.01483154,10.33053398,170.00000000,-1,-1,300),3);//Sultan
SetVehicleVirtualWorld(AddStaticVehicleEx(560,2681.75781250,825.51080322,10.75943851,249.99694824,-1,-1,300),3);//Sultan
SetVehicleVirtualWorld(AddStaticVehicleEx(560,2676.15039062,828.71319580,10.75943851,219.99389648,-1,-1,300),3);//Sultan
SetVehicleVirtualWorld(AddStaticVehicleEx(468,2707.08007812,903.39086914,10.24124432,180.00000000,-1,-1,300),3);//Sanchez
SetVehicleVirtualWorld(AddStaticVehicleEx(468,2701.01660156,897.88964844,10.01576424,180.00000000,-1,-1,300),3);//Sanchez
SetVehicleVirtualWorld(AddStaticVehicleEx(468,2716.01562500,897.61871338,10.65095901,180.00000000,-1,-1,300),3);//Sanchez
SetVehicleVirtualWorld(AddStaticVehicleEx(468,2715.43334961,906.78430176,10.65843773,180.00000000,-1,-1,300),3);//Sanchez
SetVehicleVirtualWorld(AddStaticVehicleEx(468,2691.82543945,898.87725830,10.04993629,180.00000000,-1,-1,300),3);//Sanchez
SetVehicleVirtualWorld(AddStaticVehicleEx(455,2708.75439453,841.82275391,10.67576790,270.00000000,-1,-1,300),3);//Flatbed
SetVehicleVirtualWorld(AddStaticVehicleEx(455,2692.62207031,841.08526611,9.05722332,270.00000000,-1,-1,300),3);//Flatbed
SetVehicleVirtualWorld(AddStaticVehicleEx(455,2649.72705078,823.20806885,9.39031219,270.00000000,-1,-1,300),3);//Flatbed
SetVehicleVirtualWorld(AddStaticVehicleEx(455,2658.26635742,818.13763428,11.52446270,180.00000000,-1,-1,300),3);//Flatbed
SetVehicleVirtualWorld(AddStaticVehicleEx(455,2657.70263672,807.91015625,11.52446270,180.00000000,-1,-1,300),3);//Flatbed
SetVehicleVirtualWorld(AddStaticVehicleEx(455,2684.96875000,886.64715576,10.50569153,238.00000000,-1,-1,300),3);//Flatbed
SetVehicleVirtualWorld(AddStaticVehicleEx(409,2705.25097656,893.74462891,10.04279137,270.00000000,-1,-1,300),3);//Stretch
SetVehicleVirtualWorld(AddStaticVehicleEx(409,2693.52832031,894.37445068,10.10895920,240.00000000,-1,-1,300),3);//Stretch
SetVehicleVirtualWorld(AddStaticVehicleEx(409,2700.66821289,841.63946533,9.09645271,259.99633789,-1,-1,300),3);//Stretch
SetVehicleVirtualWorld(AddStaticVehicleEx(409,2671.63623047,873.17504883,10.86454678,219.99145508,-1,-1,300),3);//Stretch
SetVehicleVirtualWorld(AddStaticVehicleEx(409,2678.30664062,868.77252197,10.86454678,255.99023438,-1,-1,300),3);//Stretch
SetVehicleVirtualWorld(AddStaticVehicleEx(468,2681.42065430,821.79833984,10.71446323,180.00000000,-1,-1,300),3);//Sanchez
SetVehicleVirtualWorld(AddStaticVehicleEx(468,2676.43115234,823.22210693,10.71446323,180.00000000,-1,-1,300),3);//Sanchez
SetVehicleVirtualWorld(AddStaticVehicleEx(468,2651.87133789,814.27081299,5.07579660,190.00000000,-1,-1,300),3);//Sanchez
SetVehicleVirtualWorld(AddStaticVehicleEx(468,2654.69165039,810.57519531,5.07579660,189.99755859,-1,-1,300),3);//Sanchez
SetVehicleVirtualWorld(AddStaticVehicleEx(468,2647.96752930,814.43170166,5.07579660,189.99755859,-1,-1,300),3);//Sanchez



Re: SetVehicleVirtualWorld??!! - Jay_ - 21.08.2010

Quote:
Originally Posted by Matthias_
Посмотреть сообщение
Why not use a simple array?

pawn Код:
new aVehicles[5];

aVehicles[0] = AddStaticVehicle(...);
aVehicles[1] = AddStaticVehicle(...);
aVehicles[2] = AddStaticVehicle(...);
aVehicles[3] = AddStaticVehicle(...);
aVehicles[4] = AddStaticVehicle(...);

for(i = 0; i < 6; i++)
{
   SetVehicleVirtualWorld(aVehicles[i], 3);
}
Wouldn't it make more sense to use a couple of variables to determine the first vehicle and the last and just loop through the IDs based on them and then set it to the virtual world instead of assigning each and every vehicle to an array?

pawn Код:
v_VehicleWorlds[0] = AddStaticVehicle(...);
AddStaticVehicle(...);
AddStaticVehicle(...);
v_VehicleWorlds[1] = AddStaticVehicle(...);

for(new vid = v_VehicleWorlds[0]; vid < v_VehicleWorlds[1]; vid++)
{
    SetVehicleVirtualWorld(vid, 1);
}