SetPlayerVirtualWorld questions
#1

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.
Reply
#2

Just write it like this:

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

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!
Reply
#4

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..
Reply
#5

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
Reply
#6

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!!
Reply
#7

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..
Reply
#8

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)