AlliedModders Donor
|
11-16-2018
, 18:23
Re: [CSGO] bot quota fix
|
#7
|
Quote:
Originally Posted by Bacardi
First for all, I'm not sure what kind game mode or mods/plugins you are using.
This is about CS:GO own respawn system, not SM plugins.
Finally I found problem. (maybe somone already did before me :s )
In CS:GO, it have wierd system. (I had no time to check other games for now...)
- When in game respawn system is active, you see it when you jointeam between teams, you respawn immediatelly, there is now freeze/death cam animation.
Server is using bot_add_ct/ bot_add_t commands related to -> player jointeam command! *Valve need fix this.
- When server use bot commands, of course cvar bot_quota change amount automatically. This give also problems.
Anyway, bots which not leave or join after 30 sec round_start is game own feature. It's normal.
This can be "fixed" by plugin.
I leave my unfinished test plugin code.
I didn't have anymore time to make plugin, because that "bug" take so long. I need to go work.
- So this plugin will block server commands bot_add_ct/bot_add_t which happen in same time with player jointeam command.
- And everytime human player change team (player_team), it check and change amount bots in game based bot_quota amount.
- And it try fix bot_quota back normal
-- Some point there could be one bot too much, but I look it another time. (Anyone if free to make own versio of this.)
Spoiler
PHP Code:
/* Server event "player_team", Tick 62954: - "userid" = "18" - "team" = "3" - "oldteam" = "0" - "disconnect" = "0" - "autoteam" = "0" - "silent" = "0" - "name" = "Bacardi" */
/* First 30sec after round_start, bots join/leave automatically. Then they are hold end of round_end. (CS:GO) In game respawn system, server bot_add_t, bot_add_ct commands are related player jointeam command! */
ConVar bot_quota;
float timestamp; Handle timer_bot_quota_fix;
public void OnPluginStart() { bot_quota = FindConVar("bot_quota");
//HookConVarChange(bot_quota, cvar_bot_quota_change);
HookEvent("round_start", rounds); HookEvent("round_end", rounds); HookEvent("player_team", player_team);
AddCommandListener(CommandListener, "bot_add_ct"); AddCommandListener(CommandListener, "bot_add_t"); AddCommandListener(CommandListener, "jointeam"); }
public void cvar_bot_quota_change(ConVar convar, const char[] oldValue, const char[] newValue) { //PrintToServer(" %-3f cvar_bot_quota_change %s -> %s (%i) : %i", GetGameTime(), oldValue, newValue, bot_quota.IntValue, GetGameTickCount()); }
public Action CommandListener(int client, const char[] command, int argc) { static int jointeam_timestamp;
if(client != 0) { jointeam_timestamp = GetGameTickCount() + 1; return Plugin_Continue; }
if(argc <= 0 && jointeam_timestamp == GetGameTickCount()) { //PrintToServer(" %-3f command %s argc %i BLOCK! :%i jointeam_timestamp %i", GetGameTime(), command, argc, GetGameTickCount(), jointeam_timestamp); return Plugin_Handled; }
return Plugin_Continue; }
public void rounds(Event event, const char[] name, bool dontBroadcast) { timestamp = GetGameTime(); }
public void player_team(Event event, const char[] name, bool dontBroadcast) { // This player_team event happens before player have moved to new team. //PrintToServer(" %-3f player_team #%i disconnect %i : %i - ", GetGameTime(), event.GetInt("userid"), event.GetInt("disconnect"), GetGameTickCount()); //return;
// First 31 sec bots act automatically if(timestamp + 31.0 > GetGameTime()) { //PrintToServer(" %-3f ", timestamp + 31.0 - GetGameTime()); return; }
int client = GetClientOfUserId(event.GetInt("userid"));
// ignore bots if(IsFakeClient(client)) return;
int newteam = event.GetInt("team"); int oldteam = event.GetInt("oldteam");
int players; int bots[MAXPLAYERS]; int bot_count;
for(int i = 1; i <= MaxClients; i++) { if(!IsClientInGame(i) || GetClientTeam(i) <= 1) continue;
players++;
if(IsFakeClient(i)) bots[bot_count++] = GetClientUserId(i); }
players -= bot_quota.IntValue;
// player enter in team if(oldteam <= 1 && newteam >= 2) { players++; } // player enter in spec else if(oldteam >= 2 && newteam <= 1) { players--; }
//PrintToServer("players %i bot_count %i", players, bot_count); // right amount players or there is more players than bot_quota and no more bots on field to kick if(players == 0 || players > 0 && bot_count <= 0) { return; }
//PrintToServer("players %i", players); //
for( ; players > 0 || players < 0; players < 0 ? players++:players--) { //PrintToServer("players %i", players); if(players < 0) { ServerCommand("bot_add");
if(timer_bot_quota_fix == null) timer_bot_quota_fix = CreateTimer(0.6, delay_bot_quota_fix, bot_quota.IntValue); } if(players > 0 && bot_count > 0) { ServerCommand("kickid %i", bots[--bot_count]); } }
}
public Action delay_bot_quota_fix(Handle timer, any bot_quota_fix) { timer_bot_quota_fix = null;
//PrintToServer(" %-3f bot_quota_fix %i", GetGameTime(), bot_quota_fix); bot_quota.SetInt(bot_quota_fix, true, true); }
*edit
I forgot mention. In CSGO respawn system, player fast respawn is also buggy, player can respawn in enemy base sometimes.
I couldn't find any cooldown/delay setting for player attempt to spam jointeam and respawn rapidly. With plugin this can be "fix". (Valve need fix this also)
|
Im running CSGO Deathmatch Advanced with latest dev SM/MM.
So with this I need to set bot_quota right? with the others it was set to 0.
EDIT
Im not sure its working. I have bot_quota 10 + 1 GOTV and a player joined:
Result:
1 GOTV
10 bots
1 player
Expected result:
1 GOTV
9 bots
1 player
Last edited by Ejziponken; 11-16-2018 at 18:43.
|
|