Player's ID
#1

Is there any way that i can do this.
I want to set different VirtualWorld for every player. So every player will be at its own VW. Is there any way to do this??

I was thinking of setting their VW so it will be same as their ID but i don't know how to get ID of the player.. Any ideas?
Reply
#2

Код:
public OnPlayerConnect(playerid) {
SetPlayerVirtualWorld(playerid, playerid);
return true;
}
Reply
#3

You sure that will work??
Reply
#4

Well you can't set a player's virtual world without knowing their player ID... Lol.

SetPlayerVirtualWorld(playerid

'playerid' is the parameter that holds the player's ID. Then you can use that ID to set a virtual world for each individual.

For example:
PHP код:
SetPlayerVirtualWorld(playerid1000 playerid); 
Reply
#5

So I can do this
PHP код:
SetPlayerVirtualWorld(playeridplayerid 1); 
??
Reply
#6

Quote:
Originally Posted by Micko123
Посмотреть сообщение
So I can do this
PHP код:
SetPlayerVirtualWorld(playeridplayerid 1); 
??
Yep!
Reply
#7

Thx guys
Repped
Reply
#8

Just a reminder; when people connect and disconnect, after a while people might get into the same VW.
Reply
#9

What do you mean?? Isn't this
PHP код:
SetPlayerVirtualWorld(playeridplayerid+1
Set VW different for every player because ID is unique on server?
Reply
#10

Quote:
Originally Posted by Micko123
Посмотреть сообщение
What do you mean?? Isn't this
PHP код:
SetPlayerVirtualWorld(playeridplayerid+1
Set VW different for every player because ID is unique on server?
Yes everyone has their unique ID, but look.

Connected players
- player1 joins the server (ID 0)
- player2 joins the server (ID 1)
- player3 joins the server (ID 2)
- player4 joins the server after player2 left the server, which means he'll get (ID 1)

Disconnected players
- player2 leaves the server (Which means ID1 is now available)


And that's how the VW will get mixed up.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)