Setting player name
Im not sure if this is an AMX bug or something? But with the following code, when you connect the first time it forces your name.. But if you retry it ignores it and does not force your name, it keeps it as whatever your counter-strike config was set to.
Any ideas? I need to force the name each time they connect. public client_connect(id) { new newName[33] get_user_info(id,"name",newName,32) if(containi(newName,"[NEW NAME]") == -1) { format(newName,32,"[NEW NAME] %s",newName) set_user_info(id,"name",newName) } } |
Re: Setting player name
Try checking his name at client_infochanged(id). It is called whenever his name is set/he changes his name(it is called in other events too, but the name is the important thing here).
PHP Code:
|
Re: Setting player name
Yeah but then it is only going to set their name if they change it.
If you use my code it sets their name when they join but if they retry it doesn't set it again for some reason.. With your way it is only going to set if when info is changed. I need it when they join the server (set it always.. not just the first time) |
Re: Setting player name
In my tests, client_infochanged() is called several times when a client is connecting to the server. (3 or 4 if I remember correctly)
|
Re: Setting player name
Quote:
|
Re: Setting player name
Quote:
|
Re: Setting player name
Quote:
|
Re: Setting player name
The code should be working tho.. I did a server_print("code executed"); under where it sets the name..
It shows each time, however the persons name is not being set.. It only sets it the first time they connect... If they then retry, their name stays as whatever their name is set to in their settings.. but i still see the message in the server console. |
Re: Setting player name
Do some more troubleshooting. Server print name, tag, newname, or whatever to see if the name is correct or the if statement is being executed or etc. That's what I would do.
|
Re: Setting player name
Try adding quotes around the name since it does contain space(s).
format(name, 31, "^"%s %s^"", NAME_TAG, name); |
| All times are GMT -4. The time now is 02:16. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.