VirtualWorld - 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: VirtualWorld (
/showthread.php?tid=620756)
VirtualWorld -
Micko123 - 02.11.2016
Is there any way to check is VirtualWorld occupied by other player??
Re: VirtualWorld -
Nero_3D - 02.11.2016
Simply count the people you send to another world, than you know if its occupied
if every player should have its own world use SetPlayerVirtualWorld(playerid, playerid + 1)
Re: VirtualWorld -
ChristolisTV - 02.11.2016
PHP код:
for(new j = 0; j < MAX_PLAYERS; j++)
{
if(GetPlayerVirtualWorld(j) == 5)
{
//Do something
}
}
Not sure if it works, just try ;P
Re: VirtualWorld -
Micko123 - 02.11.2016
Quote:
Originally Posted by Nero_3D
Simply count the people you send to another world, than you know if its occupied
if every player should have its own world use SetPlayerVirtualWorld(playerid, playerid + 1)
|
Well I used
PHP код:
SetPlayerVirtualWorld(playerid, playerid + 1)
But could 2 players be in same VW with this??
Re: VirtualWorld -
oMa37 - 02.11.2016
PHP код:
SetPlayerVirtualWorld(playerid, playerid+1);
SetPlayerVirtualWorld(targetid, playerid+1);
Re: VirtualWorld -
Nero_3D - 02.11.2016
Quote:
Originally Posted by Micko123
Well I used
PHP код:
SetPlayerVirtualWorld(playerid, playerid + 1)
But could 2 players be in same VW with this??
|
No, because the playerid is unique to every player and the + 1 prevents from joining the default world (0)
Re: VirtualWorld -
Micko123 - 03.11.2016
Thx guys
Re: VirtualWorld -
CXdur - 03.11.2016
Quote:
Originally Posted by Nero_3D
No, because the playerid is unique to every player and the + 1 prevents from joining the default world (0)
|
I would also consider adding an offset, for example:
#define UNIQUE_WORLD_OFFSET 10000
And you use what Nero stated + this.
This is only necessary (well useful) if you already use some virtual worlds.