Ulysses
Ulysses Stuff => General Chat & Help and Support => Topic started by: DannyCore on May 11, 2014, 02:44:45 PM
-
Does anybody know a way to put a cool down when a player attempts to put up another vote when one was just made?
Say Player 1 makes a !votekick vote, it was unsuccessful. Player 2 decides to make a !votekick vote against Player 1, it was successful. Between those two !votekick's, I want a 2 minute wait so people can't spam the vote system.
-
function ulx.votekick( calling_ply, target_ply, reason )
if voteInProgress then
ULib.tsayError( calling_ply, "There is already a vote in progress. Please wait for the current one to end.", true )
return
end
if calling_ply.VoteKickCooldown == nil then
calling_ply.VoteKickCooldown = CurTime() - 1
end
if (calling_ply.VoteKickCooldown < CurTime()) then
calling_ply.VoteKickCooldown = CurTime() + 180
local msg = "Kick " .. target_ply:Nick() .. "?"
if reason and reason ~= "" then
msg = msg .. " (" .. reason .. ")"
end
ulx.doVote( msg, { "Yes", "No" }, voteKickDone, _, _, _, target_ply, time, calling_ply, reason )
ulx.fancyLogAdmin( calling_ply, "#A started a votekick against #T", target_ply )
else
ULib.tsayError(calling_ply, "Please do not spam votes!")
end
end
This should do the trick, although it only prevents the same player from using the votekick over and over until it is on cooldown, again.
Kind regards,
Avoid