Player's ID - 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: Player's ID (
/showthread.php?tid=620553)
Player's ID -
Micko123 - 31.10.2016
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?
Re: Player's ID -
F1N4L - 31.10.2016
Код:
public OnPlayerConnect(playerid) {
SetPlayerVirtualWorld(playerid, playerid);
return true;
}
Re: Player's ID -
Micko123 - 31.10.2016
You sure that will work??
Re: Player's ID -
Threshold - 31.10.2016
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(playerid, 1000 + playerid);
Re: Player's ID -
Micko123 - 31.10.2016
So I can do this
PHP код:
SetPlayerVirtualWorld(playerid, playerid + 1);
??
Re: Player's ID -
F1N4L - 31.10.2016
Quote:
Originally Posted by Micko123
So I can do this
PHP код:
SetPlayerVirtualWorld(playerid, playerid + 1);
??
|
Yep!
Re: Player's ID -
Micko123 - 31.10.2016
Thx guys

Repped
Re: Player's ID -
saffierr - 31.10.2016
Just a reminder; when people connect and disconnect, after a while people might get into the same VW.
Re: Player's ID -
Micko123 - 31.10.2016
What do you mean?? Isn't this
PHP код:
SetPlayerVirtualWorld(playerid, playerid+1)
Set VW different for every player because ID is unique on server?
Re: Player's ID -
saffierr - 31.10.2016
Quote:
Originally Posted by Micko123
What do you mean?? Isn't this
PHP код:
SetPlayerVirtualWorld(playerid, playerid+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.