Virtualworld
#1

Hey guys

How can i add objects/cars to different virtualworlds?
Ive already tried
pawn Код:
LinkVehicleToInterior(Kart, 15);
SetVehicleVirtualWorld(Kart, 15);
But that didnt work, they were still at virtualworld 0

~Wesley

Edit: Yes, i made a new variable with the car's spawned in it
Reply
#2

SetVehicleVirtualWorld works

Maybe you got the wrong vehicleid ?

And objects cant be in virtual worlds, for that you need to write your own world script (which isnt difficult)
Reply
#3

pawn Код:
new Kart;
    Kart = AddStaticVehicle(571,1438.0006,-2481.6172,12.8384,269.9625,36,2); // minigame kart 1
    Kart = AddStaticVehicle(571,1438.2340,-2486.0935,12.8387,272.8651,51,53); // minigame kart 2
    Kart = AddStaticVehicle(571,1438.0760,-2490.6670,12.8382,268.9253,91,2); // minigame kart 3
    Kart = AddStaticVehicle(571,1438.0946,-2496.9231,12.8384,270.5941,11,22); // minigame kart 4
Got this

Edit: And the SetVehicletovirtualworld thingy
Reply
#4

You create one variable called Kart

Than you assign this variable in each line a new value

pawn Код:
new x;
x = 3;
x = 7;
x = 2;
x = 4;
Like expected the variable will only hold the number of the last vehicleid (or in my example 4)

pawn Код:
//for correct indention
    new Kart;
    Kart = AddStaticVehicle(571,1438.0006,-2481.6172,12.8384,269.9625,36,2); // minigame kart 1
    SetVehicleVirtualWorld(Kart, 15);
    Kart = AddStaticVehicle(571,1438.2340,-2486.0935,12.8387,272.8651,51,53); // minigame kart 2
    SetVehicleVirtualWorld(Kart, 15);
    Kart = AddStaticVehicle(571,1438.0760,-2490.6670,12.8382,268.9253,91,2); // minigame kart 3
    SetVehicleVirtualWorld(Kart, 15);
    Kart = AddStaticVehicle(571,1438.0946,-2496.9231,12.8384,270.5941,11,22); // minigame kart 4
    SetVehicleVirtualWorld(Kart, 15);
//Or without saving the id in a variable
    SetVehicleVirtualWorld(AddStaticVehicle(571,1438.0006,-2481.6172,12.8384,269.9625,36,2), 15); // minigame kart 1
    SetVehicleVirtualWorld(AddStaticVehicle(571,1438.2340,-2486.0935,12.8387,272.8651,51,53), 15); // minigame kart 2
    SetVehicleVirtualWorld(AddStaticVehicle(571,1438.0760,-2490.6670,12.8382,268.9253,91,2), 15); // minigame kart 3
    SetVehicleVirtualWorld(AddStaticVehicle(571,1438.0946,-2496.9231,12.8384,270.5941,11,22), 15); // minigame kart 4
Reply
#5

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
pawn Код:
new Kart;
    Kart = AddStaticVehicle(571,1438.0006,-2481.6172,12.8384,269.9625,36,2); // minigame kart 1
    Kart = AddStaticVehicle(571,1438.2340,-2486.0935,12.8387,272.8651,51,53); // minigame kart 2
    Kart = AddStaticVehicle(571,1438.0760,-2490.6670,12.8382,268.9253,91,2); // minigame kart 3
    Kart = AddStaticVehicle(571,1438.0946,-2496.9231,12.8384,270.5941,11,22); // minigame kart 4
Got this

Edit: And the SetVehicletovirtualworld thingy
Man thats not the way its works....

pawn Код:
new kart[6];
kart[0] = AddStaticVehicle(.................................);
kart[1] = AddStaticVehicle(.................................);
kart[2] = AddStaticVehicle(.................................);
kart[3] = AddStaticVehicle(.................................);
SetVehicleVirtualWorld(kart[0],15);
//And so on.... or create new variable for each vehicle
Reply
#6

Hey guys,

I got this now:
pawn Код:
Kart[0] = AddStaticVehicle(571,1438.0006,-2481.6172,12.8384,269.9625,36,2); // minigame kart 1
    Kart[1] = AddStaticVehicle(571,1438.2340,-2486.0935,12.8387,272.8651,51,53); // minigame kart 2
    Kart[2] = AddStaticVehicle(571,1438.0760,-2490.6670,12.8382,268.9253,91,2); // minigame kart 3
    Kart[3] = AddStaticVehicle(571,1438.0946,-2496.9231,12.8384,270.5941,11,22); // minigame kart 4
   
    LinkVehicleToInterior(Kart[0], 15); SetVehicleVirtualWorld(Kart[0], 15);
    LinkVehicleToInterior(Kart[1], 15); SetVehicleVirtualWorld(Kart[1], 15);
    LinkVehicleToInterior(Kart[2], 15); SetVehicleVirtualWorld(Kart[2], 15);
    LinkVehicleToInterior(Kart[3], 15); SetVehicleVirtualWorld(Kart[3], 15);
When i go to virtualworld 15 ( SetPlayerVirtualWorld(playerid, 15); ) the karts wont show up
I can see the grey dot/triangle thing and i "CAN" enter the car. When i enter the car, i'm invisible aswell; how can i fix this? :$

~Wesley
Reply
#7

Wrong interiorid
Reply
#8

Interior is not a virtualworld.
So, remove the Interior stuff and try again.
Reply
#9

Cool thanks

On samp wiki it said you needed the LinkVehicleToInterior.. so
Can i add objects to virtualworld aswell, or aint that possible?

~Wesley
Reply
#10

Yes, that's possible.
You can select at "CreateObject" function which virtual world you'd like to put those objects in.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)