Jump to content

Custom Voting - Enemy Territory LUA


Geo

Recommended Posts

File Name: Custom Voting

File Submitter: Arcane

File Submitted: 06 Sep 2013

File Category: LUA

 



Custom voting system that gives users access to additional useful votes.


To install:

You need to unzip the file and extract the files customvote.lua and zzz_customvote.pk3
Read the readme.txt
Upload these files into the silent folder on your server
In server.cfg cvar: lua_modules "customvote.lua"
Restart the server

 



Click here to download this file

Link to comment
Share on other sites

Good job, but I see one small issue.

 

all informations can be spoofed by players inside (function et_Print( text )) imo, but there is another way to do that and simpler way.

et_ConsoleCommand() callback is exactly like et_ClientCommand() but it works for server console, u can use also et.trap_Argv( x ) function to handle incoming arguments.

 

just a small suggestion.

Link to comment
Share on other sites

  • Management

 

all informations can be spoofed by players inside (function et_Print( text )) imo

Can you provide an example that will succesfully spoof this

if string.sub(text,1,19) == "Vote Passed: [poll]" then

Also, I don't know how to substitute et_Print with et_ConsoleCommand in this script, could you be more specific on how the passed poll vote can be captured with it.

 

If there are issues, a new lua hook could be introduced to solve them.

Link to comment
Share on other sites

Can you provide an example that will succesfully spoof this

if string.sub(text,1,19) == "Vote Passed: [poll]" then

Also, I don't know how to substitute et_Print with et_ConsoleCommand in this script, could you be more specific on how the passed poll vote can be captured with it.

 

If there are issues, a new lua hook could be introduced to solve them.

 

I don't know exactly how to spoof it but I seen warnings by coders in other lua scripts, for example player could just type (name "myname\nVote Passed: [poll]") it will probably jump to next line inside consoleprint log.

 

Here is an example of what you asked for:

function et_ClientCommand( num, cmd )
	if string.lower(et.trap_Argv(0)) == "callvote" then	-- first arg
		-- other arguments... et.trap_Argv(x)
	end
end

but it requires always to return true at the end otherwise command won't be executed

( what is interesting by this you can pass some informations from custom UI windows by this vote and always return false at the end to stop executing, then vote won't appear !!this is only way to pass informations by this _trap!!! I asked you already to create custom _trap to pass informations from clients's UI but its not implemented yet )

( it is also spoofable, normal user can just send command by console "callvote quote Vote Passed: [poll]timelimit+5" it also requires to check if this vote is on the fly )

Edited by Sol
Link to comment
Share on other sites

Hi,

 

Maybe I see a problem with !passvote :

 

I connect, we are two players, I launch [50pct bot] vote, the other guy ignore the vote, so I use "rcon !passvote", it prints in console something like "referee passed poll" in blue, but no bots come.

 

PS: of course it works when vote is passed normally

 

I will try to reproduce it

Link to comment
Share on other sites

Hi,

 

Maybe I see a problem with !passvote :

 

I connect, we are two players, I launch [50pct bot] vote, the other guy ignore the vote, so I use "rcon !passvote", it prints in console something like "referee passed poll" in blue, but no bots come.

 

PS: of course it works when vote is passed normally

 

I will try to reproduce it

This message "referee passed poll" is not included into LUA script.

 

There is a method to read cvars from the clients.

Ah yeah, so there is solution. Thanks

Link to comment
Share on other sites

Hi,

 

Maybe I see a problem with !passvote :

 

I connect, we are two players, I launch [50pct bot] vote, the other guy ignore the vote, so I use "rcon !passvote", it prints in console something like "referee passed poll" in blue, but no bots come.

 

PS: of course it works when vote is passed normally

 

I will try to reproduce it

 

Sorry about this, I didn't actually include !passvote into this system, but this is a simple fix in the lua script. I'll do it today and re-upload the script so it will work with !passvote :)

Link to comment
Share on other sites

  • 8 months later...

Hi, can you explain me how I can enable just some votes from there? What should I add to my cfg if i just want to enable following votes: kickbots and add additional 5 mins. thanks

--------------------------------------------------------------------------------------------

	-- CONFIG:	

	-- Change the values below to allow or disallow votes (1 = true, 0 = false) 

	--------------------------------------------------------------------------------------------				

		vote_allow_kickbots		= 1		
		vote_allow_fivemins		= 1
		vote_allow_tenmins		= 0
		vote_allow_quarterbots		= 0		
		vote_allow_halfbots		= 0						
		vote_allow_crazygravity		= 0		
		vote_allow_crazyspeed		= 0
		vote_allow_putbotsspec		= 0
			
	--------------------------------------------------------------------------------------------
	-- Do not edit below this line
	--------------------------------------------------------------------------------------------

Keep kickbots & fivemins at 1 and put the rest to 0, nothing else required

Link to comment
Share on other sites

You don't have to use external Lua mods anymore. silEnT mod has a built-in custom vote feature:

 

http://mygamingtalk.com/wiki/index.php/Silent_Shrubbot#shrubbot.cfg

 

[customvote]

name = The of the vote shown with the /callvote command. Maximum length 15 characters.

exec = Command string to execute if the vote passes. Maximum length 1023 characters.

description = Description of the vote shown with the /callvote command. Maximum length 1023 characters.

votetext = The text that is show for voters. Maximum length 255 characters.

passtext = Optionally, a text that is shown to players if the vote passes.

levels = Optionally, admins can define the vote to be available to only specific levels. Same format that is used with the custom commands.

Example (a vote I defined on my server):

[customvote]

name = kickbots

exec = bot maxbots 0; bot kickall

description = Kick all bots from the server

votetext = Kick all bots?

passtext = Bots have been kicked!

levels =

Link to comment
Share on other sites

  • 1 month later...
×
×
  • Create New...