Forum

> > CS2D > Scripts > name control
Forums overviewCS2D overview Scripts overviewLog in to reply

English name control

5 replies
To the start Previous 1 Next To the start

old name control

Quattro
GAME BANNED Off Offline

Quote
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?

old Re: name control

TrialAndError
User Off Offline

Quote
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'?

old Re: name control

Quattro
GAME BANNED Off Offline

Quote
Come to GamersCentral dust2. If you try enough times you will change name eventually with this ruleset running. It doesn't work.

old Re: name control

phalenkO
User Off Offline

Quote
@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.

old Re: name control

DC
Admin Off Offline

Quote
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

old Re: name control

Quattro
GAME BANNED Off Offline

Quote
@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
Log in to reply Scripts overviewCS2D overviewForums overview