![]() |
Problems with amount of bots.
I'm Polish, so please be patient reading this ;)
I have installed and configured: 1. MetaMod 1.17.1 2. AMX 0.9.9 2. PODBot v2.6mm with new DLL v2.46a I have problem with amount of bots. While real people are entering the game something crashes. I'm using my own plugin (code below) and function from amx get_players give me untrue information like this: all players are 2, but for real on the server are 5 people! Another example: max_bots is set to 10. Bots are placed is CT and T by 5 for each team. To game comming 3 people. One Bot is missing, but two another are still plaing in CT (there are 1 real player in T and 4 Bots, and 2 real players in CT and 4 Bots). I didn't know were post this problem, but I think all is dependend by PODBot. May PODBot dll cause a problems with data stored by metamod engine or amx? Below is code of my script, I almost sure it's OK. #include <amxmod> /* balance numbers */ //new autoteamnum = 5 /* addbot switch for ensuring add a bot one time */ //new ctswitch = 0 new arePeople = -1 // all global to get less cpu usage new ip[17] new realplayers[32], aliveplayers[32], spectators[32] new realnum, real, alivenum, alivepeoplenum, spectatorsnum new i // checks if the player is bot or real player by ip and name on the same time public is_user_bot_by_ip (id) { get_user_ip (id, ip, 16, 1) if (equal (ip, "127.0.0.1", 9)) return 1 return 0 } /* balance adjust */ public auto_kill() { // chceking if we want to kill bots if (!get_cvar_num ("zabijaj_boty") return 0 // get all of the players, and then check how mach are real players get_players (realplayers, real) server_print ("Number of players: %d", real) realnum = real for (i = 0; i < real; i++) if (is_user_bot_by_ip (realplayers [i])) realnum-- // a means to don't return dead players, and then we check how much are real players get_players (aliveplayers, alivenum, "a") real = alivenum alivepeoplenum = real for (i = 0; i < real; i++) if (is_user_bot_by_ip (aliveplayers [i])) alivepeoplenum-- get_players (spectators, spectatorsnum, "e", "SPECTATOR") server_print ("REAL PLAYERS: %d", realnum) server_print ("SPECTATORS: %d", spectatorsnum) server_print ("ALIVE PEOPLE: %d", alivepeoplenum) // turn bots off if no people are on the server if (realnum && (arePeople == -1)) arePeople = 0 if (!realnum && (arePeople == -1)) arePeople = 1 if (!realnum && arePeople) { arePeople = 0 server_cmd ("pb removebots") return 0 // no other operations are required } if (realnum && !arePeople) { arePeople = 1 server_cmd ("pb fillserver") return 0 } /* killing bots, when all players are down */ if ((realnum - spectatorsnum > 0) && !alivepeoplenum) server_cmd ("pb killbots") return 0 } public plugin_init() { register_plugin("AutoKillBots","0.1","default") register_cvar ("zabijaj_boty", "1", FCVAR_SERVER | FCVAR_EXTDLL | FCVAR_UNLOGGED | FCVAR_SPONLY) set_task(10.0, "auto_kill", 0, "", 0, "b") return PLUGIN_CONTINUE } |
Errors of AMX modules after run a PODBots.
Errors of AMX modules after run a PODBots.
For example: [AMX] Error raised (module "???") (function "???") [AMX] Run time error 4 on line 634 (plugin "restmenu.amx") [AMX] Error raised (module "???") (function "???") [AMX] Run time error 4 on line 528 (plugin "miscstats.amx") Maybe this should help to solv a problem ? ;) |
Re: Problems with amount of bots.
Did You try to count number of alive human-players by get_players with "bc" flags? I mean like this:
get_players(realplayers,real,"bc") In this way You don't need to coundown from amount of all players bots by this function with checking their IP (there is also some native function in AMX is_user_bot(id) ). I know - AMX has some trouble with recognizing human-players/bots, but there is some beta available at AMX forum with fix for this problem. Use metamod at least 1.17.3. For the function auto_kill You probably should to use return PLUGIN_HANDLED instead return 0 (You should check it). Another thing is this - did You try to use auto add/kick bot function without AMX? I mean - 3 people joined server - 3 bots has to leave it. 2 people left the server - 2 bots enter it. If it doesn't work - it's a bug in bot dll then and the place You posted Your topic might be correct. About these run time errors - it's AMX reporting problem with its plugin - You should ask at AMX forum. Note - weapon restriction doesn't affect bots. It was discussed at this forum few months ago - use search function if You need to know more in this topic. BTW - change the cvar name from "zabijaj_boty" to "kill_bots"... :D |
I made some changes.
First, I get alivenum (I need it) and then check howmany are people alive, so this loop is ok I think.
Second, I don't recognize bots by is_get_user_bot_by_ip. It was replaced by is_user_bot. Third, I installed MetaMod v1.17.4, AMX v0.9.9a + dlls from v0.9.9b and zBot. I know now that's report problem to AMX ;), sorry. cvar name has changed ;) All now seems to be working correctly, but I think there are error I don't know. |
Code of my plugin:
#include <amxmod>
/* balance numbers */ new autoteamnum = 5 new arePeople = -1 /* balance adjust */ public balance_adjust() { // if we don't want to check bots at all if (!get_cvar_num ("boty")) return 0 new ctplayers[32], tplayers[32], realplayers[32], aliveplayers[32], spectators[32] new ctnum, tnum, dnum, realnum, alivenum, alivepeoplenum, spectatorsnum, i get_players(ctplayers,ctnum,"e","CT") get_players(tplayers,tnum,"e","TERRORIST") get_players(spectators, spectatorsnum, "e", "SPECTATOR") get_players(aliveplayers, alivenum, "a") get_players (realplayers, realnum, "c") alivepeoplenum = alivenum for (i = 0; i < alivenum; i++) if (is_user_bot (aliveplayers [i])) alivepeoplenum-- server_print ("[AutoBotKiller] Number of players: %d", get_playersnum ()) server_print ("[AutoBotKiller] REAL PLAYERS: %d", realnum) server_print ("[AutoBotKiller] SPECTATORS: %d", spectatorsnum) server_print ("[AutoBotKiller] ALIVE PEOPLE: %d", alivepeoplenum) server_print ("[AutoBotKiller] CT's: %d", ctnum) server_print ("[AutoBotKiller] T's: %d", tnum) // turn bots off if no people are on the server if (realnum && (arePeople == -1)) arePeople = 0 if (!realnum && (arePeople == -1)) arePeople = 1 if (!realnum && arePeople) { arePeople = 0 server_cmd ("bot_kick all") return 0 // no other operations are required } if (realnum && !arePeople) arePeople = 1 /* killing bots, when all players are down */ if (get_cvar_num ("kill_bots") && (realnum - spectatorsnum > 0) && !alivepeoplenum) { server_print ("[AutoBotKiller] Killing bots due to waiting players...") server_cmd ("bot_kill all") } /* kicking bots... */ if (ctnum > autoteamnum) { dnum = ctnum - autoteamnum for(new a = 0; a < ctnum; a++) { if (is_user_bot(ctplayers[a])) { new id = get_user_userid(ctplayers[a]) new quota = get_cvar_num ("bot_quota") set_cvar_num ("bot_quota", quota-1) server_print("[AutoBotKiller] kick a CT bot user %d to balance", id) server_cmd("kick #%d", id) dnum-- } if (dnum == 0) break } } if (tnum > autoteamnum) { dnum = tnum - autoteamnum for(new a = 0; a < tnum; a++) { if (is_user_bot(tplayers[a])) { new id = get_user_userid(tplayers[a]) new quota = get_cvar_num ("bot_quota") set_cvar_num ("bot_quota", quota-1) server_print("[AutoBotKiller] kick a T bot user %d to balance", id) server_cmd("kick #%d", id) dnum-- } if (dnum == 0) break } } /* adding bots */ if (realnum && ((ctnum < autoteamnum) || (tnum < autoteamnum))) { new howmuch = 2*autoteamnum - ctnum - tnum server_print("[AutoBotKiller] adding %d bots to balance...", howmuch) new switchvar if (ctnum < tnum) switchvar = 0 // first add to CT else switchvar = 1 // otherwise to T for (new a = 0; a < howmuch; a++) { if (switchvar) { server_print ("[AutoBotKiller] add a T bot to balance") server_cmd ("bot_add_t") } else { server_print ("[AutoBotKiller] add a CT bot to balance") server_cmd ("bot_add_ct") } switchvar = 1 - switchvar } } return PLUGIN_HANDLED } public plugin_init() { register_plugin("AutoBotsBalance","0.0.1","default ") register_cvar ("kill_bots", "1", FCVAR_SERVER | FCVAR_EXTDLL | FCVAR_UNLOGGED | FCVAR_SPONLY) register_cvar ("boty", "1", FCVAR_SERVER | FCVAR_EXTDLL | FCVAR_UNLOGGED | FCVAR_SPONLY) set_task(10.0, "balance_adjust", 0, "", 0, "b") return PLUGIN_CONTINUE } |
Re: Problems with amount of bots.
If You use "ac" together flags with get_players You will see how many alive players is on the server.
* Flags: * "a" - don't collect dead players. * "b" - don't collect alive players. * "c" - skip bots. * "d" - skip real players. * "e" - match with team. * "f" - match with part of name. * "g" - ignore case sensitivity. get_players(realplayers, alivenum, "ac") should gives You what You want (oh - maybe except spectators - dunno exactly - need test). But You didn't answer to my question about amount of bots without AMX - if it works OK (some people leave the server - the same amount of bots is added, some players eneter the server - the same number of bots leaves it). [EDIT] If You don't understand the question - I can ask also in Polish. :D [/EDIT] |
I lost my perception.
I don't understand for what question I didn't answer, but I think is that if number of bots are changing without my plugin?
No it isn't. In ZBots there is only one variable connected with it. It's bot_quota and means a const number of bots. If there will new players connect or other disconnect, the number of bots will be still the same. I think tread should be now deleted. (note for moderators) |
Re: Problems with amount of bots.
You started this topic with problems with amount of podbot on Your server. Then You changed Your bot to ZBOT. Note - ZBOT is illegal (it's hacked/cracked version of official CSBot . CSBot has been created to support CZERO, ZBOT has been hacked/cracked to support CS1.6 Steam.
A lot of people here got warned / baned asking only about ZBOT. Be careful then. :) |
Re: Problems with amount of bots.
I didn't know that ZBots are illegal. This means that I loose a lot of time to nothing :(
|
Re: Problems with amount of bots.
I don't have any replay message from Valve or Steam about ZBots, so I had deleted them.
I think topic should be also deleted. |
All times are GMT +2. The time now is 09:38. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.