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

dod_weaponcontrol

by Hood [10th MD] · 2007-02-26 · 12 replies · 16501 views · 135 downloads

Read the thread (13 posts)

From the first post

Ok, Updated to v 1.2
nHas been fully tested (all features) on my own server.
nNow uses client disconnect and team messages as the events to check the restrictions.
nAlso, now uses pcvars, and includes new cvars for your convenience.
n
nNote: This plugin controls weapon limits for snipers and MGs by # of people in the server not percentages, etc. (like dod_limit)
n
nCvars:
ndod_wc_num <#> - # of people in server for sniper/mg to be allowed
ndod_wc_snipers <#> - # of snipers to allow per team (when correct # in server)
ndod_wc_mgs <#> - # of mgs to allow per team (when correct # in server)
ndod_wc_britheavy <1/0> - defines whether (1) or not (0) the Bren is considered an MG. If 0, the plugin ignores Bren, if 1, treats like MG.
n
nCommands:
ndod_wc_on <#> - sets # of people in server for weapons allowed, runs the check.
ndod_wc_check - runs check manually to adjust cvars, if you edit your settings middle game, and no one is going to connect or join, this will automatically adjust the cvars.
n
nTo Do: Resolve what happens when snipers allowed goes from 1 to 2 but already have 2 snipers - need to kick the person doing the worst from sniper. That'll be v 1.2
n
nThanks all.

Files

dod_weaponcontrol.sma Plugin Source 4 KB 135 dl Download Compile

The thread

All 13 posts from 6 people on dod_weaponcontrol, kept as they were written.

H Hood [10th MD]
started this thread
Posts: 84
Threads: 7
Joined: Nov 2006
02-26-2007, 02:38 AM #1

Ok, Updated to v 1.2nHas been fully tested (all features) on my own server.nNow uses client disconnect and team messages as the events to check the restrictions.nAlso, now uses pcvars, and includes new cvars for your convenience.nnNote: This plugin controls weapon limits for snipers and MGs by # of people in the server not percentages, etc. (like dod_limit)nnCvars:ndod_wc_num <#> - # of people in server for sniper/mg to be allowedndod_wc_snipers <#> - # of snipers to allow per team (when correct # in server)ndod_wc_mgs <#> - # of mgs to allow per team (when correct # in server)ndod_wc_britheavy <1/0> - defines whether (1) or not (0) the Bren is considered an MG. If 0, the plugin ignores Bren, if 1, treats like MG.nnCommands:ndod_wc_on <#> - sets # of people in server for weapons allowed, runs the check.ndod_wc_check - runs check manually to adjust cvars, if you edit your settings middle game, and no one is going to connect or join, this will automatically adjust the cvars.nnTo Do: Resolve what happens when snipers allowed goes from 1 to 2 but already have 2 snipers - need to kick the person doing the worst from sniper. That'll be v 1.2nnThanks all.

K Kiel |17.SS|
posted here
Posts: 163
Threads: 12
Joined: Jul 2006
02-26-2007, 10:31 PM #2

I've seen that here before. I've never used it though. But now that I see it again, maybe I should give it a try.

Wilson [29th ID]
posted here
Posts: 623
Threads: 57
Joined: Oct 2005
02-27-2007, 12:48 AM #3

I believe this is covered in dod_limits by Zor ?rnhttps://www.dodplugins.net/forums/showthread.php?t=7

K Kiel |17.SS|
posted here
Posts: 163
Threads: 12
Joined: Jul 2006
02-27-2007, 02:00 AM #4

Ah yeah thats right. But Zor's plugin lets you limit all the weapons, not just those few.

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
02-27-2007, 11:55 AM #5

not sure how this one works exactly..nnbut im pretty sure with zor's its a percentage thing.. and one thing i didnt like with zors was you couldnt specifiy more then one limit for a single class (like say a limit at 25% full and another at 50% full) ..you could only have one.. plus the whole percentage thing lol was throwing me off when i tried his..nnnand technically.. i guess you could do this same thing with zor's but i think this one is alot more simple for people who just want to turn off sniper/mg till a certain player count and not have to deal with config files and whatnot...nn__________________________________________________________n *edit*nnalso you should fix the compile warning...n

Warning: Function "checklimit" should return a value on line 100
using a pcvar as well would be smart...nnand also.. by having it check the player count on team join, you can have a problem were if a bunch of ppl leave and your no longer above the cvar value of players.. that it doesnt change the limits untill someone joins/switches team... so i would suggest also putting in a check on client_disconnect.. or maybe just get rid of it checking on team join and have it check on putinserver & disconnect..nnand youve also hard coded the limits like such:n
if(plrs>=get_cvar_num("dod_wc_num"))n    {n        set_cvar_num("mp_limitalliesspring",1)n        set_cvar_num("mp_limitallies30cal",1)n        set_cvar_num("mp_limitaxisscopedkar",1)n        set_cvar_num("mp_limitaxismg42",1)n        set_cvar_num("mp_limitaxismg34",1)n        set_cvar_num("mp_limitbritsniper",1)n        set_cvar_num("mp_limitbritmg",1)n    }
i would say either make seperate cvars to let ppl set how many of each when the player count is high enough.. or maybe have it save the default values from the server as variables on say... plugin config or suchnnmaybe even cvars to control which classes it affects.. like say someone wants only mgs and not snipers... or say they dont want the bren to be included.. etc.. each person shouldnt really have to go in and modify the code itself to config it for their server...

H Hood [10th MD]
started this thread
Posts: 84
Threads: 7
Joined: Nov 2006
02-28-2007, 12:57 AM #6

I'll work on those things and update it...nnAnd yeah, it's similar to limit, but i wanted it to be non-percentage based, and non-map specific.nPlus the one great thing is if you change the limit, it will go force people out of sniper or MG classes.nnIt's not really general use ready yet, obviously, but I like it a lot, thought some others might want a similar thing.nnWill update when done.

H Hood [10th MD]
started this thread
Posts: 84
Threads: 7
Joined: Nov 2006
02-28-2007, 02:10 AM #7

*Super Updated*rnrnFeedback at all?

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
02-28-2007, 08:09 PM #8

theres a much better way then using these:n

register_event("TextMsg", "checklimit", "a", "1=3", "2=#game_disconnected")nregister_event("TextMsg", "checklimit", "a", "1=3", "2=#game_joined_game")
try:n
public client_putinserver(id)n{nn// yada yadann}
ANDn
public client_disconnect(id)n{nn// yada yadann}n
tho the TxtMsg probably works fine.. there can be problems where sometimes they arent called when someone joins/leave (especially if the server is also running a plugin that blocks those msgs)nn:D

H Hood [10th MD]
started this thread
Posts: 84
Threads: 7
Joined: Nov 2006
03-01-2007, 09:16 PM #9

True enough.nOk, I've change it so that it runs the checklimit when those functions are called.nnI think however, I will change the connect one back to catching the team join messages, because if players go spectate or don't join a team, I want to exclude them from the counts.nnOk... updated source + amxx.nnNow uses client_disconnect to check disconnect, catches the team join messages, and now includes a loop to subtract from the player count if player is a spectator (more efficient way to do this?)

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
03-02-2007, 12:46 AM #10

..i dont think you attached the new version..

H Hood [10th MD]
started this thread
Posts: 84
Threads: 7
Joined: Nov 2006
03-02-2007, 01:52 AM #11

Oi. did now!

B bonjour
posted here
Posts: 8
Threads: 1
Joined: Mar 2016
02-19-2017, 09:57 PM #12

Hello, sometimes the bazooka disappears from the list of weapons, is it possible that it is the fault of the plugin?

F Fysiks
posted here
Posts: 108
Threads: 3
Joined: Aug 2007
02-25-2017, 01:16 AM #13

The plugin doesn't do anything with the bazooka. It manipulates the following cvars:nnmp_limitalliesspringnmp_limitallies30calnmp_limitaxisscopedkarnmp_limitaxismg42nmp_limitaxismg34nmp_limitbritsnipernmp_limitbritmg

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