Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 28

Thread: Kicking bots

  1. #11
    Private First Class
    Join Date
    Oct 2013
    Posts
    219
    Thanks
    56
    Thanked 105 Times in 66 Posts
    Quote Originally Posted by Mitch View Post
    Why wouldn't it be possible? I would assume that it should be possible.
    I'm only guessing here but I think he's manipulating the default bot name (Which can be done without libcod by editing cod2_mp with a hex editor, but the bot name is limited to 3 chars without libcod) which affects all bots globally.

    If its possible to individually change their name (Without making your own scoreboard/obituary) then by all means prove me wrong =D
    Last edited by filthy_freak_; 23rd May 2014 at 18:33.

  2. #12
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Of course im manipulating the bot names individually, however, it seems like i missed something, as the bot is in fact renamed (in rcon status), but ingame it is still botxx
    "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:

    php (23rd May 2014)

  4. #13
    Private First Class php's Avatar
    Join Date
    Nov 2012
    Posts
    142
    Thanks
    28
    Thanked 116 Times in 59 Posts


    PHP Code:
    names = [];
        
    names[names.size] = "Rob";
        
    names[names.size] = "Richard";
        
    names[names.size] = "Jim";
        
    names[names.size] = "IzNoGoD";
        
    names[names.size] = "Harry";
        
    names[names.size] = "Wizard";
        
    names[names.size] = "Pancakes";
        for(
    i=0;i<15;i++) {
            
    addtestclient();
            
    b renamebot(names[randomInt(names.size-1)]); 

  5. The Following 4 Users Say Thank You to php For This Useful Post:

    filthy_freak_ (24th May 2014),kung foo man (24th May 2014),maxdamage99 (17th September 2015),Ni3ls (24th May 2014)

  6. #14
    Private First Class
    Join Date
    Oct 2013
    Posts
    219
    Thanks
    56
    Thanked 105 Times in 66 Posts
    Lmao.

    Looks like I was wrong. Makes me want to strap down and learn how libcod works. Well done.

    Any chance of including your rename method in a future libcod update?

  7. #15
    Private First Class
    Join Date
    Oct 2013
    Posts
    219
    Thanks
    56
    Thanked 105 Times in 66 Posts
    Found a bug with kicking the bots.

    It seems that if you create a testclient & spawn them (If they're not spawned it will not trigger the bug) it will crash the server after creating & spawning over 1.3k bots.

    Heres the error it will give:
    Click image for larger version. 

Name:	crash.png 
Views:	190 
Size:	19.8 KB 
ID:	711

    You can duplicate this crash with ease. On start gametype, add 64 testclients, spawn them, then cycle the map. Within 3-5 minutes you will go through 1.3k bots and it will crash the server.

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

    kung foo man (24th May 2014)

  9. #16
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Quote Originally Posted by filthy_freak_ View Post
    Found a bug with kicking the bots.

    It seems that if you create a testclient & spawn them (If they're not spawned it will not trigger the bug) it will crash the server after creating & spawning over 1.3k bots.

    Heres the error it will give:
    Click image for larger version. 

Name:	crash.png 
Views:	190 
Size:	19.8 KB 
ID:	711

    You can duplicate this crash with ease. On start gametype, add 64 testclients, spawn them, then cycle the map. Within 3-5 minutes you will go through 1.3k bots and it will crash the server.
    ye well, dont put them in an array and you'll be fine.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

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

    filthy_freak_ (24th May 2014)

  11. #17
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    It will do that for any spawned entity - there is obviously a limit to the number of such entities you can spawn.

    Solution: every time you kick a bot, also remove it from all spawn arrays in _spawnlogic.gsc.

  12. The Following User Says Thank You to Tally For This Useful Post:

    filthy_freak_ (24th May 2014)

  13. #18
    Private First Class php's Avatar
    Join Date
    Nov 2012
    Posts
    142
    Thanks
    28
    Thanked 116 Times in 59 Posts
    For changing bot names;

    PHP Code:

    void PlayerCmd_renamebot
    (int a1) {
        
    charkey Script_GetString(0);
        
    char userinfo[MAX_STRING_CHARS];
        
    getuserinfo(a1userinfosizeof(userinfo));
        
        
    /*char* value = Info_ValueForKey(userinfo, key);
        if(value == NULL)
            Script_AddString("");
        else
            Script_AddString(value);*/
        
    Info_SetValueForKey(userinfo"name"key);
        
    setuserinfo(a1userinfo);
        
        
    client_tcl getclient(a1);
        if(
    cl) {
            
    memcpy(&cl->name[0], key32);
            
    cl->name[31] = '\0';
        }
        
        
    printf("name = %s\n"cl->name);

    I didn't check if it only works with cl->name or userinfo so I set both and I really don't care to find out.
    As for name changing instantly, just call *_UserinfoChanged (harder way for non-libcod people)
    For convience I held on to the q3/wolf SDK name conventions so you can look it up yourself what it does and all.

    Easier way is just to use the builtin script function

    UpdateClientNames()
    Module: Level
    MP Only

    Summary:
    Update all of the client names: only works in 'manual_change' mode
    Usage:

    PHP Code:
    newname "harry you're a wizard";
    players=getentarray("player","classname");
    for(
    i=0;i<players.size;i++){
        if(
    players[iisbot()) {
            
    players[irenamebot(newname);
    }
    updateclientnames(); //calling it for every bot name change in a loop is not recommended except when you're only changing one bot name
    //since it's a loop let's call it at the end
    //it will notify in a iprintln with "bot<number> changed name to <newname>"
    //so find the UserinfoChanged or set the start of that string (hex edit) to \0

    PHP Code:
    void PlayerCmd_isbot(int a1) {
        
    client_tcl getclient(a1);
        if(
    cl) {
            if(
    cl->remoteAddress.type == NA_BOT)
                
    Script_AddBool(true);
            else
                
    Script_AddBool(false);
        } else {
            
    Script_AddBool(false);
        }

    As for the CoDExtended functions if you'd like to convert them to libcod, just look up the Q3/WOLF SDK
    a1 = entityNumber
    getclient = function gets client_t pointer for number
    Last edited by php; 24th May 2014 at 12:53.

  14. The Following User Says Thank You to php For This Useful Post:

    filthy_freak_ (24th May 2014)

  15. #19
    Private First Class
    Join Date
    Oct 2013
    Posts
    219
    Thanks
    56
    Thanked 105 Times in 66 Posts
    Epic, I'll definitely use your method soon and post results.

    Also, fixed my other problem by moving bots to spectator before kicking.

    Cheers all for the help!

  16. #20
    Private First Class
    Join Date
    Oct 2013
    Posts
    219
    Thanks
    56
    Thanked 105 Times in 66 Posts
    Before I attempt to implement the method into my libcod, I have a quick question;

    Why is it
    Code:
    void PlayerCmd_renamebot(int a1) {
    instead of
    Code:
    void PlayerCmd_renamebot(string newname) {
    since you do
    Code:
    players[i] renamebot(newname);

Posting Permissions

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