Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions [managers]/votemanager/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
<setting name="*voteban_locktime" value="[120]"/>
<setting name="*voteban_percentage" value="[75]"/>
<setting name="*voteban_allowchange" value="[true]"/>
<setting name="*voteban_banip" value="[false]"/>
<setting name="*voteban_banusername" value="[false]"/>
<setting name="*voteban_banserial" value="[true]"/>
<setting name="*voteban_duration" value="[3600]"/>

<setting name="*votekill_enabled" value="[false]"/>
<setting name="*votekill_timeout" value="[15]"/>
Expand Down
12 changes: 11 additions & 1 deletion [managers]/votemanager/votemanager_polls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ addEventHandler("onResourceStart", thisResourceRoot,
info.percentage = get(settingsGroup.."_percentage") or nil
info.timeout = get(settingsGroup.."_timeout") or nil
info.allowchange = get(settingsGroup.."_allowchange")
if name == "ban" then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not entirely sure whether this or if settingsGroup == "voteban" then would be better. I think either is fine.

info.banip = get(settingsGroup.."_banip")
info.banusername = get(settingsGroup.."_banusername")
info.banserial = get(settingsGroup.."_banserial")
info.duration = get(settingsGroup.."_duration")
end
info.blockedPlayers = {}
addCommandHandler("vote"..name, vote[name].handler )
end
Expand Down Expand Up @@ -426,6 +432,8 @@ function voteKick(player, reason)
local title = "Kick "..getPlayerName(player).."?"
if reason then
title = title.." ("..reason..")"
else
reason = ""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

making reason an empty string if none is supplied for reasons explained in the pull request

end
return startPoll{
title=title,
Expand All @@ -446,14 +454,16 @@ function voteBan(player, reason)
local title = "Ban "..getPlayerName(player).."?"
if reason then
title = title.." ("..reason..")"
else
reason = ""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

making reason an empty string if none is supplied for reasons explained in the pull request

end
return startPoll{
title=title,
percentage = vote.ban.percentage,
visibleTo = rootElement,
timeout = vote.ban.timeout,
allowchange = vote.ban.allowchange;
[1]={"Yes",banPlayer,player,serverConsole,reason},
[1]={"Yes",banPlayer,player,vote.ban.banip,vote.ban.banusername,vote.ban.banserial,serverConsole,reason,vote.ban.duration},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if reason was nil here it would result in the ban duration being ignored, because after unpacking the table in

optionTable[2](unpack(optionTable,3))
it would get lost

[2]={"No",outputVoteManager,"voteban: not enough votes to ban "..getPlayerName(player)..".",rootElement,vR,vG,vB;default=true},
}
end
Expand Down