Results 1 to 5 of 5

Thread: Prevent duplicated names

  1. #1
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts

    Prevent duplicated names

    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?

  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    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.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  3. The Following User Says Thank You to IzNoGoD For This Useful Post:

    Ni3ls (31st July 2017)

  4. #3
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Do you have documentation of "CodeCallback_userinfochanged"?

  5. #4
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by Ni3ls View Post
    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().

    PHP Code:
    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.

    Last edited by Mitch; 31st July 2017 at 18:17.

  6. The Following User Says Thank You to Mitch For This Useful Post:

    Ni3ls (31st July 2017)

  7. #5
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    And you should call the renameclient(oldname) before calling clientuserinfochanged() if you dont want him to rename
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  8. The Following User Says Thank You to IzNoGoD For This Useful Post:

    Ni3ls (31st July 2017)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •