AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   nickname changer (https://forums.alliedmods.net/showthread.php?t=345434)

samobiezny133 01-12-2024 22:54

nickname changer
 
Hello, I would like to create a plugin that changes the nickname of each player joining the server to one of the nicknames from my pool. I would also like the plugin to draw a nickname from the pool every time the map changes, and so that the drawn nickname cannot be changed by the player.
How to do it?

fysiks 01-13-2024 17:09

Re: nickname changer
 
I basically do this already but specifically for players who have the default name "Player". You should be able to modify it as needed. You'll have to change the logic for preventing a name change because I only disallow "Player" but it shouldn't be that hard.

https://github.com/fysiks1/amxx-noplayername

There are other examples out there for preventing name changes if you search for them. Might need to use an actual search engine though since you can't search for the term "player" on this forum (because it's too popular a term).

samobiezny133 01-14-2024 02:12

Re: nickname changer
 
Quote:

Originally Posted by fysiks (Post 2816004)
I basically do this already but specifically for players who have the default name "Player". You should be able to modify it as needed. You'll have to change the logic for preventing a name change because I only disallow "Player" but it shouldn't be that hard.

https://github.com/fysiks1/amxx-noplayername

There are other examples out there for preventing name changes if you search for them. Might need to use an actual search engine though since you can't search for the term "player" on this forum (because it's too popular a term).


Thank you very much! I'll work on your script a bit and try to adapt it to my needs.
Your help is invaluable.
Best regards and have a nice day.

samobiezny133 01-14-2024 02:47

Re: nickname changer
 
Quote:

Originally Posted by fysiks (Post 2816004)
I basically do this already but specifically for players who have the default name "Player". You should be able to modify it as needed. You'll have to change the logic for preventing a name change because I only disallow "Player" but it shouldn't be that hard.

https://github.com/fysiks1/amxx-noplayername

There are other examples out there for preventing name changes if you search for them. Might need to use an actual search engine though since you can't search for the term "player" on this forum (because it's too popular a term).

I trimmed the script a bit. I just need each nickname to be replaced with one of the nicknames from the pool. I already have a plugin that stops the player from changing their nickname. Honestly, I don't know anything about programming (I thought it is a little easier and I think my brain is probably too old to learn it, haha). I need this plugin for a private server where I play with friends from my student days. Could you edit the script for me to change the nickname for everyone, regardless of whether their name is player or not? I would be very grateful.

Script modified by me : https://pastebin.com/9QpqkewJ

mlibre 01-14-2024 13:42

Re: nickname changer
 
you are talking about changing or adding a nickname to the existing name...

Code:
Player connecting... (nickname) Player connected.

or

Code:
Player connecting... nickname connected.

fysiks 01-14-2024 18:46

Re: nickname changer
 
Quote:

Originally Posted by samobiezny133 (Post 2816020)
I already have a plugin that stops the player from changing their nickname.

That will probably conflict with a plugin designed to change names. I think both functions must be in the same plugin so that the two functionalities don't conflict.

mlibre 01-14-2024 20:59

Re: nickname changer
 
another detail is to avoid duplicates

samobiezny133 01-15-2024 10:10

Re: nickname changer
 
Quote:

Originally Posted by fysiks (Post 2816058)
That will probably conflict with a plugin designed to change names. I think both functions must be in the same plugin so that the two functionalities don't conflict.


In this case, I will disable this plugin so that it does not conflict with the nickname change plugin.

samobiezny133 01-15-2024 10:13

Re: nickname changer
 
Quote:

Originally Posted by mlibre (Post 2816046)
you are talking about changing or adding a nickname to the existing name...

Code:
Player connecting... (nickname) Player connected.

or

Code:
Player connecting... nickname connected.

I mean completely changing the nickname of each connected player

fysiks 01-16-2024 02:31

Re: nickname changer
 
1 Attachment(s)
Ok, so here is this plugin working based on my understanding of your request.


All times are GMT -4. The time now is 17:57.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.