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 x = random(MAX_RANDOM),i=random(MAX_RANDOM);
for(; i!=x; i=random(MAX_RANDOM)){}
if(i < low) low=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 x = random(MAX_RANDOM),i=random(MAX_RANDOM);
for(; i!=x; i=random(MAX_RANDOM)){}
if(i < low) low=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