AlliedModders

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

Vechta 10-22-2010 14:34

Help?
 
PHP Code:

new szInfo[32]
    
get_user_info(id"test"szInfo31)
    
    if (
equal(test"abc"))
    {
        
client_print(idprint_chat"Hi!")
    } 

What i did wrong?

hleV 10-22-2010 14:35

Re: Help?
 
Nothing, unless you've written test instead of szInfo.
Code:
new szInfo[32]     get_user_info(id, "test", szInfo, 31)           if (equal(test, "abc"))     {         client_print(id, print_chat, "Hi!")     }

Vechta 10-22-2010 14:51

Re: Help?
 
ups, but the code dont work if checking on client_putinserver :/

You know why?

hleV 10-22-2010 14:57

Re: Help?
 
Try changing the "setinfo field" from "test" to "_test" (in both setting and getting info) and see if that works.

Hunter-Digital 10-22-2010 17:11

Re: Help?
 
Quote:

Originally Posted by hleV (Post 1331833)
Try changing the "setinfo field" from "test" to "_test" (in both setting and getting info) and see if that works.

Does that underline have any special purpose in setinfos ?

hleV 10-22-2010 17:40

Re: Help?
 
Quote:

Originally Posted by Hunter-Digital (Post 1331900)
Does that underline have any special purpose in setinfos ?

I think so.

fysiks 10-22-2010 18:29

Re: Help?
 
Quote:

Originally Posted by Hunter-Digital (Post 1331900)
Does that underline have any special purpose in setinfos ?

Doubtfull. The underscore (_) is considered a word character in most languages meaning that it is used exactly the same as any letter when delcaring variables. So, the underscore has no actual coding purpose other than readability (knowing that it belongs to a group of variables that have something in common).

Also, remember that when using setinfo in the client there is only a set maximum that you can use afaik. So, if you have hit that limit then you can't use a set info for anything new. Somebody may correct me if I've misunderstood something about setinfo but it wouldn't work for me with too many.

AfteR. 10-22-2010 20:06

Re: Help?
 
Quote:

Originally Posted by Vechta (Post 1331825)
ups, but the code dont work if checking on client_putinserver :/

You know why?

Then use client_connect(id)

fysiks 10-22-2010 21:28

Re: Help?
 
Quote:

Originally Posted by AfteR. (Post 1332002)
Then use client_connect(id)

client_connect happens before the person is even in the server. If client_putinserver() doesn't work then client_connect() would do likewise.

Hunter-Digital 10-22-2010 21:41

Re: Help?
 
Quote:

Originally Posted by hleV (Post 1331911)
I think so.

You obviously aren't sure, and as fysiks said, that doesn't have any special effect, which I already knew but wanted to see if you know something that I don't :P

Quote:

Originally Posted by fysiks (Post 1331939)
Also, remember that when using setinfo in the client there is only a set maximum that you can use afaik. So, if you have hit that limit then you can't use a set info for anything new. Somebody may correct me if I've misunderstood something about setinfo but it wouldn't work for me with too many.

It prints out "Info length string exceeded" when that limit is exceeded, which I belive is around 255 total characters (keys + values).
The "password" command is also added to the setinfo string and also rejected if length is exceeded.

Quote:

Originally Posted by Vechta (Post 1331825)
ups, but the code dont work if checking on client_putinserver :/

You know why?

Add an "else" to the condition and print something else to see if it's the forward's or your setinfo reading method's fault... aka DEBUG ! :}


All times are GMT -4. The time now is 10:22.

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