PDA

View Full Version : Prevent duplicated names



Ni3ls
31st July 2017, 14:33
Hi all,

Most hacks have the "rename to the a random player" function. Now I already made a counter that counts how many namechanges you did (with a wait) and kick after a certain amount. This isnt the ideal situation, because some players have binds with namechanges.

Is it possible to prevent players having duplicated names? Can somebody help me into the right direction?

IzNoGoD
31st July 2017, 14:54
onconnect check userinfo "name", then bind the CodeCallback_userinfochanged in _callbacksetup.gsc to check for it again each time it changes. Use renameclient() to rename the client appropriately.

Ni3ls
31st July 2017, 15:33
Do you have documentation of "CodeCallback_userinfochanged"?

Mitch
31st July 2017, 16:58
Do you have documentation of "CodeCallback_userinfochanged"?

CodeCallback_UserInfoChanged is called every time the 'userinfo' text has been changed (including your name) and is called before changing the client's user info data.
So 'self.name' is updated after executing the function clientuserinfochanged().



CodeCallback_UserInfoChanged(clientNum)
{
oldname = self.name; // 'userinfo' text has not been processed yet.
name = self get_userinfo("name"); // Get player's name from the updated 'userinfo' text.

// Edit:
// Like IzNoGod said: check for name duplication here and restore the old name using renameclient(oldname) in case needed.

self clientuserinfochanged(); // Update the client's user info data.
}

IzNoGoD
31st July 2017, 17:01
And you should call the renameclient(oldname) before calling clientuserinfochanged() if you dont want him to rename