Commit 870ed53c authored by Jonah's avatar Jonah

added ulx command

parent 80eeb39c
--nope
local CATEGORY_NAME = "Prop Ban"
--helper functions
function send_messages(v, message)
if type(v) == "Players" then
v:ChatPrint(message)
elseif type(v) == "table" then
for i=1, #v do
v[i]:ChatPrint(message)
end
end
end
function ulx.propban( calling_ply, target_ply, num_rounds, reason)
if not GetConVarString("gamemode") == "terrortown" then ULib.tsayError( calling_ply, "Current gamemode is not TTT", true ) else
local rounds_left = tonumber(target_ply:GetPData("propban_rounds")) or 0
local current_rounds
local new_rounds
if ulx.getExclusive( target_ply, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( target_ply, calling_ply ), true )
elseif num_rounds < 0 then
ULib.tsayError( calling_ply, "Invalid integer:\"" .. num_rounds .. "\" specified.", true )
else
current_rounds = tonumber(target_ply:GetPData("propban_rounds")) or 0
if new_rounds > 0 then
target_ply:SetPData("propban_rounds", new_rounds)
target_ply:SetPData("reason", reason)
else
target_ply:RemovePData("propban_rounds")
target_ply:RemovePData("reason")
end
rounds_left = tonumber(target_ply:GetPData("propban_rounds")) or 0
if new_rounds == 0 then
chat_message = ("#T is no longer prop banned.")
elseif rounds_left == 1 then
chat_message = ("#A has prop banned #T until next round".." for reason: "..reason)
elseif rounds_left > 1 then
chat_message = ("#A will prop ban #T for the next ".. tostring(rounds_left) .." rounds".." for reason: "..reason)
end
ulx.fancyLogAdmin( calling_ply, chat_message, target_ply, reason )
end
end
end
local propban = ulx.command( CATEGORY_NAME, "ulx propban", ulx.propban, "!propban" )
rmute:addParam{ type=ULib.cmds.PlayerArg }
rmute:addParam{ type=ULib.cmds.NumArg, max=15, default=1, hint="rounds", ULib.cmds.optional, ULib.cmds.round }
rmute:addParam{ type=ULib.cmds.StringArg, default="I'm a dummy and forgot a reason", hint="reason", ULib.cmds.optional}
rmute:defaultAccess( ULib.ACCESS_ADMIN )
rmute:help( "mutes target(s) for a number of rounds" )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment