Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: iDante on August 07, 2008, 03:02:11 am

Title: Any Voter
Post by: iDante on August 07, 2008, 03:02:11 am
Script Name: Any Vote
Script Description:
Democracy at its finest, this script allows ANY player in the game to start a vote that, if enough people support, will carry out ANY command that he wants.
Edit: Now the server-owners can block certain commands (just add commands to the second line of code, pretty simple)
To use:
!newvote COMMAND
COMMAND should start with /, for instance saying !newvote /say Hello will start a vote that if successful will execute the command /say Hello.

To support a vote do !vote yes
If you do this but change your mind do !vote no
For current status of a vote do !status

Admins can turn this on and off by doing /voteon or /voteoff
Original Author(s): Me
Core Version: 2.6.3
Code: 100 lines too long? eh I'll just include a bit...
Code: [Select]
procedure UpdateVotes;
var
i: Integer;
begin
Count := 0;
for i := 1 to 32 do
if Voted[i] then inc(Count, 1);
if (100*Count)/(NumPlayers - NumBots) >= WIN_PERCENT then begin
for i := 1 to 32 do
Voted[i] := false;
Voting := false;
WriteConsole(0,'Vote Passed: '+VoteString,COLOR);
Command(VoteString);
end;
end;
Thats just my method to check whether it is good or no. DOODARRR in the zip.
Title: Re: Any Voter
Post by: Furai on August 07, 2008, 04:53:33 am
Very useful script when no admin's on. Gratz. ^^'
Title: Re: Any Voter
Post by: Leo on August 07, 2008, 05:36:12 am
Democracy is maybe good for states. For game servers it can only cause chaos ;)
Title: Re: Any Voter
Post by: Railor on August 07, 2008, 06:07:22 am
Nice script, but you should disallow some commands, like /password etc.
Title: Re: Any Voter
Post by: Leo on August 07, 2008, 06:46:12 am
/newvote /shutdown
*bye bye server
Title: Re: Any Voter
Post by: Norbo on August 07, 2008, 06:56:18 am
/newvote /shutdown
*bye bye server
Yah, you should disable voting commands like shutdown or restart or any thing harmfull to the server
Title: Re: Any Voter
Post by: Furai on August 07, 2008, 07:13:27 am
Hmm. For private servers it will do. But for publics some commands really should be excluded. Especially those harmfull.
Title: Re: Any Voter
Post by: zop on August 07, 2008, 07:40:08 am
I can change something from it.
Then ppl can vote ban cheater without admin online.
Thx
Title: Re: Any Voter
Post by: DorkeyDear on August 07, 2008, 09:08:25 am
Nice idea. I was going to create a voting system for any vote, but I guess not anymore. :P GJ
Title: Re: Any Voter
Post by: shantec on August 07, 2008, 11:51:11 am
Maybe you should include some .txt file, like forbidden.txt and in that file you write all commands that cannot be voted ::)

(Also the script should check if that vote is in the forbidden file)
Title: Re: Any Voter
Post by: iDante on August 07, 2008, 04:34:26 pm
Fixed it up so that now the serverowners can block commands (with the first const at the top).
Using the default script, !newvote /adm 1 will NOT work. same with !newvote /shutdown.

And also, remember that this is democratic. If someone tries to do !newvote shutdown, then a set percent (you can set it) of people need to agree.
Title: Re: Any Voter
Post by: zop on August 08, 2008, 12:23:58 am
I made a VoteBan by change something ~ add something ~

1) Players can say "!voteban PlayerID" to start a ban voting. In game, press F1 then press / , can see a white number at left of player's name. That's PlayerID.

2) Starter can say "!unvote" to stop voting

3) Others say "!vote yes" or "!vote no" to agree or deny it

4) "!Status" can view Voting infomation

5) When "!voteban PlayerID" comes out from someone, that Player's IP will be recorded, so voting still work even he run away

6) Starter can't leave server or voting fail

Thanks iDante.
This is helpful. :)
Title: Re: Any Voter
Post by: chutem on August 08, 2008, 02:40:56 am
You can already do that, !newvote /ban <ID or name>
Title: Re: Any Voter
Post by: zop on August 08, 2008, 06:07:10 am
yes I know I can do !newvote /ban

But I just wanna let players vote ban cheater or any bad guy.

:)