AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_user_info problem (https://forums.alliedmods.net/showthread.php?t=172246)

sader 11-17-2011 20:00

get_user_info problem
 
Hi
I am trying to get client var value, but it looks so that if user is working on 64bit OS it doesn't work. I know that command client_cmd(id, "setinfo var value") works, cuz after I exit CS game I see that line in config.cfg, but still next time 64bit user connects to servers get_user_info() return empty value.

Here's my code prototype (btw client_connect doesn't return nor PLUGIN_CONTINUE nor PLUGIN_HANDLED, I'm not sure how to use those return constants properly)
PHP Code:

public client_connect(id)
{
  new 
val[33];
  
get_user_info(id"_myvarname"valcharsmax(val));
  
  
//if client doesn't have this var set yet then we will set it automaticly for him
  
if(val[0] == 0)
  {
    
client_cmd(id"setinfo ^"%s^" ^"%s^"""_myvarname"val); 
  }


And just in case. Cause may not be even 64bit OS ,but since I tested it on 2 different PC's 32 & 64 bits it was only idea I could come up with

fysiks 11-18-2011 00:13

Re: get_user_info problem
 
1. You probably can't send or send client info/commands on client_connect().
2. You shouldn't be changing people's settings. Stuff like that is not allowed here.
3. Explain what you are trying to do and we can likely suggest a better solution.

sader 11-18-2011 07:05

Re: get_user_info problem
 
I'm trying to generate uniqe ID for user and store it on clients config.cfg, so next time he logs in I check if player already has an ID if he doens't then new ID is generated.

ConnorMcLeod 11-18-2011 11:16

Re: get_user_info problem
 
When you set the info to val, val[0] == 0 so you just set nothing.

sader 11-18-2011 13:56

Re: get_user_info problem
 
PHP Code:

if(val[0] == 0

is the way I check if cl_varaiable exists and value is not "". I am not sure what would be right way to do it, but I can't find function such if_client_var_exists()

ConnorMcLeod 11-18-2011 14:14

Re: get_user_info problem
 
You check val[0] == 0
If the check is passed it means that the info is not set on client.
Then you set it to val, but you have just check that val doesn't contain anything, you should make another variable to hold the default value you want to set in case the info is not already set.

fysiks 11-18-2011 15:48

Re: get_user_info problem
 
Is there a reason you can't just get their SteamID?


All times are GMT -4. The time now is 08:32.

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