Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google Log In with Steam Sign In
  • Create Account
Photo

Custom Voting - Enemy Territory LUA

- - - - -

  • Please log in to reply
17 replies to this topic

#1
OFFLINE   Geo

Geo

    Regular Member

  • Members
  • PipPipPip
  • 70 posts
12
A step in the right direction
  • LocationUnited Kingdom

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



#2
OFFLINE   clan DIABOLIK

clan DIABOLIK

    Advanced Member

  • Members
  • PipPipPipPip
  • 322 posts
36
Getting Better

I really enjoy what you say in the readme.txt : 

Feel free to request any votes you would like included on the forums.

 

Thanks for all that man !!!

:)



#3
OFFLINE   Sol

Sol

    Regular Member

  • Coders
  • PipPipPip
  • 113 posts
28
On a distinguished road
  • LocationPoland

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.



#4
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland

 

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.



#5
OFFLINE   Sol

Sol

    Regular Member

  • Coders
  • PipPipPip
  • 113 posts
28
On a distinguished road
  • LocationPoland

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, 13 September 2013 - 07:19 PM.


#6
OFFLINE   clan DIABOLIK

clan DIABOLIK

    Advanced Member

  • Members
  • PipPipPipPip
  • 322 posts
36
Getting Better

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



#7
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland

 

I asked you already to create custom _trap to pass informations from clients's UI but its not implemented yet )

There is a method to read cvars from the clients.



#8
OFFLINE   Sol

Sol

    Regular Member

  • Coders
  • PipPipPip
  • 113 posts
28
On a distinguished road
  • LocationPoland

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



#9
OFFLINE   Geo

Geo

    Regular Member

  • Members
  • PipPipPip
  • 70 posts
12
A step in the right direction
  • LocationUnited Kingdom

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



#10
OFFLINE   clan DIABOLIK

clan DIABOLIK

    Advanced Member

  • Members
  • PipPipPipPip
  • 322 posts
36
Getting Better

Thanks a lot man, but no problem, take your time, we can live without this detail xD



#11
OFFLINE   Dookie

Dookie

    Advanced Member

  • Members
  • PipPipPipPip
  • 420 posts
55
Getting Better
  • LocationCroatia

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



#12
OFFLINE   clan DIABOLIK

clan DIABOLIK

    Advanced Member

  • Members
  • PipPipPipPip
  • 322 posts
36
Getting Better

Hi Dookie

 

You just have to download this pk3 http://mygamingtalk....-custom-voting/ and edit the top-part of the lua script, all is explained inside !

 

Have fun with it ! Players appreciate it a lot xD



#13
OFFLINE   Geo

Geo

    Regular Member

  • Members
  • PipPipPip
  • 70 posts
12
A step in the right direction
  • LocationUnited Kingdom

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



#14
OFFLINE   Dragonji

Dragonji

    Advanced Member

  • Members
  • PipPipPipPip
  • 514 posts
142
On the road to fame
  • LocationPoland
You don't have to use external Lua mods anymore. silEnT mod has a built-in custom vote feature:

http://mygamingtalk....ot#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 =



#15
OFFLINE   Geo

Geo

    Regular Member

  • Members
  • PipPipPip
  • 70 posts
12
A step in the right direction
  • LocationUnited Kingdom

Nice to see it was implemented (haven't been around for ages) because it looks far simpler & efficient to use



#16
OFFLINE   Dookie

Dookie

    Advanced Member

  • Members
  • PipPipPipPip
  • 420 posts
55
Getting Better
  • LocationCroatia

Arcane, I added your lua to my server, and i got menu and all inside the game, but when i click on any of the votes, nothing happends, just blank click, any ideas?



#17
OFFLINE   clan DIABOLIK

clan DIABOLIK

    Advanced Member

  • Members
  • PipPipPipPip
  • 322 posts
36
Getting Better

Did you put the pk3 and restarted server too ??? 



#18
OFFLINE   Dookie

Dookie

    Advanced Member

  • Members
  • PipPipPipPip
  • 420 posts
55
Getting Better
  • LocationCroatia

yea, ive got the menu custom vote nd everything, but when i click on vote lets say +5mins or any other, nothing happends.


Edited by Dookie, 25 July 2014 - 12:31 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users