Raised This Month: $359 Target: $400
 89%   Almost there!

Bot Names Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 02-16-2022 , 20:48   Bot Names Plugin
Reply With Quote #1

Is it possible a plugin like this one but for Cs1.6/Condition Zero?

https://forums.alliedmods.net/showthread.php?p=1054057
Ark_Procession is offline
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 02-16-2022 , 22:22   Re: Bot Names Plugin
Reply With Quote #2

If it's possible or impossible, it's possible.
However, for zbot, it would be faster to rewrite BotProfile.db .
__________________
GitHub
SteamWishlist

六四天安門事件
+ARUKARI- is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-17-2022 , 14:15   Re: Bot Names Plugin
Reply With Quote #3

Even faster than this ~25 seconds write?

Code:
#include <amxmodx> new const NAMES_LIST[][] = {     "Botless bot",     "blabla",     "botty",     "botten",     "bottensten",     "bottenstenten",     "bot007" } public plugin_init() {     register_plugin("Random Bot Names", "1.0", "OciXCrom") } public client_putinserver(id) {     if(is_user_bot(id))     {         set_user_info(id, "name", NAMES_LIST[random(sizeof(NAMES_LIST))])     } }
__________________

Last edited by OciXCrom; 02-17-2022 at 14:16.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 02-19-2022 , 22:57   Re: Bot Names Plugin
Reply With Quote #4

Quote:
Originally Posted by OciXCrom View Post
Even faster than this ~25 seconds write?

Code:
#include <amxmodx> new const NAMES_LIST[][] = {     "Botless bot",     "blabla",     "botty",     "botten",     "bottensten",     "bottenstenten",     "bot007" } public plugin_init() {     register_plugin("Random Bot Names", "1.0", "OciXCrom") } public client_putinserver(id) {     if(is_user_bot(id))     {         set_user_info(id, "name", NAMES_LIST[random(sizeof(NAMES_LIST))])     } }

Brilliant as always Ocixcrom! thanks so much

Only thing i noticed: i have, 250 Custom names i use in source ( weird i know ) and lets say i fit 30 bots in czero... some names will repeat themselves in the list, any way to make it random but NOT repeat same name so all the names can have a chance to be used?

and how about a botnames.txt file so i don't have to compile everytime i want to add or remove names?

Last edited by Ark_Procession; 02-19-2022 at 23:11.
Ark_Procession is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 02-20-2022 , 07:18   Re: Bot Names Plugin
Reply With Quote #5

This is what I have been using.
Code:
public client_infochanged(id) {     get_user_name(id,g_name,charsmax (g_name))     if ( (is_user_connected(id)) && (is_user_bot(id)) && (containi(g_name,"(1)") > -1) )         server_cmd("amx_kick (1)%s ^"bot_infochanged_badname^"",g_name); }
__________________
DJEarthQuake is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-20-2022 , 07:22   Re: Bot Names Plugin
Reply With Quote #6

Previous code was just an example. Here's a full version with a file and duplicates prevention.

The file is configs/BotNames.ini.
Bear in mind that if it runs out of names, it will stop renaming them rather than create duplicates.

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

#if !defined MAX_NAME_LENGTH
const MAX_NAME_LENGTH 32
#endif

new Array:g_aBotNamesg_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(szFilenamecharsmax(szFilename))
    
add(szFilenamecharsmax(szFilename), "/BotNames.ini")
    new 
iFilePointer fopen(szFilename"rt")

    if(
iFilePointer)
    {
        new 
szData[MAX_NAME_LENGTH]

        while(!
feof(iFilePointer))
        {
            
fgets(iFilePointerszDatacharsmax(szData))
            
trim(szData)

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

        
fclose(iFilePointer)
    }
}

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)
    }

@DJEarthQuake - nonsense logic as always. That has the potential of making redundant loops and working in a non-efficient way. Why kick the bot if you already know it's a duplicate instead of simply renaming it?!
__________________

Last edited by OciXCrom; 02-20-2022 at 13:34.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 02-20-2022 , 11:25   Re: Bot Names Plugin
Reply With Quote #7

Quote:
Originally Posted by OciXCrom View Post
Previous code was just an example. Here's a full version with a file and duplicates prevention.

The file is configs/BotNames.ini.
Bear in mind that if it runs out of names, it will stop renaming them rather than create duplicates.

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

#if !defined MAX_NAME_LENGTH
const MAX_NAME_LENGTH 32
#endif

new Array:g_aBotNamesg_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(szFilenamecharsmax(szFilename))
    
add(szFilenamecharsmax(szFilename), "/BotNames.ini")
    new 
iFilePointer fopen(szFilename"rt")

    if(
iFilePointer)
    {
        new 
szData[MAX_NAME_LENGTH]

        while(!
feof(iFilePointer))
        {
            
fgets(iFilePointerszDatacharsmax(szData))
            
trim(szData)

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

        
fclose(iFilePointer)
    }
}

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)
    }

@DJEarthQuake - nonsense logic as always. That has the potential of making redundant loops and working in a non-efficient way. Why kick the bot if you already know it's a duplicate instead of simply renaming it?!
Amazing! works flawlessly

i had to create the botnames.ini manually since it wasnt created automatically


Thank you
Ark_Procession is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-20-2022 , 13:33   Re: Bot Names Plugin
Reply With Quote #8

It's not supposed to be created automatically.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 06-17-2022 , 13:53   Re: Bot Names Plugin
Reply With Quote #9

Quote:
Originally Posted by OciXCrom View Post
It's not supposed to be created automatically.
Been using this and we are having a blast thanks

Yesterday i had an idea, what if certain "bot names" could have a specific bot profile and difficulty?

do you think that is possible?
Ark_Procession is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 08-25-2022 , 08:46   Re: Bot Names Plugin
Reply With Quote #10

Quote:
Originally Posted by Ark_Procession View Post
i had to create the botnames.ini manually since it wasnt created automatically
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) }
__________________
DJEarthQuake is offline
Reply


Thread Tools
Display Modes

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:21.


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