PDA

View Full Version : dod_weaponcontrol


Hood [10th MD]
02-26-2007, 02:38 AM
Ok, Updated to v 1.2
Has been fully tested (all features) on my own server.
Now uses client disconnect and team messages as the events to check the restrictions.
Also, now uses pcvars, and includes new cvars for your convenience.

Note: This plugin controls weapon limits for snipers and MGs by # of people in the server not percentages, etc. (like dod_limit)

Cvars:
dod_wc_num <#> - # of people in server for sniper/mg to be allowed
dod_wc_snipers <#> - # of snipers to allow per team (when correct # in server)
dod_wc_mgs <#> - # of mgs to allow per team (when correct # in server)
dod_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.

Commands:
dod_wc_on <#> - sets # of people in server for weapons allowed, runs the check.
dod_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.

To 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

Thanks all.

Kiel |17.SS|
02-26-2007, 10:31 PM
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]
02-27-2007, 12:48 AM
I believe this is covered in dod_limits by Zor ?
http://www.dodplugins.net/forums/showthread.php?t=7

Kiel |17.SS|
02-27-2007, 02:00 AM
Ah yeah thats right. But Zor's plugin lets you limit all the weapons, not just those few.

diamond-optic
02-27-2007, 11:55 AM
not sure how this one works exactly..

but 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&#37; 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..


and 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...

__________________________________________________ ________
*edit*

also you should fix the compile warning...
Warning: Function "checklimit" should return a value on line 100using a pcvar as well would be smart...

and 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..

and youve also hard coded the limits like such:
if(plrs>=get_cvar_num("dod_wc_num"))
{
set_cvar_num("mp_limitalliesspring",1)
set_cvar_num("mp_limitallies30cal",1)
set_cvar_num("mp_limitaxisscopedkar",1)
set_cvar_num("mp_limitaxismg42",1)
set_cvar_num("mp_limitaxismg34",1)
set_cvar_num("mp_limitbritsniper",1)
set_cvar_num("mp_limitbritmg",1)
}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 such

maybe 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...

Hood [10th MD]
02-28-2007, 12:57 AM
I'll work on those things and update it...

And yeah, it's similar to limit, but i wanted it to be non-percentage based, and non-map specific.
Plus the one great thing is if you change the limit, it will go force people out of sniper or MG classes.

It's not really general use ready yet, obviously, but I like it a lot, thought some others might want a similar thing.

Will update when done.

Hood [10th MD]
02-28-2007, 02:10 AM
*Super Updated*

Feedback at all?

diamond-optic
02-28-2007, 08:09 PM
theres a much better way then using these:
register_event("TextMsg", "checklimit", "a", "1=3", "2=#game_disconnected")
register_event("TextMsg", "checklimit", "a", "1=3", "2=#game_joined_game")try:
public client_putinserver(id)
{

// yada yada

}AND
public client_disconnect(id)
{

// yada yada

}
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)

:D

Hood [10th MD]
03-01-2007, 09:16 PM
True enough.
Ok, I've change it so that it runs the checklimit when those functions are called.

I 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.

Ok... updated source + amxx.

Now 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
03-02-2007, 12:46 AM
..i dont think you attached the new version..

Hood [10th MD]
03-02-2007, 01:52 AM
Oi. did now!