English name control

5 replies
Goto Page
To the start Previous 1 Next To the start
25.04.19 05:16:19 pm
Up
Quattro
User
Offline Off
Code:
1
2
3
4
5
6
7
8
addhook("name", "nameControl")
function nameControl(id, oldname, newname, forced)
     if forced == 1 then
          return 0
     else
          return 1
     end
end


I use this command as described in tutorial, why doesn't it work?
25.04.19 05:40:58 pm
Up
TrialAndError
User
Offline Off
Works for me if you're trying to achieve so that the player cannot change his/her name in game except for the "setname" command.

Do you have more than 1 hook set for 'name'?
26.04.19 10:34:46 pm
Up
Quattro
User
Offline Off
Come to GamersCentral dust2. If you try enough times you will change name eventually with this ruleset running. It doesn't work.
27.04.19 11:02:35 am
Up
phalenkO
User
Offline Off
@user Quattro: If u want the truth and I tell you truth, I dont understand the name control. Firstly you should tell me about the name control because off I need to understand.
27.04.19 12:31:50 pm
Up
DC
Admin
Offline Off
This looks like a bug / misleading hook behavior:
If the player is dead and tries to change his name the name change won't happen immediately but as soon as the player is alive again (next roundstart for instance). The hook will be executed with forced=1 in that case!

Will fix it like the following for the next release:
• If a name change is only scheduled, the name hook will be executed normally (with force 0). You can check yourself if it's just a schedule by checking the health/team of the player (dead/spec = schedule only). It can be cancelled already at this point by returning 1.
• If the name is actually changed as soon as the player becomes alive again, the hook will be triggered a second time but with forced=2 to indicate that his happend because of a delayed name change!

I updated cs2d lua hook name accordingly but note that it will only work like this with the next update.
edited 4×, last 27.04.19 12:53:21 pm
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
28.04.19 12:44:22 am
Up
Quattro
User
Offline Off
@user DC:
Thank you! This hook is quite useful in some situations.

@user phalenkO:
Name hook allows you to control the ability to change nicks. There's not much more to know
To the start Previous 1 Next To the start