General > Developers Corner

Changing ULX Voteban to work with SourceMod

(1/1)

Rambomst:
I have been trying to change the ULX votebanning system to work with SourceMod I changed

--- Code: ---local function voteBanDone2( t, target, time, ply )
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)" )
shouldBan = true
else
ulx.logUserAct( ply, target, "#A denied the voteban against #T" )
end

if shouldBan then
ULib.kick( target, "Vote ban successful." )
ULib.ban( target, time )
end
end

--- End code ---
To

--- Code: ---local function voteBanDone2( t, target, time, ply )
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)" )
shouldBan = true
else
ulx.logUserAct( ply, target, "#A denied the voteban against #T" )
end

if shouldBan then
game.ConsoleCommand("sm_ban "..target.." 10 Votebanned\n")
ULib.kick( target, "Vote ban successful." )
--ULib.ban( target, time )
end
end

--- End code ---
Hoping it would work but unfortunately it didnt. I am not familiar with LUA scripting and any help doing this would be much appreciated.

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given

[0] Board index

Go to full version