Author Topic: Voteban/kick only allowed at round end  (Read 2851 times)

0 Members and 1 Guest are viewing this topic.

Offline Lolomat

  • Newbie
  • *
  • Posts: 24
  • Karma: 0
Voteban/kick only allowed at round end
« on: March 04, 2014, 06:49:31 AM »
Hey guys,
i am running a ttt server with ulib and ulx.
I've got a problem, player are able to votekick/ban other player during a round.
So they r able to votekick/ban someone with reason: killed me whil beeing fellow traitor.
but i dont want them to be able to do that, so i want that they only can votekick/ban on round end.
I couldnt found anything in the forum.
best regards,
Lolomat


Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Voteban/kick only allowed at round end
« Reply #1 on: March 04, 2014, 08:34:31 AM »
It's not possible because this is a very specific TTT thing. ULX/ULib were not designed to work with any specific gamemode. There are some guys out here who are working on some TTT commands, maybe they would be interested in making a new command similar to votekick/voteban but that only works after a round ends.

Offline Lolomat

  • Newbie
  • *
  • Posts: 24
  • Karma: 0
Re: Voteban/kick only allowed at round end
« Reply #2 on: March 04, 2014, 09:51:44 AM »
Okey,
thx for your Help.

Would be nice if somone who is reading this and knows a existing plugin or as the skills to code
something like this, is going to message me.


Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Voteban/kick only allowed at round end
« Reply #3 on: March 04, 2014, 10:04:35 AM »
I'll cook up a command when I get out of school.
Out of the Garry's Mod business.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Voteban/kick only allowed at round end
« Reply #4 on: March 26, 2014, 08:37:00 PM »
Dunno if you're still here, but...

This isn't tested. But it should work in theory.

Code: [Select]
local CATEGORY_NAME = "Voting"

function ulx.tttvotekick( calling_ply, target_ply, reason )
if GetRoundState() == ROUND_ACTIVE then
ULib.tsayError( calling_ply, "You must wait for the round to be over!", true )
return
end

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

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 )
end
local tttvotekick = ulx.command( CATEGORY_NAME, "ulx tttvotekick", ulx.tttvotekick, "!vkick" )
tttvotekick:addParam{ type=ULib.cmds.PlayerArg }
tttvotekick:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
tttvotekick:defaultAccess( ULib.ACCESS_ADMIN )
tttvotekick:help( "Starts a public kick vote against target." )

function ulx.tttvoteban( calling_ply, target_ply, minutes, reason )
if GetRoundState() == ROUND_ACTIVE then
ULib.tsayError( calling_ply, "You must wait for the round to be over!", true )
return
end

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

local msg = "Ban " .. target_ply:Nick() .. " for " .. minutes .. " minutes?"
if reason and reason ~= "" then
msg = msg .. " (" .. reason .. ")"
end

ulx.doVote( msg, { "Yes", "No" }, voteBanDone, _, _, _, target_ply, minutes, calling_ply, reason )
if reason and reason ~= "" then
ulx.fancyLogAdmin( calling_ply, "#A started a voteban of #i minute(s) against #T (#s)", minutes, target_ply, reason )
else
ulx.fancyLogAdmin( calling_ply, "#A started a voteban of #i minute(s) against #T", minutes, target_ply )
end
end
local tttvoteban = ulx.command( CATEGORY_NAME, "ulx tttvoteban", ulx.tttvoteban, "!vban" )
tttvoteban:addParam{ type=ULib.cmds.PlayerArg }
tttvoteban:addParam{ type=ULib.cmds.NumArg, min=0, default=1440, hint="minutes", ULib.cmds.allowTimeString, ULib.cmds.optional }
tttvoteban:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
tttvoteban:defaultAccess( ULib.ACCESS_ADMIN )
tttvoteban:help( "Starts a public ban vote against target." )
Out of the Garry's Mod business.

Offline Lolomat

  • Newbie
  • *
  • Posts: 24
  • Karma: 0
Re: Voteban/kick only allowed at round end
« Reply #5 on: June 19, 2014, 03:10:06 AM »
Hey, thanks for that.
But how do i add this to my server?
Do i need to remove the normal votekick/ban.lua or just modify it with the code u have written?