AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Set any id to each player connected? (https://forums.alliedmods.net/showthread.php?t=194096)

CsIosefin 08-25-2012 08:30

Set any id to each player connected?
 
Hello, set the id to each player connected? That is the first player to get connected to the server ID 1, and so on? If you set an id to each player how do I know?

Backstabnoob 08-25-2012 08:31

Re: Set any id to each player connected?
 
What? Each player in the server has their own index starting from 1 and ending at 32.

CsIosefin 08-25-2012 09:45

Re: Set any id to each player connected?
 
Good, the number is set when you are connected to the server or connection before?
Code:

if(get_user_userid(id) == 1)
Should look like this, right?

Torge 08-25-2012 09:51

Re: Set any id to each player connected?
 
I think when you're connected.

That don't work:
PHP Code:

if(get_user_userid(id) == 1


Bugsy 08-25-2012 11:59

Re: Set any id to each player connected?
 
Quote:

Originally Posted by Torge (Post 1782331)
I think when you're connected.

That don't work:
PHP Code:

if(get_user_userid(id) == 1


IIRC, when a player connects he is assigned the first available slot.

Code:
Connect, Slot 1 - Userid=1 Connect, Slot 2 - Userid=2 Connect, Slot 3 - Userid=3 Connect, Slot 4 - Userid=4 Disconnect, Slot 2 Connect, Slot 2 - Userid=5 Connect, Slot 5 - Userid=6

This is not the same as a userid - A userid is incremented on each connect to the server. It's not an index into an edict list, like a player index (from 1-32).

fysiks 08-25-2012 12:03

Re: Set any id to each player connected?
 
Quote:

Originally Posted by CsIosefin (Post 1782258)
Hello, set the id to each player connected? That is the first player to get connected to the server ID 1, and so on? If you set an id to each player how do I know?

Your question makes very little sense. You can't set a player's ID. There are two different three different types of "ID"'s. One in the entity index, a value from 1 to <maxplayers>. The next is the "UserID" which is a number assigned to each player based on how many players have connected before since the server was first turned on. The third one is the SteamID which should be self explanatory.

CsIosefin 08-25-2012 18:20

Re: Set any id to each player connected?
 
I want a simple thing ... id 1 player to be sent directly to a team.
So:
Code:

if(get_user_userid(id) == 1)

Bugsy 08-25-2012 19:13

Re: Set any id to each player connected?
 
Quote:

Originally Posted by CsIosefin (Post 1782688)
I want a simple thing ... id 1 player to be sent directly to a team.
So:
Code:

if(get_user_userid(id) == 1)

PHP Code:

//Player in slot 1
if ( id == )
{

}

//Player with userid 1 -- only will happen once for first player to connect to the server 
if ( get_user_useridid ) == )
{




ConnorMcLeod 08-25-2012 20:14

Re: Set any id to each player connected?
 
userid is not reset on new map !

CsIosefin 08-26-2012 09:57

Re: Set any id to each player connected?
 
I was careful to Bugsy's explanation below with connections. So:
Code:

if(get_user_userid(id) == 1)
{
// If userid is 1
}else{
// If you have any other userid out of 1
}

Thanks for your time in this topic.


All times are GMT -4. The time now is 05:43.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.