# HG changeset patch # User David Anderson # Date 1182816234 0 # Node ID 3f35cdcf69550b3f1db48514849c8d1a1644cecb # Parent f3fedcdb9bd469f714f52c1f45b11dea7d16dd72 - fixed up plugin headers a tiny bit - added the ol' join advertisement back in - added bot quota plugin in diff -r f3fedcdb9bd4 -r 3f35cdcf6955 cfg/cssdm.cfg --- a/cfg/cssdm.cfg Mon Jun 25 23:43:20 2007 +0000 +++ b/cfg/cssdm.cfg Tue Jun 26 00:03:54 2007 +0000 @@ -96,3 +96,13 @@ // Requires: dm_basics.smx // Default: "1" cssdm_refill_ammo "1" + +// Sets how many bots CS:S DM keeps in game. Use this instead +// of bot_quota for managing bots. +// bot_quota should be "0" +// bot_quota_mode should be "normal" +// bot_auto_vacate should be "0" +// -- +// Requires: dm_bot_quotas.smx +// Default: "0" +cssdm_bots_balance "0" \ No newline at end of file diff -r f3fedcdb9bd4 -r 3f35cdcf6955 changelog.txt --- a/changelog.txt Mon Jun 25 23:43:20 2007 +0000 +++ b/changelog.txt Tue Jun 26 00:03:54 2007 +0000 @@ -21,6 +21,7 @@ - Added a "Random Weapons" feature to the weapon menus. - Removed the grenade and armor menus. - Added a new interactive spawn point editor ("cssdm_spawn_menu"). + - Added a plugin to manage bot_quota correctly. - Removed cssdm_addspawn. - Improved bot support for automatic items. - Fixed a bug where C4 would be removed when CS:S DM was disabled. diff -r f3fedcdb9bd4 -r 3f35cdcf6955 scripting/dm_basics.sp --- a/scripting/dm_basics.sp Mon Jun 25 23:43:20 2007 +0000 +++ b/scripting/dm_basics.sp Tue Jun 26 00:03:54 2007 +0000 @@ -2,6 +2,7 @@ * dm_basics.sp * Base CS:S DM admin/control functions. * This file is part of CS:S DM, Copyright (C) 2005-2007 AlliedModders LLC + * by David "BAILOPAN" Anderson, http://www.bailopan.net/cssdm/ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -205,9 +206,25 @@ return Plugin_Stop; } +public Action:Timer_Welcome(Handle:timer, any:userid) +{ + new client = GetClientOfUserId(userid); + + if (!client || !IsClientInGame(client)) + { + return Plugin_Stop; + } + + PrintToChat(client, "[CSSDM] Counter-Strike Source: Deathmatch (version %s)", CSSDM_VERSION); + PrintToChat(client, "[CSSDM] Visit http://www.bailopan.net/cssdm/ to download."); + + return Plugin_Stop; +} + public OnClientPutInServer(client) { g_DeathTimes[client] = 0.0; + CreateTimer(10.0, Timer_Welcome, GetClientUserId(client)); } public Action:DM_OnClientDeath(client) diff -r f3fedcdb9bd4 -r 3f35cdcf6955 scripting/dm_bot_quotas.sp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripting/dm_bot_quotas.sp Tue Jun 26 00:03:54 2007 +0000 @@ -0,0 +1,97 @@ +/** + * dm_bot_quotas.sp + * Adds bot quota correction to CS:S DM. + * This file is part of CS:S DM, Copyright (C) 2005-2007 AlliedModders LLC + * by David "BAILOPAN" Anderson, http://www.bailopan.net/cssdm/ + * + * 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. + * + * Version: $Id$ + */ + + +#include + +public Plugin:myinfo = +{ + name = "CS:S DM Bot Quotas", + author = "BAILOPAN", + description = "Bot Quota Correction for CS:S DM", + version = "2.0.0.0", + url = "http://www.bailopan.net/cssdm/" +} + +/* CS:S ConVars */ +new Handle:BotQuota = INVALID_HANDLE + +/* Our ConVars */ +new Handle:BalanceAmt = INVALID_HANDLE + +public OnPluginStart() +{ + /* Find CS:S ConVars */ + BotQuota = FindConVar("bot_quota") + + /* Create our ConVars */ + BalanceAmt = CreateConVar("cssdm_bots_balance", "0", "Minimum number of players (bot_quota)") + HookConVarChange(BalanceAmt, OnBalanceChange) +} + +public OnBalanceChange(Handle:convar, const String:oldval[], const String:newval[]) +{ + BalanceBots(StringToInt(newval)) +} + +BalanceBots(quota) +{ + new maxClients = GetMaxClients() + new humans, bots + + /* Get the number of valid humans and bots */ + for (new i=1; i<=maxClients; i++) + { + if (!IsPlayerInGame(i)) + { + continue + } + if (!IsFakeClient(i)) + { + humans++ + } else { + bots++ + } + } + + /* Get the number of bots needed to fill quota */ + if (quota < humans) + { + quota = 0 + } else { + quota -= humans + } + + /* Now, set the new value */ + SetConVarInt(BotQuota, quota) +} + +public OnClientPutInServer(client) +{ + BalanceBots(GetConVarInt(BalanceAmt)) +} + +public OnClientDisconnect_Post(client) +{ + BalanceBots(GetConVarInt(BalanceAmt)) +} diff -r f3fedcdb9bd4 -r 3f35cdcf6955 scripting/dm_equipment.sp --- a/scripting/dm_equipment.sp Mon Jun 25 23:43:20 2007 +0000 +++ b/scripting/dm_equipment.sp Tue Jun 26 00:03:54 2007 +0000 @@ -2,6 +2,7 @@ * dm_equipment.sp * Adds preset spawning to CS:S DM. * This file is part of CS:S DM, Copyright (C) 2005-2007 AlliedModders LLC + * by David "BAILOPAN" Anderson, http://www.bailopan.net/cssdm/ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff -r f3fedcdb9bd4 -r 3f35cdcf6955 scripting/dm_spawn_protection.sp --- a/scripting/dm_spawn_protection.sp Mon Jun 25 23:43:20 2007 +0000 +++ b/scripting/dm_spawn_protection.sp Tue Jun 26 00:03:54 2007 +0000 @@ -2,6 +2,7 @@ * dm_spawn_protection.sp * Adds spawn protection to CS:S DM. * This file is part of CS:S DM, Copyright (C) 2005-2007 AlliedModders LLC + * by David "BAILOPAN" Anderson, http://www.bailopan.net/cssdm/ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License