SA-MP Forums Archive
SetPlayerVirtualWorld... - 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: SetPlayerVirtualWorld... (/showthread.php?tid=303191)



SetPlayerVirtualWorld... - lukas567 - 12.12.2011

Hello!

What script sets players vacant virtual world?

Example:

Player named "Dumbass" entered the server and took virtual world number 1. Other player came to server and want to take vacant virtual world, so not the virtual world with number 1. So what script makes that?


Re: SetPlayerVirtualWorld... - suhrab_mujeeb - 12.12.2011

You want to set a virtual world for every connecting player so that every player who joins is in a different virtual world than the other?


Re: SetPlayerVirtualWorld... - lukas567 - 12.12.2011

Yeah


Re: SetPlayerVirtualWorld... - Dragony92 - 12.12.2011

Put this in public OnPlayerConnect or in OnPlayerLogin or in OnPlayerSpawn :P
SetPlayerVirtualWorld(playerid, playerid);
VW will same as players id...


Re: SetPlayerVirtualWorld... - lukas567 - 12.12.2011

So Virtual World limit is Unlimited?


Re: SetPlayerVirtualWorld... - Dragony92 - 12.12.2011

No, you can create 2,147,483,647 Virtual Worlds Almost unlimited


Re: SetPlayerVirtualWorld... - lukas567 - 12.12.2011

Oh... Thanks mate! Respect


Re: SetPlayerVirtualWorld... - MP2 - 12.12.2011

SetPlayerVirtualWorld(playerid, playerid);

Puts the player in the world of their ID.


EDIT: Sigh.


Re: SetPlayerVirtualWorld... - suhrab_mujeeb - 12.12.2011

pawn Code:
// Top of the script
new PlayerWorld;

// Under OnGameModeInit
PlayerWorld = 0;

// Under OnPlayerConnect
PlayerWorld++;

// Under OnPlayerDisconnect
PlayerWorld--;

// Under OnPlayerSpawn
SetPlayerVirtualWorld(playerid, PlayerWorld);
Try this, untested.
Basically the same as MP2 said, I was making it while he posted it.