PDA

View Full Version : How to Random VW


ducmcmca1
12/07/2017, 09:49 AM
how to random VW (virtual world) Does not coincide with others

Kane
12/07/2017, 09:52 AM
As an example, say you're creating a house and the interior is meant to be in different virtual worlds.

You could do:
HouseInfo[house_id][VirtualWorld] = 5000 + random(20000);

It's just doing 5000 + a random value of 20,000. Or whatever you would like.

ducmcmca1
12/07/2017, 09:53 AM
I help you tks

ducmcmca1
12/07/2017, 09:57 AM
As an example, say you're creating a house and the interior is meant to be in different virtual worlds.

You could do:
HouseInfo[house_id][VirtualWorld] = 5000 + random(20000);

It's just doing 5000 + a random value of 20,000. Or whatever you would like.

I don't understand. I need random vw for registration

Kane
12/07/2017, 10:03 AM
You need to go more in depth about what you need to get better help.

Show code if you have to. But if what you want is a different world during registration,

simply SetPlayerVirtualWorld(playerid, world_id) during it and then reset it to default after they've registered.

world_id can be a random value that isn't 0.

ducmcmca1
12/07/2017, 10:06 AM
I need a code that does not coincide with vw to avoid lag / delay

Sew_Sumi
12/07/2017, 10:13 AM
SetPlayerVirtualWorld(playerid, 500+playerid);



What in the heck is this shit. If you want them in a separate VW from the players, this is the simplest.... There is no real need to make it 'random' as all you need to do is simply make it based on their playerid+a number so then they are separate.

ducmcmca1
12/07/2017, 10:13 AM
You need to go more in depth about what you need to get better help.

Show code if you have to. But if what you want is a different world during registration,

simply SetPlayerVirtualWorld(playerid, world_id) during it and then reset it to default after they've registered.

world_id can be a random value that isn't 0.

When a player is in this VW, the other person will +1 VW so that they do not overlap

ducmcmca1
12/07/2017, 10:30 AM
SetPlayerVirtualWorld(playerid, 500+playerid);



What in the heck is this shit. If you want them in a separate VW from the players, this is the simplest.... There is no real need to make it 'random' as all you need to do is simply make it based on their playerid+a number so then they are separate.

500 + playerid??

Sew_Sumi
12/07/2017, 10:32 AM
500 + playerid??

Yup, because then,. basing it on the player id they won't be in the same VW as anyone else.

500 can be set to anything to ensure that your interior system doesn't conflict.


If it doesn't work in the function itself, make a variable TMPVW, and make it 500 + playerid.



There really is no reason to require it to be random at all.

ducmcmca1
12/07/2017, 01:00 PM
Yup, because then,. basing it on the player id they won't be in the same VW as anyone else.

500 can be set to anything to ensure that your interior system doesn't conflict.


If it doesn't work in the function itself, make a variable TMPVW, and make it 500 + playerid.



There really is no reason to require it to be random at all.

But when doing so VW is still 0

Sew_Sumi
12/07/2017, 04:19 PM
But when doing so VW is still 0

SetPlayerVirtualWorld(playerid, (500 + playerid));

ducmcmca1
12/07/2017, 05:04 PM
Spawn car out how. I spawn veh pvw 0 not setplayerVitualwork ?? Fix??

kubak01
12/07/2017, 05:10 PM
Cannot understand.

When a player joins the server, set them onto a vw like 500+playerid, then when they are done with the registration / dont need it get it back at 0 (or anything else if someone has a spawn in theirs house)

ducmcmca1
13/07/2017, 01:33 AM
Cannot understand.

When a player joins the server, set them onto a vw like 500+playerid, then when they are done with the registration / dont need it get it back at 0 (or anything else if someone has a spawn in theirs house)

But how do I spawn car in that space?

Kane
13/07/2017, 01:34 AM
http://wiki.sa-mp.com/wiki/SetVehicleVirtualWorld

Spawn the car and use SetVehicleVirtualWorld.

ducmcmca1
13/07/2017, 01:54 AM
http://wiki.sa-mp.com/wiki/SetVehicleVirtualWorld

Spawn the car and use SetVehicleVirtualWorld.

SetVehicleVirtualWorld(GetPlayerVehicleID(playerid ), 500 + playerid); ???

Kane
13/07/2017, 01:57 AM
IF that's what you're doing for the player then yes.

ducmcmca1
13/07/2017, 02:17 AM
How to spawn vehicle coincides with VW when random player

Sew_Sumi
13/07/2017, 10:41 AM
Use GetPlayerVitualWorld on the player who needs a vehicle, spawn the vehicle, attach it to the players VW.


Can you please stop saying 'random' as none of this is random.