Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin

Single Man Caps

by Vet · 2010-05-12 · 24 replies · 20084 views · 299 downloads

Read the thread (25 posts)

From the first post

UPDATED 6-27-10
rn
rnInspired by THIS THREAD, I wrote this plugin.
rn
rnThis plugin will change the number required to cap an area based on the number of players currently in the game. The number of players trigger is variable via CVar. The trigger has a 'deadband' of 2. In other words, if the trigger is set to 5, it takes 4 or less players to turn ON single caps, and then 6 or more players to turn it back OFF. Setting the trigger to 0 turns OFF the auto-detect.
rn
rnCVARs:
rnsingle_caps_trigger <#> (Number of players to trigger change - default 5, 0 = Disable)
rnsingle_caps_notify <0/1> (Display a message about the change? - default 1/ON)
rnsingle_caps_ignore_bots <0/1> (Don't count bots as players - default 0/Off)
rn
rnCommand:
rndod_single_caps Set the plugin's mode of operation.
rnIf ON, all caps are single, no matter what.
rnIf OFF, cap are reset to normal
rnIf AUTO (default), caps are dependent on trigger CVar
rn
rnRevisions:
rn1.6 Added ability to ignore bots
rn1.5 Fixed announce of single-caps when only single-caps existed
rn1.4 Original release
rn
rnThe plugin is set to check the number of players and set/reset cap areas every 60 seconds.
rn
rnUPDATED 6-27-10
rn-

Files

dod_singlecaps.sma Plugin Source 5 KB 294 dl Download Compile

Decompiled source reconstructed

dod_singlecaps.amxx was published compiled only. This Pawn was recovered from the bytecode with Lysis — 274 lines. Strings, cvars and the plugin registration survive; local variable names do not. It is an approximation, not the author's file.

// Decompiled from dod_singlecaps.amxx by Lysis.n// This is RECONSTRUCTED source, not the author's original: withoutn// debug symbols the variable names are lost and control flow isn// rebuilt from bytecode. Treat it as a readable approximation.nnnew g_capally[32];nnew g_capaxis[32];nnew g_capent[32];nnew g_capcnt;nnew g_ignbots;nnew g_captrig;nnew g_notify;nnew g_status;nnew g_maxpls;nis_user_admin(id)n{n	new __flags = get_user_flags(id, "%L");n	new var1;n	return __flags > 0 && !__flags & 33554432;n}nncmd_access(id, level, cid, num, bool:accesssilent)n{n	new has_access;n	new var1;n	if (is_dedicated_server())n	{n		var1 = 0;n	}n	elsen	{n		var1 = 1;n	}n	if (var1 == id)n	{n		has_access = 1;n	}n	elsen	{n		if (level == 16777216)n		{n			if (is_user_admin(id))n			{n				has_access = 1;n			}n		}n		if (level & get_user_flags(id, "%L"))n		{n			has_access = 1;n		}n		if (!level)n		{n			has_access = 1;n		}n	}n	if (has_access)n	{n		if (num > read_argc())n		{n			new hcmd[32];n			new hinfo[128];n			new hflag;n			get_concmd(cid, hcmd, 31, hflag, hinfo, 127, level, -1);n			console_print(id, "%L:  %s %s", id, "USAGE", hcmd, hinfo);n			return 0;n		}n		return 1;n	}n	if (!accesssilent)n	{n		console_print(id, "%L", id, "NO_ACC_COM");n	}n	return 0;n}nnpublic plugin_precache()n{n	register_forward(96, "forward_keyvalue", "%L");n	return 0;n}nnpublic plugin_init()n{n	register_plugin("DOD_SingleCaps", "1.6", "Vet(3TT3V)");n	register_cvar("DOD_SingleCaps", "v1.6 by Vet(3TT3V)", 68, "%L");n	register_clcmd("dod_single_caps", "cmdSingleCaps", 32, "<on|off|auto> Change caps mode", -1);n	g_captrig = register_cvar("single_caps_trigger", 1180, "%L", "%L");n	g_notify = register_cvar("single_caps_notify", 1264, "%L", "%L");n	g_ignbots = register_cvar("single_caps_ignore_bots", 1368, "%L", "%L");n	g_maxpls = get_maxplayers() + 1;n	if (g_capcnt)n	{n		set_task(1114636288, "ck_player_num", 707, 1432, "%L", 1436, "%L");n	}n	return 0;n}nnpublic forward_keyvalue(ent, handle)n{n	static tmpint;n	static keyvalue[8];n	static keyname[32];n	if (!pev_valid(ent))n	{n		return 1;n	}n	get_kvd(handle, 1, keyname, 31);n	if (keyname[0] != 97)n	{n		return 1;n	}n	if (equali(keyname, "area_allies_numcap", "%L"))n	{n		get_kvd(handle, 2, keyvalue, 7);n		tmpint = str_to_num(keyvalue);n		if (tmpint > 1)n		{n			g_capally[g_capcnt] = tmpint;n			g_capent[g_capcnt] = ent;n			g_capcnt += 1;n		}n	}n	elsen	{n		if (equali(keyname, "area_axis_numcap", "%L"))n		{n			get_kvd(handle, 2, keyvalue, 7);n			tmpint = str_to_num(keyvalue);n			if (tmpint > 1)n			{n				g_capaxis[g_capcnt] = tmpint;n				g_capent[g_capcnt] = ent;n				g_capcnt += 1;n			}n		}n	}n	return 1;n}nnpublic ck_player_num()n{n	static i;n	static b_num;n	static t_num;n	static p_num;n	t_num = get_pcvar_num(g_captrig);n	if (t_num)n	{n		p_num = get_playersnum(1);n		if (get_pcvar_num(g_ignbots))n		{n			b_num = 0;n			i = 1;n			while (i < g_maxpls)n			{n				if (is_user_bot(i))n				{n					b_num += 1;n				}n				i += 1;n			}n			p_num = p_num - b_num;n		}n		new var1;n		if (p_num > t_num && g_status)n		{n			normal_caps();n		}n		new var2;n		if (p_num < t_num && !g_status)n		{n			single_caps();n		}n	}n	return 0;n}nnpublic cmdSingleCaps(id, lvl, cid)n{n	new data1[8];n	if (cmd_access(id, lvl, cid, 2, false))n	{n		read_argv(1, data1, 7);n		switch (data1[1])n		{n			case 70, 102:n			{n				remove_task(707, "%L");n				normal_caps();n				console_print(id, "DOD SingleCaps set to OFF");n			}n			case 78, 110:n			{n				remove_task(707, "%L");n				single_caps();n				console_print(id, "DOD SingleCaps set to ON");n			}n			case 85, 117:n			{n				ck_player_num();n				if (!task_exists(707, "%L"))n				{n					set_task(1114636288, "ck_player_num", 707, 2028, "%L", 2032, "%L");n				}n				console_print(id, "DOD SingleCaps set to AUTO");n			}n			default:n			{n			}n		}n	}n	return 1;n}nnsingle_caps()n{n	new i;n	while (i < g_capcnt)n	{n		if (g_capally[i])n		{n			fm_set_kvd(g_capent[i], "area_allies_numcap", 2224, "dod_capture_area");n		}n		elsen		{n			fm_set_kvd(g_capent[i], "area_axis_numcap", 2368, "dod_capture_area");n		}n		i++;n	}n	g_status = 1;n	if (get_pcvar_num(g_notify))n	{n		set_hudmessage(255, 128, 255, -1082130432, 1053609165, "%L", 1082130432, 1084227584, 1056964608, 1041865114, 4);n		show_hudmessage("%L", "Single-man cap areas Enabled");n	}n	return 0;n}nnnormal_caps()n{n	new tmpstr[8];n	new i;n	while (i < g_capcnt)n	{n		if (g_capally[i])n		{n			formatex(tmpstr, 7, "%d", g_capally[i]);n			fm_set_kvd(g_capent[i], "area_allies_numcap", tmpstr, "dod_capture_area");n		}n		elsen		{n			formatex(tmpstr, 7, "%d", g_capaxis[i]);n			fm_set_kvd(g_capent[i], "area_axis_numcap", tmpstr, "dod_capture_area");n		}n		i++;n	}n	g_status = 0;n	if (get_pcvar_num(g_notify))n	{n		set_hudmessage(255, 128, 255, -1082130432, 1053609165, "%L", 1082130432, 1084227584, 1056964608, 1041865114, 4);n		show_hudmessage("%L", "Cap areas have been Reset");n	}n	return 0;n}nnfm_set_kvd(entity, key[], value[], class[])n{n	set_kvd("%L", "%L", class);n	set_kvd("%L", 1, key);n	set_kvd("%L", 2, value);n	set_kvd("%L", 3, 0);n	return dllfunc(6, entity, 0);n}nn

Added later in the thread

dod_singlecaps.amxx Compiled Plugin 8 KB 5 dl Download

The thread

All 25 posts from 9 people on Single Man Caps, kept as they were written.

Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
05-12-2010, 12:09 AM #1

UPDATED 6-27-10rnrnInspired by THIS THREAD, I wrote this plugin.rnrnThis plugin will change the number required to cap an area based on the number of players currently in the game. The number of players trigger is variable via CVar. The trigger has a 'deadband' of 2. In other words, if the trigger is set to 5, it takes 4 or less players to turn ON single caps, and then 6 or more players to turn it back OFF. Setting the trigger to 0 turns OFF the auto-detect.rnrnCVARs:rnsingle_caps_trigger <#> (Number of players to trigger change - default 5, 0 = Disable)rnsingle_caps_notify <0/1> (Display a message about the change? - default 1/ON)rnsingle_caps_ignore_bots <0/1> (Don't count bots as players - default 0/Off)rnrnCommand:rndod_single_caps <on|off|auto> Set the plugin's mode of operation.rnIf ON, all caps are single, no matter what.rnIf OFF, cap are reset to normalrnIf AUTO (default), caps are dependent on trigger CVarrnrnRevisions:rn1.6 Added ability to ignore botsrn1.5 Fixed announce of single-caps when only single-caps existedrn1.4 Original releasernrnThe plugin is set to check the number of players and set/reset cap areas every 60 seconds.rnrnUPDATED 6-27-10rn-

F Fysiks
posted here
Posts: 108
Threads: 3
Joined: Aug 2007
05-12-2010, 02:43 AM #2

Cool!rnrnformat() ==> formatex()

=*MDMILBURN*=
posted here
Posts: 66
Threads: 11
Joined: Jun 2008
05-16-2010, 12:19 AM #3

any way to add ignore bots? many maps don't have good way points if at all

Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
05-26-2010, 07:49 PM #4

Recommended update. See first post.

B bozdw
posted here
Posts: 23
Threads: 4
Joined: Jul 2009
06-18-2010, 09:34 AM #5

hirnnice pluginrni have just tried it works wellrnrnis there any way i can ignore the bots because i have 6 bots, one real player on! one bot off! so always six players , so i set it to auto caps 5 players but with the bots it wont work rnthanks boz

Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
06-18-2010, 07:53 PM #6

The plugin could be modified to ignore bots, but I'm afraid of the overhead (in extra code) required to check for them. But I'll look into it.

B bozdw
posted here
Posts: 23
Threads: 4
Joined: Jul 2009
06-19-2010, 04:12 AM #7

ok many thanks

Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
06-27-2010, 07:35 PM #8

Plugin updated to allow it to ignore bots. I was not able to do extensive testing so let me know if there's a problem.

B bozdw
posted here
Posts: 23
Threads: 4
Joined: Jul 2009
06-29-2010, 09:39 AM #9

fantastic i will give it a try

B bozdw
posted here
Posts: 23
Threads: 4
Joined: Jul 2009
07-02-2010, 06:04 AM #10

It seems to working very well nmany thanks boz ;)

=*MDMILBURN*=
posted here
Posts: 66
Threads: 11
Joined: Jun 2008
07-11-2010, 01:51 PM #11

from what i have seen it still includes the bots and i think the notify of the plug is not happening when i turn off bots the plug works and if another player then joins the notify works stating that the caps have been reset and that is the only notification i see

B bozdw
posted here
Posts: 23
Threads: 4
Joined: Jul 2009
07-12-2010, 06:40 AM #12

hinive had it on the server for some time now i have 6 bots running and it works fine telling me single caps enabled (takes about 60 seconds to enable after each map change) then when i have 4 real players it says single caps disabled or something like that nworks a treat and there is some happy players who have commented on itnnit could be thisndod_single_caps <on|off|auto> Set the plugin's mode of operation. STICK IT ON AUTO

Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
07-12-2010, 09:30 AM #13

The option to ignore the bots is OFF by default. Be sure to include the CVar in a config file.

RichNagel
posted here
Posts: 49
Threads: 8
Joined: Jan 2012
02-01-2012, 07:57 AM #14

Sorry to dig up this old thread.rnrnI occasionally run a lowly listen server for me and my buddies to play on, along with SturmBots. I also play a LOT of "single-player" (if you could call it that) by starting a listen server, and then playing along with the SturmBots.rnrnI recently installed a bare-bones version of AMXModX, along with this plugin -> https://www.dodplugins.net/forums/showthread.php?t=753 (a modified version of this plugin -> https://www.dodplugins.net/forums/showthread.php?t=294)... as well as the Single Man Caps plugin.rnrnI am able to set all of the CVars, but anytime I attempt to change the plugin's operating mode like this:rnrndod_single_caps onrndod_single_capsoffrndod_single_capsautornrn...I see the error message "Can't set DOD_SingleCaps in multiplayer".rnrnNow, I'm no coder by ANY sense of the term, but I changed the following in the source (and then recompiled the plugin):rnrn"FCVAR_SPONLY" (I removed that entry)rnrn"ADMIN_MAP" (I changed to "ADMIN_ALL")rnrnNow, I don't see that "Can't set DOD_SingleCaps in multiplayer" message anymore, but it doesn't appear that the "dod_single_caps on/off/auto" is doing anything... but rather staying in "auto" mode.rnrnI am able to enable and disable it simply by setting "single_caps_trigger" to an extremely high number (which is sort of like "on" for the "dod_single_caps" command), or to a low number like "1" (which is sort of like "off" for the "dod_single_caps" command), but it would be super if the actual "dod_single_caps" console command would work for me :)rnrnAnyhow, I was simply wondering if anyone knew what could cause this. I have a hunch that it has something to do with the "(cmd_access(id, lvl, cid, 2))" part of the source, but I really have know idea.

Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
02-02-2012, 10:29 AM #15

Do other Amxmodx commands work the way their suppose to? I run this plugin a lot with Shrikebot and the commands all work just fine.

RichNagel
posted here
Posts: 49
Threads: 8
Joined: Jan 2012
02-09-2012, 02:04 PM #16
Do other Amxmodx commands work the way their suppose to? I run this plugin a lot with Shrikebot and the commands all work just fine.
rnrnSorry for the (sort of) late reply... for some reason the forum didn't send me a notification email :(rnrnAnyhow, yes, all other AMX Mod X commands work just fine.rnrnI recently went ahead and installed the entire AMX Mod X and DoD plugin packages, and all seems to be working OK. The only problem is the one I described above.rnrnLike I posted, I can do a similar thing simply by setting the "single_caps_trigger" to a real high or low number, but it would be nice if the dod_single_caps on/of/auto options functioned :)

Gary_m
posted here
Posts: 38
Threads: 3
Joined: Feb 2010
03-27-2013, 03:47 PM #17

Have just installed this pluginrnrnWorks great, and really handy when only a few players on.rnrnCan kick off the bots and play a 1v1 2v2 3v3 etc and makes it easier to cap the multi player capsrnrnGood work :)

dimon1052
posted here
Posts: 65
Threads: 15
Joined: Sep 2012
12-23-2016, 06:41 AM #18

Absolutely brilliant! Fantastic job!

{ {HK}recon'de'sprayer
posted here
Posts: 23
Threads: 1
Joined: Sep 2006
12-12-2019, 04:05 AM #19

I downloaded the dod_singlecaps.sma and tried to compile it and got this message.rnrnYour plugin failed to compile! Read the errors below:rnrnWelcome to the AMX Mod X 1.8.1-300 Compiler.rnCopyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Teamrnrn/tmp/textxoCfiz.sma(1) : error 013: no entry point (no public functions)rnrn1 Error.rnCould not locate output file /home/groups/amxmodx/public_html/websc3/textxoCfiz.amx (compile failed).rnrnrnAny help would be appreciated.

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
12-14-2019, 03:22 PM #20
I downloaded the dod_singlecaps.sma and tried to compile it and got this message......
rnrnCompiles fine for me...

{ {HK}recon'de'sprayer
posted here
Posts: 23
Threads: 1
Joined: Sep 2006
12-22-2019, 03:13 AM #21
Compiles fine for me...
rnrnTried it again still won't compile. Would you send me the .amxx file? The compiler doesn't work for me. Thanks in advance. My email is pruitt99@yahoo.com

{ {HK}recon'de'sprayer
posted here
Posts: 23
Threads: 1
Joined: Sep 2006
12-22-2019, 03:38 AM #22

I used the compiler on AMX X site and this is what I got.nnnYour plugin failed to compile! Read the errors below:nnWelcome to the AMX Mod X 1.8.1-300 Compiler.nCopyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Teamnn/tmp/textTqEGY6.sma(1) : error 013: no entry point (no public functions)nn1 Error.nCould not locate output file /home/groups/amxmodx/public_html/websc3/textTqEGY6.amx (compile failed)nnnAny help would be appreciated.

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
01-01-2020, 01:51 PM #23

the AMXX site compiler doesnt let me upload the sma file to compile (tells me its not a valid file), but if I copy the code from the sma into the text box and compile that way it works fine.rnrnIt also works fine compiling it locally for me as well..rnrnhere's the .amxx file from the AMXX website compiler (which is pretty outdated anyway @ v1.8.1). I would suggest trying to compile it locally and with the compiler for the same version of AMXX that you run on your server. Plus it's always safer to compile it yourself anyway.. do you trust me? haha :P

{ {HK}recon'de'sprayer
posted here
Posts: 23
Threads: 1
Joined: Sep 2006
02-21-2020, 11:54 PM #24

We run 1.8.2, where would I find the compiler for that version?

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
02-23-2020, 04:19 PM #25

the compiler is included with the standard amxx downloads (in the scripting folder):rnrn1.8.2 base files (win): https://www.amxmodx.org/release/amxmodx-1.8.2-base-windows.ziprn1.8.2 base files (linux): https://www.amxmodx.org/release/amxmodx-1.8.2-base-linux.tar.gzrnrn1.8.2 dod files (win): https://www.amxmodx.org/release/amxmodx-1.8.2-dod-windows.ziprn1.8.2 dod files (linux): https://www.amxmodx.org/release/amxmodx-1.8.2-dod-linux.tar.gz

DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC