Author Topic: Vote Banning Someone Who Left or Left During A Vote  (Read 3167 times)

0 Members and 1 Guest are viewing this topic.

Offline xboxedd

  • Newbie
  • *
  • Posts: 29
  • Karma: 0
Vote Banning Someone Who Left or Left During A Vote
« on: May 17, 2013, 06:43:42 PM »
My admins and I are unable to stay on my server 24/7, so we allow votekicks and votebans. It would make our lives much easier if votekicks and votebans still worked after their target leaves the server, or better yet to automatically pass the vote if the target leaves. Since the votekick and voteban commands do not work if the target leaves during the vote, I get a bunch of steam messages asking me to ban so and so for trolling and leaving during the vote. I then have to check the logs to make sure they are actually telling the truth.

Also it would be great if votekicks and votebans would use the reason in the vote as the reason for their ban in the ban menu. Currently there is no reason listed in the reason section for anyone who is votebaned even if a reason was stated in the vote that banned them. So I have to scroll through a bunch of logs just to find out why someone was banned.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Vote Banning Someone Who Left or Left During A Vote
« Reply #1 on: May 17, 2013, 08:39:18 PM »
These are some valid suggestions.

Here is the code to add the reason to the voteban.

Code: [Select]
local function voteBanDone2( t, target, time, ply, reason )
local shouldBan = false

if t.results[ 1 ] and t.results[ 1 ] > 0 then
ulx.logUserAct( ply, target, "#A approved the voteban against #T (" .. time .. " minutes) (" .. (reason or "") .. ")" )
shouldBan = true
else
ulx.logUserAct( ply, target, "#A denied the voteban against #T" )
end

if shouldBan then
if reason and reason ~= "" then
ULib.kick( target, "Vote ban successful. (" .. reason .. ")" )
else
ULib.kick( target, "Vote ban successful." )
end
ULib.ban( target, time, (reason or "") )
end
end

Search for that function in ULX\lua\ulx\modules\sh\vote.lua and replace the code with what is in the brackets above. Normally overriding default code is not advised, but I'm not sure if writing this into a module would load before or after the default code is loaded. Also, note, that if you update ULX this will be overridden with the default code and you'll have to modify it again.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Vote Banning Someone Who Left or Left During A Vote
« Reply #2 on: May 17, 2013, 08:41:46 PM »
Your other suggestion is a little more tricky. The player object passed through the functions is the player object entity and not a steamid. To ban a player after they leave you need to ban them by their steamid. I'll look at the code and see if there is an easy/obvious way to achieve this.

edit: No such luck.
« Last Edit: May 17, 2013, 08:51:44 PM by MrPresident »

Offline xboxedd

  • Newbie
  • *
  • Posts: 29
  • Karma: 0
Re: Vote Banning Someone Who Left or Left During A Vote
« Reply #3 on: May 18, 2013, 06:03:01 AM »
Your other suggestion is a little more tricky. The player object passed through the functions is the player object entity and not a steamid. To ban a player after they leave you need to ban them by their steamid. I'll look at the code and see if there is an easy/obvious way to achieve this.

edit: No such luck.

Is it possible to get the banid command to be used in a voteban? So what if there was something that would get the target's steam id, then if the vote passes, regardless if he/she leaves or not, the ban id command would be used automatically to ban the steam id that it got when the vote was created?

Also thank you for the code for the voteban reasons. I will replace that part of the vote.lua file when I get some free time today.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Vote Banning Someone Who Left or Left During A Vote
« Reply #4 on: May 18, 2013, 09:44:32 AM »
Not outright, no. The whole voteban system would have to be rewritten and it's quite extensive.