PDA

View Full Version : Basic Votes (votemap, votekick, voteban)


ferret
06-14-2007, 15:19
Basic Votes
Version 1.3

By: ferret!

Description

This plugin adds a range of voting commands. Admins must have the Admin_Vote flag to use. They include kick, ban, and map commands, as well as a custom vote. Please note that an admin does not have to have admin_kick or admin_ban to use these.

Installation

Place the basevotes.smx file inside of the addons/sourcemod/plugins/ folder.
Place the plugins.basevotes.txt file inside of the addons/sourcemod/translations/ folder.Commands

sm_votemap <mapname> [mapname2] ... [mapname5]
Issues a vote for map change. Map will change after the map.
Single map votes will display as a Yes or No vote.
Up to five maps may be specified.
See sm_vote_map cvar.
sm_votekick <player> [reason]

Issues a vote to kick a player. Player is kicked at vote completion.
Optional reason will be displayed to the target when kicked.
See sm_vote_kick cvar.
sm_voteban <player> [reason]

Issues a vote to ban a player. Player is banned and kicked afterwards.
Ban lasts for 30 minutes.
Reason if specified will be shown to user when kicked
See sm_vote_ban cvar.
sm_vote <question> [Answer1 .. [Answer5]

Issues a custom vote.
If no answers are specified, they will default to Yes and No.
Remember to use quotes around questions or answers with a space in them.
sm_votecancel

Cancels any vote currently in progress.
Cvars

sm_vote_master
Overrides all other sm_vote cvars for controlling the percentage of votes needed, when set to non-zero.
Default is 0.0.
Ranges from 0.0 (0%) to 1.0 (100%)
sm_vote_map

Percentage of votes needed to change the map for single map votes.
Default is 0.60 (60%)
Ranges from 0.05 (5%) to 1.0 (100%)
sm_vote_kick

Percentage of votes needed to kick a player
Default is 0.60 (60%)
Ranges from 0.05 (5%) to 1.0 (100%)
sm_vote_ban

Percentage of votes needed to ban a player.
Default is 0.60 (60%)
Ranges from 0.05 (5%) to 1.0 (100%)
sm_vote_show

Controls whether or not player's choices are broadcast to everyone.
Default is 1. Set to 0 to turn off.
Changelog

Version 1.3
Abandoned hungarian notation
New cvar: sm_vote_say. Default is off. Allows players to use votekick and voteban by saying them. "say votekick player". Personally, I would NOT use it. But it was requested, so there you go. Don't get yourself banned!
New cvar: sm_vote_master: Default is 0.0. If you set this, all other vote percentage Cvars will be ignored, and this will be used instead.
Fixed Kick Failed message, displayed sm_vote_map instead of sm_vote_kick
Fixed Ban Failed message, displayed sm_vote_map instead of sm_vote_ban
Fixed failed votes showing reversed percentages
Added natives necessary for ExtendedVotes to hook in.
Version 1.2 (June 29th)

Conform to plugin submission standards
Add version cvar sm_basevotes_version
Version 1.1 (June 28th)

Several fixes due to bad "Replace All"
June 18th

German Translations by Fisch.666
June 17th Part 2

French Translations by magicyan (Redownload plugin.basevotes.cfg)
June 17th

Requires SourceMod build R981 or higher
Took out timers that force cancel of menus, fixed in R981
Added a "no votes received" message if no one voted.
Took out vote counter variables, added to MenuAPI in R965
June 16th

Fixed vote failure percents being 61%
using a time to force votes to end in 20 seconds until MENU Api is fixed.
Other little tweaks (Make sure to get the translation file)
Changed ALL commands to ADM_VOTE access.
Bugs, Requests, Translations, or Other Issues

Please use my project area on the Allied Modders Bug Tracker (http://bugs.alliedmods.net/?project=10) to report any issues or make requests. Your login for the bug tracker is the same as your forum login. Set the category to this plugin's name.

FlyingMongoose
06-14-2007, 15:36
I have to say good work so far :)

Hell Phoenix
06-14-2007, 15:50
Very nice. Glad to see people helping get sourcemod out the door =D

krod
06-14-2007, 18:16
Thanks for your hard work!

Fisch.666
06-14-2007, 19:07
Hi!

First thanks for this plugin!! But when i try to add this plugin to my Hidden: Source linux server with the latest sourcemod, the server crashs with an Segmentation fault:

L 06/15/2007 - 01:00:24: [SM] Warning(s) encountered in translation file "plugin.basevotes.cfg"
L 06/15/2007 - 01:00:24: [SM] Too many digits in format index on line %d, phrase will be ignored.
./srcds_run: line 344: 21217 Segmentation fault $HL_CMD
Add "-debug" to the ./srcds_run command line to generate a debug.log to help with solving this problem


After i've added the -debug line to my script, there is only a core.21272 file (which you can find attached to this post). No debug.log is created...

BAILOPAN
06-14-2007, 20:24
Fisch: what revision did this crash with?

Fisch.666
06-14-2007, 20:42
Hi!

First thanks for your reply.

My server is running the sourcemod rev. 937 with the metamod version 1.4.1.400.

Or do you mean the revision of this plugin?

ferret
06-14-2007, 20:44
Confirmed on my newly updated CSS server! Latest "simple package" download and metamod. I have not idea which line in the file is at fault though due to the debug message printing %d instead of line number.

BAILOPAN
06-14-2007, 21:59
This bug has been fixed in r939. Thanks!

ferret
06-14-2007, 22:34
Tested with R939, no more segfault, whee

Kaschenko
06-15-2007, 01:11
The good beginning. It would be not bad to make automatic voting. For example: automatic voting 3 minutes prior to the end map (for example: sm_votemapauto "3").

P.S. After creation of such command - at once I shall put SourceMod :) on a server.

Fisch.666
06-15-2007, 05:45
Tested with R939, no more segfault, whee

Same here, thanks for this bugfix!!! :up:

Kaschenko
06-15-2007, 07:32
What does it mean?
The flag is established - root.
The interdiction cannot be.

ferret
06-15-2007, 08:58
The good beginning. It would be not bad to make automatic voting. For example: automatic voting 3 minutes prior to the end map (for example: sm_votemapauto "3").

P.S. After creation of such command - at once I shall put SourceMod :) on a server.

In AMXX, this was a seperate plugin, mapchooser.sma. I may port it this weekend as well. Or try to. First I'll have to find out how to actually set the next map.

ferret
06-15-2007, 09:01
What does it mean?
The flag is established - root.
The interdiction cannot be.

The second image, with the error report from IsVoteInProgress, is my fault. I'll fix.

The third image shows that you did NOT give yourself any admin privs.

sm_voteban requires ADMIN_BAN rights
sm_votekick requires ADMIN_KICK rights
sm_votemap requires ADMIN_CHANGEMAP rights
sm_vote and sm_votecancel require ADMIN_VOTE rights.

'z' gives you none of these. Please refer to this page:
http://wiki.alliedmods.net/Adding_Admins_%28SourceMod%29

ferret
06-15-2007, 09:04
Ok, maybe I should read the wiki, not you. 'z' is default "no access" in AMXX. I realize now that 'z' is "everything" in SM. Good to know!

I will try to figure out what's wrong tonight when I get home from work. It's probably because of the IsVoteInProgress.

supermj
06-15-2007, 11:26
Thanks for the much needed plugin!!! I'm assuming since I have z access, that's why it says unknown command?

Kaschenko
06-15-2007, 12:44
ferret
Goood!!
Respect man!

ferret
06-15-2007, 12:47
Thanks for the much needed plugin!!! I'm assuming since I have z access, that's why it says unknown command?

Try this (I won't be able to test this for another 5 hours, at work):

Remove this from the source code wherever it appears:

|| IsVoteInProgress(hVoteMenu)
|| !IsVoteInPr4ogress(hVoteMenu)

ferret
06-15-2007, 18:02
Working out the kinks. So far I've gotten every bug out I've found, but I've ran into weird issues with translation.

http://ampaste.net/26350
http://ampaste.net/26354

ferret
06-15-2007, 18:46
I'm pretty sure I know the reason for this, need to talk to BAIL about it though.

supermj
06-15-2007, 18:56
Thanks for the hard work...keep it up!!!

ferret
06-15-2007, 20:16
Ok! Reread the first post and redownload!

Plugin is now fully tested and usable. I've found some bugs though, and I'm not sure I can fix them in the plugin. They may be menu API bugs.

The most serious bug is that votes don't end till everyone has voted, instead of after 20 seconds like the plugin says.

I also added "sm_vote_show", which controls whether or not player's choices are displayed in the chat log.

supermj
06-15-2007, 21:50
What flag do admins need to use this. One of my admins said he was able to start a vote, but when he tried to cancel it, it said he didn't have access to that command.

Hell Phoenix
06-15-2007, 22:47
Each command needs:
sm_votemap ADMFLAG_CHANGEMAP
sm_votekick ADMFLAG_KICK
sm_voteban ADMFLAG_BAN
sm_vote ADMFLAG_VOTE
sm_votecancel ADMFLAG_VOTE

You can change the access to whatever you want. In AMXX default for all those was ADMFLAG_VOTE Im pretty sure.

ferret
06-15-2007, 22:54
In AMXX default for all those was ADMFLAG_VOTE Im pretty sure.

Whoops. You're right. My bad. I'll fix later.

Kaschenko
06-16-2007, 15:00
excellent work!
I shall wait mapchooser :)

ferret
06-16-2007, 21:04
Updated. Fixed a few bugs, see the changelog in the first post. make sure to redownload the translation file too.

ferret
06-17-2007, 16:28
June 17th

Requires SourceMod build R981 or higher
Took out timers that force cancel of menus, fixed in R981
Added a "no votes received" message if no one voted.
Took out vote counter variables, added to MenuAPI in R965

ferret
06-17-2007, 19:30
June 17th Part 2

French Translations by magicyan (Redownload plugin.basevotes.cfg)

Fisch.666
06-18-2007, 05:35
Hi!

I made a german translation for your plugin. Maybe i have make some tweaks while playing, but the translation should be ok. :)

ferret
06-18-2007, 09:08
Posted!

yester64
06-19-2007, 17:25
just to let you know.. if i trigger votemap, it says nobody voted.
how many people have to vote, to have a mapchange? 3 or more..

ferret
06-19-2007, 17:59
Update to the latest SourceMod build and try again.

ferret
06-26-2007, 10:01
Plugin Updated.

Please make sure you have the latest build of Sourcemod, as this version requires the renamed Sourcemod core translation files. Also make sure to redownload the translation file, the extension has changed to match the new standard.

ferret
06-26-2007, 14:03
Sorry! Another small update to fix a display error in sm_votemap when voting on a single map.

ferret
06-28-2007, 11:16
Version 1.1

Fixed the Cvars. I accidently renamed them by doing a replace all.

ferret
06-29-2007, 09:10
Update for plugin submissionn standards and cvar for version.

Juba_PornBorn
06-30-2007, 19:31
Im looking for a votemap plugin that allows anyone to type votemap in say and open a menu where you can choose whatever map you want so if admin is not present and the map it's not suitable for the amount of players in it or because people in the server just dont like it to be able to change.
And with a delay so votemap can only be typed once every 5 minutes(set by cvar) or so for the anoiyng people not to abuse it.

ferret
06-30-2007, 19:34
Try: http://forums.alliedmods.net/showthread.php?t=57106

TSCDan
07-02-2007, 15:18
I'm looking for something similar to Juba but with a twist: what about letting players initiate a votekick or voteban? An admin isn't always on the server, and having the players be able to initiate a ban of an obvious hacker would be nice :)

ferret
07-05-2007, 09:57
Here is version 1.3, which will be officially posted on the front of the thread after I test later tonight. You may use now if you wish, but once again: Untested.

Version 1.3
Abandoned hungarian notation
New cvar: sm_vote_say. Default is off. Allows players to use votekick and voteban by saying them. "say votekick player". Personally, I would NOT use it. But it was requested, so there you go. Don't get yourself banned!Please carefully consider if you plan to turn on sm_vote_say. If your immunities are not set up correctly in SM (I'm not sure immunities as ready yet, for that matter?), players CAN initiate votes to ban YOU.

TSCDan
07-05-2007, 10:00
Quick question, is there functionality for "votekick" by itself, and have a menu brought up with a list of players? A lot of players use ascii crap in the names that would be somewhat difficult. A menu would make things simpler :D

ferret
07-05-2007, 10:14
Not in 1.3

I may add it later, but I'm starting to feel this plugin is getting a bit bloated beyond its original intention as a plugin that provides the basic "must have" commands that every mature admin plugin has.

Isias
07-05-2007, 15:24
Hehe, as you're concerned of the size of it, this might not be the right time but how about a votemute command? Of coure a GUI would be quiet nice.

ferret
07-05-2007, 15:46
New version of 1.3:

Version 1.3

Abandoned hungarian notation
New cvar: sm_vote_say. Default is off. Allows players to use votekick and voteban by saying them. "say votekick player". Personally, I would NOT use it. But it was requested, so there you go. Don't get yourself banned!
New cvar: sm_vote_master: Default is 0.0. If you set this, all other vote percentage Cvars will be ignored, and this will be used instead.
Fixed Kick Failed message, displayed sm_vote_map instead of sm_vote_kick
Fixed Ban Failed message, displayed sm_vote_map instead of sm_vote_banSeveral other tweaks. This is not finish, use at own risk.

Fisch.666
07-05-2007, 19:25
Hi!

When i compile the version 1.3 of this plugin with the latest sourcemod i get this error:


./spcomp basevotes.sp
SourcePawn Compiler 1.0.0.882
Copyright (c) 1997-2006, ITB CompuPhase, (C)2004-2007 AlliedModders, LLC

basevotes.sp(87) : error 017: undefined symbol "g_Cvar_VoteMaster"
basevotes.sp(688) : error 017: undefined symbol "g_Cvar_VoteMaster"

2 Errors.
and the plugin doesn't compile. Any ideas how i can fix this?
Thanks in advance for an reply.

ferret
07-05-2007, 19:32
It's fixed, but not ready for release just yet.

ferret
07-05-2007, 22:26
Version 1.3 officially released. You must get the new phrase file.

Shaman
07-06-2007, 06:23
Can you make something like "votemap all" which displays all maps in the vote?

ferret
07-06-2007, 08:12
I don't really see the point. If it's more than 6 maps, most players won't go to the second page, they'll just pick from the first page of options.

TSCDan
07-06-2007, 08:14
I agree with you on that one. How about just "votemap" to initiate a vote with 5 randomly chosen maps from either the maps.ini or mapcycle.txt? :D

Onix.fr
07-06-2007, 08:51
translation in FR finish and correct

vortex06
07-07-2007, 11:48
I want to allow anyone and everyone to start a votekick/voteban but not votemap. Is there an easy way to do this?

Thanks.

vortex06
07-07-2007, 11:51
nevermind, found my answer in the source code.

set CVAR sm_vote_say to 1

ferret
07-08-2007, 23:25
This plugin will no longer be supported or updated. I have created a new voting system that provides these votes. This plugin can continue to be used however, until the new system is a bit more mature.

http://forums.alliedmods.net/showthread.php?t=57636

LIONz
07-20-2007, 15:00
ferret can u make cvar like in mani ma_voterandom and it will bring up random map vote this will be useful for GunGame plugin users

This plugin will no longer be supported or updated. I have created a new voting system that provides these votes. This plugin can continue to be used however, until the new system is a bit more mature.

http://forums.alliedmods.net/showthread.php?t=57636

eh didn't read this post :P

ferret
07-21-2007, 15:21
such a command will be added to MapChooser soon.