Official Soldat Forums
Server Talk => Scripting Releases => Topic started by: DorkeyDear on August 18, 2007, 08:58:03 pm
-
Script Name: !nextmap Voting
Script Description: When a player types '!nextmap', voting has started for the next map. When enough players have '!nextmap'ed, then the server '/nextmap's.
Original Author: Curt
Core Version: 2.6.3
In request from miketh2005.
Latest update: Aug 30, 2008
-
To answer your question it's because when you divide an integer by a float for some reason it treats the answer as an integer. I don't know why but I do know that you need to have the integer be a float by adding a .0 at the end.
-
Defently like this script as it gives the people there power
-
now if only avarax will use this for his eC hexer server.....
-
now if only avarax will use this for his eC hexer server.....
I second that!
i would put this on my server....if i had one.....
-
I hope you dont mind but i took your script and made a wep.ini vote
The only thing i cant figure out is how to add a second vote command so that you can vote back and forth between the normal and the moded one
Heres the mod vote
const
Color = $FFFFFFFF;
VotePerc = 50;
VoteTime = 30;
var
Go: boolean;
VFor,Time: byte;
Voted: array[1..32] of boolean;
procedure AppOnIdle(Ticks: integer);
var
i: byte;
begin
if Time > 0 then Time := Time - 1 else if Go then begin
Go := false;
for i := 1 to 32 do Voted[i] := false;
VFor := 50;
Time := 30;
WriteConsole(0,'Map vote failed.',Color);
end;
end;
procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
begin
Voted[ID] := false;
end;
procedure OnPlayerSpeak(ID: byte; Text: string);
var
i: byte;
begin
if Text = '!vote-m1' then if Voted[ID] = false then begin
Go := true;
Voted[ID] := true;
VFor := VFor + 1;
if VFor / NumPlayers * 100 >= VotePerc then begin
Go := false;
for i := 1 to 32 do Voted[i] := false;
VFor := 0;
Time := 30;
WriteConsole(0,'Map vote passed.',Color);
Command('/loadwep ?'); //HERE YOU REPLACE THE ? WITH THE NAME OF THE WEP.INI FILE THAT YOU WANT THE VOTE TO LOAD
end else WriteConsole(0,'Voting percentage of needed people: ' + FloattoStr(RoundTo(VFor / NumPlayers * 100,2)) + '% / ' + InttoStr(VotePerc) + '%.',Color);
end else WriteConsole(ID,'You have already voted.',Color);
end;
-
wow I like the wep.ini vote too, bythewat btw the guy with <------- in his name is me :) lol thanx
-
If we could disable voting all together, then I would create a more customizable voting system for kicking and voting specific maps. I might do that anyways...
Is there an actual command /votemap or /votekick?
-
there is a /votemap i know
-
Script doesn´t work. You do !nextmap, it says something like "Voting percentage of needed people" and then next moment vote failed. No time for other people to vote too.
-
It obviously doesn't work because you never even set Time to VoteTime, thus having the vote immediately finish on the next AppOnIdle call.
Just fix OnPlayerSpeak up a bit and it should work (added the bolded code):
procedure OnPlayerSpeak(ID: byte; Text: string);
var
i: byte;
begin
if Text = '!nextmap' then if Voted[ID] = false then begin
Go := true;
Voted[ID] := true;
VFor := VFor + 1;
if VFor = 1 then
Time:=VoteTime;
if VFor / NumPlayers * 100 >= VotePerc then begin
Go := false;
for i := 1 to 32 do Voted := false;
VFor := 0;
Time := 0;
WriteConsole(0,'Map vote passed.',Color);
Command('/nextmap');
end else WriteConsole(0,'Voting percentage of needed people: ' + FloattoStr(RoundTo(VFor / NumPlayers * 100,2)) + '% / ' + InttoStr(VotePerc) + '%.',Color);
end else WriteConsole(ID,'You have already voted.',Color);
end;
-
I can't believe I did that. I must have copied the wrong .pas file sense I did test it, lol.
I added a line that should make it work.
if Go = false then Time := VoteTime;
Date Posted: August 25, 2007, 10:31:31 AM
And while I was at it, I added a new feature.. More time will be added to the count-down ever time a player votes. Set it to 0 if you don't want it.
Date Posted: August 25, 2007, 10:35:11 AM
I made it so the scripts resets when the map changes.
procedure OnMapChange(NewMap: String);
var
i: byte;
begin
Go := false;
for i := 1 to 32 do Voted[i] := false;
VFor := 0;
Time := 0;
end;
Date Posted: August 25, 2007, 10:41:06 AM
Update:
- When a person leaves, if they have not voted, the script rechecks the voting percentages
Date Posted: September 01, 2007, 03:52:37 pm
Update:
- Temporarily disables voting before map change
Note to server owners: If there are other scripts that changes the maps, it muts call the DisableVoteNext procedure before it changes the map if you wish to disable the voting until the next map starts.
-
I know, this topic is old, but the script won't work. I saw a lot servers with such a script, but i tested it on my own today:
I hade 3 players, 2 voted for yes -> 66% / 51% ... and i didn't passed. tried it again, didn't worked again
just after the 3rd player typed !nextmap (so 100% / 51 %), it passed. if someone leavs after we got 66%, it passes too
i already tried to fix this, but i can't get it to work :(
-
exceelent scrip :)