AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [ANY] Voice Enforcement (https://forums.alliedmods.net/showthread.php?t=143848)

KyleS 11-25-2010 18:11

[ANY] Voice Enforcement
 
1 Attachment(s)
What is this? It sounds Evil! D:!
Basically what this plugin does is allows countries on a White list to talk on their microphone. If the client is not in the said countries, they're not allowed to talk. Yes, it is Evil to a certain extent, but childish players leave some of us with no option D:!

Why would you make this :<
The inspiration for the plugin came around when we started having random people from other countries joining and just screaming and swearing into their microphone. Not caring if they're banned or not. After I saw Psychonic's "Mute the Canucks/Msleeper" joke plugin that didn't function. I thought what the hell. Gave it a whirl, then just like that, the screaming was gone.

Sounds... kind of cool. How would I add countries to the list?
Well, first you'd find what the Country Code is for the Country that you want to Blacklist/Whitelist by going here: http://www.uspto.gov/patft/help/helpctry.htm (I use this, you don't have to).
Then you'd have to make a list, an example would be sm_voicelist "US, CA, SE, AF, GN, UA"

But I don't want to Whitelist countries, I want to Blacklist them!
Cool. Just set sm_voicetoggle to 1 and away you go.

I'm inside of a whitelisted country, but SourceMod doesn't recognize me and mutes me anyways.
The GeoIP database is no where near complete. I'm personally using the MaxMind database which seems to have a lot more entires in it, and appears to be more accurate. Entries are still missing from it, though.

Well... I took a look at your Source and noticed you're using a statically set string array. Why don't you use X or Y instead?
To be perfectly honest, show me how and I'll move over to it. I spent all of 15minutes making this kind of user friendly, then an hour or so scratching my head wondering why it was only checking one array and not the others (while annoying the hell out 40 or so innocent clients getting printouts while playing). Then I found this which reminded me that if I made a String:Meh[9999999] or someone silly did in IRC a while back. I'd be sitting on a bigger binary which would save stack space to allocate data into the string. You cannot dynamically change the size of an array and or string.

Where's your Public CVAR @:<
There's no need for it, load it or don't. Stats don't really matter, especially for something like this.

tl;dr
sm_voicelist = Country list, separated by a simple comma. (,)
sm_voicetoggle = Changes from a whitelist to a blacklist. 0 for the Whitelist functionality, 1 for the Blacklist functionality.
sm_voicelevel = Command string used to check if the client has authorization or not to bypass the check. At the moment this is set to the reservation flag. As requested, you may change it using admin_overrides.cfg

CatsyLady 11-26-2010 15:37

Re: [ANY] Voice Enforcement
 
thats pretty usefull plugin,
thank you

psychonic 11-26-2010 15:48

Re: [ANY] Voice Enforcement
 
Some suggestions to make it infinitely more useful to more people without it having to be edited first:
  • Leave the country list defaulting to empty (else this will not likely get approved as it's somewhere between politically incorrect, racist, and ethnocentric at best
  • Allow the countries to be named in a config file or provide a cvar that allowed a string of comma-separated country codes
  • Allow toggle of whether it behaves as a whitelist or a blacklist
  • Leave the admin immunity in but use the CheckCommandAccess function to check it. This will allow you to not only easily set a default flag for it, but also give a 'command name' to tie it to so that it can be overridden in admin_overrides.txt if admins want to set it to different flag(s).

CatsyLady 11-26-2010 20:58

Re: [ANY] Voice Enforcement
 
something more on your wishlist?
lol

KyleS 11-27-2010 06:35

Re: [ANY] Voice Enforcement
 
Quote:

Originally Posted by psychonic (Post 1357306)
Some suggestions to make it infinitely more useful to more people without it having to be edited first:
  • Leave the country list defaulting to empty (else this will not likely get approved as it's somewhere between politically incorrect, racist, and ethnocentric at best
  • Allow the countries to be named in a config file or provide a cvar that allowed a string of comma-separated country codes
  • Allow toggle of whether it behaves as a whitelist or a blacklist
  • Leave the admin immunity in but use the CheckCommandAccess function to check it. This will allow you to not only easily set a default flag for it, but also give a 'command name' to tie it to so that it can be overridden in admin_overrides.txt if admins want to set it to different flag(s).

Rectified, did a quick test and everything seemed in order. :wink:

Matheus28 11-28-2010 08:50

Re: [ANY] Voice Enforcement
 
What about you use ExplodeString on sm_voicelist with just a comma, then trim the spaces?

psychonic 11-28-2010 14:24

Re: [ANY] Voice Enforcement
 
Quote:

Originally Posted by Kyle12 (Post 1357684)
Rectified, did a quick test and everything seemed in order. :wink:

That was quick. Nice job.

Quote:

Originally Posted by Matheus28 (Post 1358745)
What about you use ExplodeString on sm_voicelist with just a comma, then trim the spaces?

I agree. It would make sense to trim all space as it is inevitable that someone will not put the space or put extra space and then say it doesn't work.

Also, your buffer is too small on line 63
Code:

decl String:IPAddress[16], String:CC[2];
CC needs to have a size of (at least) 3. 2 for the country characters + 1 for null.

KyleS 11-28-2010 19:16

Re: [ANY] Voice Enforcement
 
Quote:

Originally Posted by psychonic (Post 1359012)
Quote:

Originally Posted by Matheus28 (Post 1358745)
What about you use ExplodeString on sm_voicelist with just a comma, then trim the spaces

I agree. It would make sense to trim all space as it is inevitable that someone will not put the space or put extra space and then say it doesn't work.

Very true, fixed.
Quote:

Originally Posted by psychonic (Post 1359012)
Also, your buffer is too small on line 63
Code:

decl String:IPAddress[16], String:CC[2];
CC needs to have a size of (at least) 3. 2 for the country characters + 1 for null.

:oops: Fixed.

Prototype-ish, I haven't tested it yet but I've fixed at least three other issues. Will update the main once LimeStone fixes my IPMI issue.

EDIT: Thought about it in the shower. I'm going to have to use StrContains in comparison to StrEqual, and I'm going to have to allocate more cells.

KyleS 12-03-2010 14:38

Re: [ANY] Voice Enforcement
 
Has a fault tolerance of up to four spaces, fixed some other issues with it and fully tested.

Updated the OP.

EDIT: Psychonic told me how to handle this a bit better, updated again to 1.6.

KyleS 12-19-2010 14:20

Re: [ANY] Voice Enforcement
 
Had some useless code left over from the previous method change.

1.6b is up.


All times are GMT -4. The time now is 13:45.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.