Toribash
Original Post
[REL&WIP] Voting script
Voting Script - v0.2 beta
Needs major help. Wrote it for the Lua exam (Fizik's group), so whoever takes the exam scripts - check it please .


Requesting help for:
  • Less symbols usage
  • Kick/ban functions




Things to do:
  • An "info" command that would whisper people "Number of positive votes: X, Number of negative votes: Y, Z more votes to go" where X is vote_y, Y the number of - votes (curr_vote-vote_y) and Z is the number of votes yet to be made before the average+1 limit. Negative votes will also be displayed;
  • Timer between polls;
  • Making an array of people, who has already voted, will be very helpful.





Abilities:
  • Starting a poll for loading suggested mod!

I think it will be helpful for public and usual servers' hosters.

Thanks to: Kyat - a lot of things suggested; Blam - little piece of code to get amount of people on server, JetFighter and Fizik - help on v0.1 version.
Comment and rate, suggest things!
Attached Files
ModVote.lua (3.4 KB, 29 views)
Last edited by MADrBOT; Feb 20, 2011 at 06:32 PM. Reason: Update
pretty nice idea good luck with it :P (sorry cant help out with programming though)
have fun ^^
And as allways,
have fun
The "troubles" I see so far for this script to be fully operational online :

1. You don't test if there is an ongoing poll or not. That means that anyone can change the mod in poll during the poll itself.
2. Anyone can vote more than once. The script should remember the name of ppl who voted. (also useful for whispering)
3. Using a symbol like "!+" and "!-" should help avoid false votes
4. There should be a time limit for the poll or at least, you should count the number of ppl on the server and make your maths from this number, instead of your arbitrary "minimum 3". This way, when at least the average+1 of ppl present in the room have voted yes, the mod would change.
Also the number of "-" vote should be tested. If you have like 25% of the ppl in the room who vote no, the poll should be dismissed right away.
5. With the system described ahead, ppl should have an "info" command that would whisper them
"Number of positive votes : X
Number of negative votes : Y
Z more votes to go"
where X is vote_y, Y the number of - votes (curr_vote-vote_y) and Z is the number of votes yet to be made before the average+1 limit. Negative votes should also be Diplayed
6. The "added vote" message should be whispered, to prevent flood kick.

I'd change the first message said by your script to "^07Type '^10votemod mod_name^07' to propose a mod for poll."
The second message should tell again what is the proposed mod: "^02Voting for " + modname


That's it for now. Nice effort, make the accurate modifications required and it should be an interesting and useful script.
[FROG] - [Toribash-FR] - [OLDA] - \m/
Français, english: Click
local spectators = get_spectators()
local worldstate = get_world_state()
intMaxPlay = #spectators + worldstate.num_bouts
echo("Currently " .. intMaxPlay .. " players in the server.")
[FROG] - [Toribash-FR] - [OLDA] - \m/
Français, english: Click
Alternatively
lua code:
local spectators = get_spectators()
local bouts = get_bouts()
local num_players = #spectators + #bouts
echo("Currently " .. num_players .. " players in the server.")
:D
Originally Posted by Kyat View Post
1. You don't test if there is an ongoing poll or not. That means that anyone can change the mod in poll during the poll itself.

Now keyword is changed after poll start and can be changed back only when poll is finished.

Originally Posted by Kyat View Post
2. Anyone can vote more than once. The script should remember the name of ppl who voted. (also useful for whispering)

I guess I have to create an array, but at this moment I know only how to read strings for a pre-made one D:, so it will be done later.

Originally Posted by Kyat View Post
3. Using a symbol like "!+" and "!-" should help avoid false votes

Done.

Originally Posted by Kyat View Post
4. There should be a time limit for the poll or at least, you should count the number of ppl on the server and make your maths from this number, instead of your arbitrary "minimum 3". This way, when at least the average+1 of ppl present in the room have voted yes, the mod would change.

Don't know a thing about setting up time limit, but now poll will be finished when total_of_ppl_on_server-1 will vote.

Originally Posted by Kyat View Post
Also the number of "-" vote should be tested. If you have like 25% of the ppl in the room who vote no, the poll should be dismissed right away.

Will be done later, I'll think a little bit about it, because I'll have to re-write this thing with average variable.

Originally Posted by Kyat View Post
5. With the system described ahead, ppl should have an "info" command that would whisper them
"Number of positive votes : X
Number of negative votes : Y
Z more votes to go"
where X is vote_y, Y the number of - votes (curr_vote-vote_y) and Z is the number of votes yet to be made before the average+1 limit. Negative votes should also be Diplayed

6. The "added vote" message should be whispered, to prevent flood kick.

Will be done later, reason is at the second quote.

Originally Posted by Kyat View Post
I'd change the first message said by your script to "^07Type '^10votemod mod_name^07' to propose a mod for poll."
The second message should tell again what is the proposed mod: "^02Voting for " + modname

Done.

Updating first post.
You'll get flood kicked even if you whisper, I tried it.
You'll even get kicked if you flood with cp.
Does someone know the delay for not getting kicked?
Signature temporarily out of order.