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

[CS:GO] get m_nPersonaDataPublicLevel value


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Aketti
New Member
Join Date: Jan 2018
Old 01-21-2020 , 17:21   [CS:GO] get m_nPersonaDataPublicLevel value
Reply With Quote #1

Hi! I found in some older topics that
Code:
GetEntProp(GetPlayerResourceEntity(), Prop_Send, "m_nPersonaDataPublicLevel", _, client)
should give me player CS:GO level, but instead it is always -1 even on fresh steam account.
So my question is if there is any way to check player CS:GO level or if this code should work then if you have any ideas why it doesn`t work for me?

Edit: I found out that if I run this code in OnClientPostAdminCheck() it doesn`t work, but if I use command
Code:
public Action Command_SteamLvl(int client, int args)
{
	int x = GetEntProp(GetPlayerResourceEntity(), Prop_Send, "m_nPersonaDataPublicLevel", _, client);
	PrintToChat(client, "%d", x);
}
it is working properly, so now the question is where should I put this piece of code to check if player has certain level and kick him from server if he doesn`t. I wouldn`t like to check all players every round to determine if their level is ok, it should happen on player connect.

Last edited by Aketti; 01-21-2020 at 18:18. Reason: update
Aketti is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 01-22-2020 , 11:28   Re: [CS:GO] get m_nPersonaDataPublicLevel value
Reply With Quote #2

If you join the server, but only select the spectator team (so you're never getting alive)? Is the "Command_SteamLvl" working as expected that way too?

Or do you have to wait until you have spawned (been alive at least once) before your "Command_SteamLvl" works fine?

Quote:
Originally Posted by Aketti View Post
[...] so now the question is where should I put this piece of code to check if player has certain level and kick him from server if he doesn`t. I wouldn`t like to check all players every round to determine if their level is ok, it should happen on player connect.
As OnClientPostAdminCheck does not provide the information you want at that stage, I suggest trying player_spawn:

You can then create a global variable, e.g. "g_bHasPlayerBeenSpawned", and at the time you check the player and handle him/her accordingly, if (s)he fits the criteria to stay, set "g_bHasPlayerBeenSpawned" to TRUE, to prevent further scans.

And then remember to unset / set to FALSE again in OnClientDisconnect for the relevant client index.

If OnClientPostAdminCheck is "too soon" to check for this prop, as it appears according to your explanation, the player_spawn may be the earliest / best shot, and then add the use of the boolean variable from the beginning and/or if you experience performance issues due to the check at each spawn.
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 01-24-2020 , 15:52   Re: [CS:GO] get m_nPersonaDataPublicLevel value
Reply With Quote #3

Quote:
Originally Posted by DarkDeviL View Post
If you join the server, but only select the spectator team (so you're never getting alive)? Is the "Command_SteamLvl" working as expected that way too?

Or do you have to wait until you have spawned (been alive at least once) before your "Command_SteamLvl" works fine?



As OnClientPostAdminCheck does not provide the information you want at that stage, I suggest trying player_spawn:

You can then create a global variable, e.g. "g_bHasPlayerBeenSpawned", and at the time you check the player and handle him/her accordingly, if (s)he fits the criteria to stay, set "g_bHasPlayerBeenSpawned" to TRUE, to prevent further scans.

And then remember to unset / set to FALSE again in OnClientDisconnect for the relevant client index.

If OnClientPostAdminCheck is "too soon" to check for this prop, as it appears according to your explanation, the player_spawn may be the earliest / best shot, and then add the use of the boolean variable from the beginning and/or if you experience performance issues due to the check at each spawn.
player_spawn can take 5 minutes from connection. player_team is the best shot in my opinion.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Reply


Thread Tools
Display Modes

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 02:16.


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