General > Developers Corner

Ban not adding.

(1/2) > >>

StaTiiKxKALEB:
I'm trying to get this code to work, but it's not adding the ban when they disconnect. Any ideas?

--- Code: ---hook.Add("PlayerDisconnect", "BanForCheaterDisconnect", function(ply)
local plysteamid = ply:SteamID()
local plyname = ply:Nick()
local time = 1
local admin = "CONSOLE"
local reason = "(CHEATING) Don'try to cheat."

if ply:IsUserGroup("cheater") then
ULib.addBan(plysteamid, time, reason, plyname, admin)
end
end)

--- End code ---

Bytewave:
Presumably you should be using ULib.ban(ply[, time][, reason][, admin]) instead of ULib.addBan(), but I'm not sure.

JamminR:
PlayerDisconnectED ?
Notice my emphasis on 'ed'.
You seem to be using an incorrect hook name.

Errors are likely appearing in console when this first gets loaded that would indicate this.

JamminR:
ByteWave, now that you point yours out, I'm not sure honestly.
Ban looks for the player and removes them forcefully.
I'm pretty sure addBan could be used since they're already leaving.

StaTiiKxKALEB:

--- Quote from: JamminR on June 15, 2016, 06:43:34 PM ---PlayerDisconnectED ?
Notice my emphasis on 'ed'.
You seem to be using an incorrect hook name.

Errors are likely appearing in console when this first gets loaded that would indicate this.

--- End quote ---
Thanks, didn't realize. Simple mistake. Thanks for the help man. Also, thanks for the information @Bytewave. Also, how would I correctly add a user to a group? For right now, I'm using RunConsoleCommand( "ulx", "adduserid", ply:SteamID(), "cheater" )

Navigation

[0] Message Index

[#] Next page

Go to full version