Raised This Month: $51 Target: $400
 12% 

Bot Names Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 08-25-2022 , 23:59   Re: Bot Names Plugin
Reply With Quote #11

Quote:
Originally Posted by DJEarthQuake View Post
Not anymore!

Code:
/*  * This program is free software; you can redistribute it and/or modify  * it under the terms of the GNU General Public License as published by  * the Free Software Foundation; either version 2 of the License, or  * (at your option) any later version.  *  * This program is distributed in the hope that it will be useful,  * but WITHOUT ANY WARRANTY; without even the implied warranty of  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  * GNU General Public License for more details.  *  * You should have received a copy of the GNU General Public License  * along with this program; if not, write to the Free Software  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  * MA 02110-1301, USA.  *  * When clients connect with the duplicate name or non-utf8 it renames them.  *     *     Credit: OciXCroM <a href="https://forums.alliedmods.net/showthread.php?t=336394" target="_blank" rel="noopener">https://forums.alliedmods.net/showthread.php?t=336394</a>. Helped with rename and array.     Install instructions: Recommended quick start:     Symbolic link BotNames.ini with existing 'alternative' bot names file.     *  * */ #include <amxmodx> #include <amxmisc> #define MAX_PLAYERS                32 #define MAX_NAME_LENGTH            32 #define MAX_AUTHID_LENGTH          64 #define MAX_CMD_LENGTH             128 #define MAX_USER_INFO_LENGTH       256 #define PLUGIN "!Client ReNaMeR" #define VERSION "1.0" new const SzBotFileName[]="/BotNames.ini" new Array:g_aBotNames, g_iTotalNames; new ClientAuth[MAX_PLAYERS+1][MAX_AUTHID_LENGTH]; new ClientName[MAX_PLAYERS+1][MAX_NAME_LENGTH]; new XBots_only, XCyborgFilter, XUTF8_Strafe; static const SzInitFakeName[] = "gamer" public client_infochanged(id) {     if(is_user_connected(id))     {         if(!is_user_bot(id) && get_pcvar_num(XBots_only))             return         get_user_name(id,ClientName[id],charsmax(ClientName[]))         new Szcheck[2]         copy(Szcheck, charsmax(Szcheck), ClientName[id])         if(containi(ClientName[id],"(1)") > -1 || equal(ClientName[id], "") || get_pcvar_num(XUTF8_Strafe) && get_char_bytes(Szcheck) != 1)             @player_rename(id)     } } @player_rename(id) {     if(g_iTotalNames)     {         if(is_user_connected(id))         {             if(is_user_bot(id) && get_pcvar_num(XCyborgFilter))             {                 get_user_authid(id,ClientAuth[id],charsmax(ClientAuth[]))                 if(!equali(ClientAuth[id], "BOT"))                     return             }             if(g_iTotalNames--)             {                 new szName[MAX_NAME_LENGTH], i = random(g_iTotalNames)                 ArrayGetString(g_aBotNames, i, szName, charsmax(szName))                 ArrayDeleteItem(g_aBotNames, i)                 static const szNameField[] = "name"                 server_print "%s renamed to %s", ClientName[id], szName                 set_user_info(id, szNameField, szName)             }             else             {                 server_print "Try growing your name list!"                 @init_fake_file() //will make new name based on time             }         }     }     else     {         log_amx "Try growing your array list!"         pause ("c")     } } public plugin_init() {     register_plugin(PLUGIN, VERSION, "SPiNX")     XCyborgFilter   = register_cvar("sv_rename_intregrity","0") //If humans complain when sv_rename_humans 1 seldomly fails.     XBots_only      = register_cvar("sv_rename_humans","0") //This was made for bots but applied to humans also.     XUTF8_Strafe    = register_cvar("sv_rename_utf","0") //Ever watched the flood from renaming non-utf8 CountryOnName? Not pretty.     g_aBotNames = ArrayCreate(MAX_NAME_LENGTH)     ReadFile() } public plugin_end()     ArrayDestroy(g_aBotNames) ReadFile() {     new szFilename[MAX_USER_INFO_LENGTH]     get_configsdir(szFilename, charsmax(szFilename))     add(szFilename, charsmax(szFilename), SzBotFileName)     new iFilePointer = fopen(szFilename, "rt")     new szData[MAX_NAME_LENGTH]     if(!iFilePointer)     {         @init_fake_file()         return     }     else if(iFilePointer)     {         while(!feof(iFilePointer))         {             fgets(iFilePointer, szData, charsmax(szData))             trim(szData)             switch(szData[0])             {                 case EOS, '#', ';': continue                 default:                 {                     g_iTotalNames++                     ArrayPushString(g_aBotNames, szData)                 }             }         }         fclose(iFilePointer)     } } @init_fake_file() {     new rSzName[MAX_NAME_LENGTH]     new mod_name[MAX_NAME_LENGTH]     new SzBuffer[MAX_NAME_LENGTH]     //make name off what is in script     copy(SzBuffer, charsmax(SzBuffer), SzInitFakeName)     @file_data(SzBuffer)     //make name off what is in script 1st LTR upper     copy(SzBuffer, charsmax(SzBuffer),SzInitFakeName)     mb_ucfirst(SzBuffer, charsmax(SzBuffer))     @file_data(SzBuffer)     //add time in epoch to default alias     formatex(rSzName, charsmax(rSzName), "%s:%i", SzInitFakeName, get_systime())     copy(SzBuffer, charsmax(SzBuffer), rSzName)     @file_data(SzBuffer)     //add time in epoch to default alias Swapped     formatex(rSzName, charsmax(rSzName), "%s:%i", SzInitFakeName, swapchars(get_systime()))     copy(SzBuffer, charsmax(SzBuffer), rSzName)     @file_data(SzBuffer)     //make name off mod name     get_modname(mod_name, charsmax(mod_name))     copy(SzBuffer, charsmax(SzBuffer), mod_name)     @file_data(SzBuffer)     //make name off what is in script all upper     mb_strtoupper(SzBuffer, charsmax(SzBuffer))     @file_data(SzBuffer)     //make name off mod name 1sr cap plus time     mb_ucfirst(mod_name, charsmax(mod_name))     formatex(SzBuffer, charsmax(SzBuffer), "%s:%i", mod_name, get_systime())     //mb_strtolower(SzBuffer, charsmax(SzBuffer))     @file_data(SzBuffer)     //go back to reading     ReadFile() } @file_data(SzBuffer[MAX_NAME_LENGTH]) {     server_print "%s|trying save %s", PLUGIN, SzBuffer     new szFilePath[ MAX_USER_INFO_LENGTH ]     get_configsdir( szFilePath, charsmax( szFilePath ) )     add( szFilePath, charsmax( szFilePath ), SzBotFileName )     write_file(szFilePath, SzBuffer) }

i love when you choose me for your unrequested plugins lol

what is the difference between ocixcrom's plugin?
Ark_Procession is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 08-26-2022 , 10:11   Re: Bot Names Plugin
Reply With Quote #12

This will automatically make a list if no file is found for express deployment. It optionally can be triggered to work on humans who sometimes show up with problematic NON-UTF8 char in their names. If it finds any of the *evil symbols*, script replaces the name with one on bot list. Forgot about this thread and was searching for one many years before looking for some code I do not want to remake again. Kind regards.
When clients connect with the duplicate name or non-utf8 it renames them.
__________________

Last edited by DJEarthQuake; 08-26-2022 at 10:15.
DJEarthQuake is offline
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 01-11-2024 , 15:24   Re: Bot Names Plugin
Reply With Quote #13

Quote:
Originally Posted by DJEarthQuake View Post
This will automatically make a list if no file is found for express deployment. It optionally can be triggered to work on humans who sometimes show up with problematic NON-UTF8 char in their names. If it finds any of the *evil symbols*, script replaces the name with one on bot list. Forgot about this thread and was searching for one many years before looking for some code I do not want to remake again. Kind regards.
When clients connect with the duplicate name or non-utf8 it renames them.
Hello! its been some time.

To this day my brother and i accumulated 300+ custom bot names and it has been really fun.

This is insane ofc... but we are kind of ambicious and want to see newer names, maths says there is less chance to see newer names if names numbers keep going up.
The reason for this is the plugin made by OcixCrom is using random numbers.

How about if it was possible to keep track of the names that appeared since the server is open, even with a changelevel (might not be possible).
For example: using 30 bots, 30 names appeared, now those 30 names wont be used for the next time a bot is added until the list is runs out.
This could mean a map change or simply kicking them and adding them back. once the list runs out, repeated names are allowed again and everything starts over

Is this possible to make?


latest code:

HTML Code:
#include <amxmodx>
#include <amxmisc>

#if !defined MAX_NAME_LENGTH
const MAX_NAME_LENGTH = 32
#endif

new Array:g_aBotNames, g_iTotalNames

public plugin_init()
{
    register_plugin("Random Bot Names", "1.0", "OciXCrom")
    g_aBotNames = ArrayCreate(MAX_NAME_LENGTH)
    ReadFile()
}

public plugin_end()
{
    ArrayDestroy(g_aBotNames)
}

ReadFile()
{
    new szFilename[256]
    get_configsdir(szFilename, charsmax(szFilename))
    add(szFilename, charsmax(szFilename), "/BotNames.ini")
    new iFilePointer = fopen(szFilename, "rt")

    if(iFilePointer)
    {
        new szData[MAX_NAME_LENGTH]

        while(!feof(iFilePointer))
        {
            fgets(iFilePointer, szData, charsmax(szData))
            trim(szData)

            switch(szData[0])
            {
                case EOS, '#', ';': continue
                default:
                {
                    g_iTotalNames++
                    ArrayPushString(g_aBotNames, szData)
                }
            }
        }

        fclose(iFilePointer)
    }
}

public client_putinserver(id)
{
    if(!is_user_bot(id))
    {
            return
    }

    if(g_iTotalNames--)
    {
        new szName[MAX_NAME_LENGTH], i = random(g_iTotalNames)
        ArrayGetString(g_aBotNames, i, szName, charsmax(szName))
        ArrayDeleteItem(g_aBotNames, i)

        static const szNameField[] = "name"
        set_user_info(id, szNameField, szName)
    }
}  
Ark_Procession is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 01-12-2024 , 18:06   Re: Bot Names Plugin
Reply With Quote #14

this?
PHP Code:
public client_putinserver(id)
{
    if(!
is_user_bot(id))
    {
            return
    }

    if(
g_iTotalNames--)
    {
        new 
szName[MAX_NAME_LENGTH], random(g_iTotalNames)
        
ArrayGetString(g_aBotNamesiszNamecharsmax(szName))
        
ArrayDeleteItem(g_aBotNamesi)

        static const 
szNameField[] = "name"
        
set_user_info(idszNameFieldszName)

        if (!
g_iTotalNames)
            
ReadFile()
    }

__________________
bigdaddy424 is offline
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 01-13-2024 , 11:22   Re: Bot Names Plugin
Reply With Quote #15

Quote:
Originally Posted by bigdaddy424 View Post
this?
PHP Code:
public client_putinserver(id)
{
    if(!
is_user_bot(id))
    {
            return
    }

    if(
g_iTotalNames--)
    {
        new 
szName[MAX_NAME_LENGTH], random(g_iTotalNames)
        
ArrayGetString(g_aBotNamesiszNamecharsmax(szName))
        
ArrayDeleteItem(g_aBotNamesi)

        static const 
szNameField[] = "name"
        
set_user_info(idszNameFieldszName)

        if (!
g_iTotalNames)
            
ReadFile()
    }

What you mean with "this"?

the code is the plugin and as far as i know it doesn't support the described functionality.
the fact i am playing with it for 2 years is solid proof.
Ark_Procession is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 01-13-2024 , 14:01   Re: Bot Names Plugin
Reply With Quote #16

i dont understand a word from your last comment but this works
PHP Code:
public client_putinserver(id)
{
    if(!
is_user_bot(id))
    {
            return
    }

    if(
g_iTotalNames-- >= 0)
    {
        new 
szName[MAX_NAME_LENGTH], random(g_iTotalNames)
        
ArrayGetString(g_aBotNamesiszNamecharsmax(szName))
        
ArrayDeleteItem(g_aBotNamesi)

        static const 
szNameField[] = "name"
        
set_user_info(idszNameFieldszName)

        if (!
g_iTotalNames)
            
ReadFile()
    }

__________________
bigdaddy424 is offline
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 01-13-2024 , 18:41   Re: Bot Names Plugin
Reply With Quote #17

Quote:
Originally Posted by bigdaddy424 View Post
i dont understand a word from your last comment but this works
PHP Code:
public client_putinserver(id)
{
    if(!
is_user_bot(id))
    {
            return
    }

    if(
g_iTotalNames-- >= 0)
    {
        new 
szName[MAX_NAME_LENGTH], random(g_iTotalNames)
        
ArrayGetString(g_aBotNamesiszNamecharsmax(szName))
        
ArrayDeleteItem(g_aBotNamesi)

        static const 
szNameField[] = "name"
        
set_user_info(idszNameFieldszName)

        if (!
g_iTotalNames)
            
ReadFile()
    }

What are you talking about?

the plugin works, yes.

The described functionality i need is not implemented.

EDIT:
I think i understand what you mean, names are not repeated as for a single instance of "adding them" ofc.
but i want is to be able not to repeat names that have been added in the same session or even through changelevels, which might be challenging.

I was thinking storing used names in another variable that can go across maps, and have the list run out before attempting to use an already used name.

Result would be to give chance to more if not all names, to appear guaranteed.

Last edited by Ark_Procession; 01-13-2024 at 18:44. Reason: clarification
Ark_Procession is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 01-13-2024 , 19:34   Re: Bot Names Plugin
Reply With Quote #18

add more names so ReadFile doesnt execute
__________________
bigdaddy424 is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 01-13-2024 , 22:02   Re: Bot Names Plugin
Reply With Quote #19

If using my work replace the line that has pause with ReadFile().
__________________
DJEarthQuake is offline
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 01-15-2024 , 08:57   Re: Bot Names Plugin
Reply With Quote #20

Quote:
Originally Posted by DJEarthQuake View Post
If using my work replace the line that has pause with ReadFile().
I can't even make your version work at all.
Ark_Procession is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:10.


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