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



SetPlayerVirtualWorld questions - ZBits - 07.08.2015

Hi,

I have a simple yet confusing question. I want to be able to spawn a player in a random virtual world. I know how to work with randoms but how can i stop 2 players from being in the same world?. I researched and stumbled upon this
pawn Код:
SetPlayerVirtualWolrd(playerid,playerid);
This function will work as long as the player ID isn't 0. Since 0 is the global world, i do not want the player to be a part of it(for other reasons).

Thank you for any help provided.


AW: SetPlayerVirtualWorld questions - Kaliber - 07.08.2015

Just write it like this:

PHP код:
SetPlayerVirtualWolrd(playerid,playerid+1); 



Re: SetPlayerVirtualWorld questions - Roberto80 - 07.08.2015

So if you want to use it for something like houses,as wiki said:"2,147,483,647 virtual worlds can be used."
So if u do:
Код:
new Vw;
Public Bla bla bla
{
Vw = random(9999999);
SetPlayerVirtualWorld(playerid,Vw);
}
So its very very very hard to get 2 players in sams virtual world!


AW: Re: SetPlayerVirtualWorld questions - Kaliber - 07.08.2015

Quote:
Originally Posted by Roberto80
Посмотреть сообщение
So its very very very hard to get 2 players in sams virtual world!
Pls dude, shut up!

Use my code...because it can be in your case that they are in 2 worlds..


Re: AW: SetPlayerVirtualWorld questions - ZBits - 07.08.2015

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Just write it like this:

PHP код:
SetPlayerVirtualWolrd(playerid,playerid+1); 
Ahah.

Why didn't i think of this? *Feels stupid*

Thanks <3


Re: AW: Re: SetPlayerVirtualWorld questions - Roberto80 - 07.08.2015

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Pls dude, shut up!

Use my code...because it can be in your case that they are in 2 worlds..
Yeah with a very very hard luck to get random 999999 same number!!


AW: Re: AW: Re: SetPlayerVirtualWorld questions - Kaliber - 07.08.2015

Quote:
Originally Posted by Roberto80
Посмотреть сообщение
Yeah with a very very hard luck to get random 999999 same number!!
I can show you how fast this happens:

PHP код:
#include <a_samp>
#define MAX_RANDOM 999999
main()
{
    new 
z,low=MAX_RANDOM;
    do {
        new 
random(MAX_RANDOM),i=random(MAX_RANDOM);
        for(; 
i!=xi=random(MAX_RANDOM)){}
        if(
lowlow=i;
        
z++;
    }
    while(
z<20);
    
printf("Same after the %d loop!",low);

And it gives me:



So after the 97 player join... they are in the same virtual world..so its very fast possible even with a high number..


Re: AW: Re: AW: Re: SetPlayerVirtualWorld questions - Roberto80 - 07.08.2015

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
I can show you how fast this happens:

PHP код:
#include <a_samp>
#define MAX_RANDOM 999999
main()
{
    new 
z,low=MAX_RANDOM;
    do {
        new 
random(MAX_RANDOM),i=random(MAX_RANDOM);
        for(; 
i!=xi=random(MAX_RANDOM)){}
        if(
lowlow=i;
        
z++;
    }
    while(
z<20);
    
printf("Same after the %d loop!",low);

And it gives me:



So after the 97 player join... they are in the same virtual world..so its very fast possible even with a high number..
Woah x)
Thanks for it