Raised This Month: $51 Target: $400
 12% 

Serial or UserId?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Facksy
Senior Member
Join Date: Apr 2017
Location: +2+2
Old 11-14-2017 , 15:51   Serial or UserId?
Reply With Quote #1

Hey guys, I just would like to know what is the difference between GetClientSerial() and GetClientUserId(), I mean which one is the more useful, what's the difference?
Facksy is offline
Weetabix
Member
Join Date: Feb 2017
Location: United Kingdom
Old 11-14-2017 , 17:26   Re: Serial or UserId?
Reply With Quote #2

They do the same thing.
Weetabix is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 11-14-2017 , 18:30   Re: Serial or UserId?
Reply With Quote #3

Quote:
Originally Posted by Weetabix View Post
They do the same thing.
No, they do not.

GetClientUserId() returns the User ID, which is provided by the engine, and is viewable via the status command. This number is the most useful in that it is used elsewhere. For example, a person who has the user ID 456 can be targeted in this manner:

sm_slay #456

Additionally, the user ID is used in some hookable events to identify the player in question.

User IDs are passed out sequentially, with the first connection being 1, the second being 2, and so on. This is reset back to 0 when the server restarts. Further, these IDs loop back to 0 once they get to 65535.


Client serials are, IIRC, generated by Sourcemod itself. Unlike the User ID, these are guaranteed to be unique for the life of the server until its next boot, even if more than 65535 connections have been made. These cannot be used to target players, and have no use other than to verify that a given client index is the same player, on the same connection, as at a previous point in time.
__________________

Last edited by ddhoward; 11-14-2017 at 18:31.
ddhoward is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 11-16-2017 , 02:21   Re: Serial or UserId?
Reply With Quote #4

I perfer userids as they are commonly used throughout the engine.
__________________
Neuro Toxin is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:20.


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