WAIT FOUND GATEKEEPER, KEEP READIN
I also can't figure out how I would get a player's Unique ID or Steam ID to ban them. Example, function BanUser( UniqueID, Time, Reason). Any help is appreciated.
Do something like this for the banning:
[PHP]local randomtime = math.random(0, 60)
if (ply:IsValid() + SERVER ) then
ply:Ban(randomtime, "snip") // Ban's them for a random time of between, Permanent, and one hour, for the reason of "snip"
end[/PHP]
You will get a error of 'Ban' being nill without the "SERVER" part.
[QUOTE=Barracuda;23441750]Do something like this for the banning:
[PHP]local randomtime = math.random(0, 60)
if (ply:IsValid() + SERVER ) then
ply:Ban(randomtime, "snip") // Ban's them for a random time of between, Permanent, and one hour, for the reason of "snip"
end[/PHP]
You will get a error of 'Ban' being nill without the "SERVER" part.[/QUOTE]
That code will error because you can't add boolean values.
Besides you don't need to check if you're on the server because that code should be ran serverside and not in a shared file.
I stole this and modified it for your anti-cheat if this is where it is going :D
credits: Simple Admin System
[lua]function BAC.Notify(ply, Text)
ply:SendLua("GAMEMODE:AddNotify(\"BAC: "..Text.."\", NOTIFY_GENERIC, 5)
ply:PrintMessage(HUD_PRINTCONSOLE, "BAC: "..Text)
end
function BAC.PrintAll(Text)
for k, v in pairs(player.GetAll()) do
v:PrintMessage(HUD_PRINTTALK, "BAC: "..Text)
end
end
function BAC.CheckPlayer(Nick)
for k, v in pairs(player.GetAll()) do
if(string.find(string.lower(v:Nick()), string.lower(Nick)) == 1) then
return v
end
end
return false
end
function BAC.Ban(ply, args)
local Target = BAC.CheckPlayer(args[1])
if(Target == false) then
BAC.Notify(ply, "No player was found")
elseif(args[2] && tonumber(args[2]) == nil) then
BAC.Notify(ply, args[2].." Bad Input")
else
if(!args[2]) then
game.ConsoleCommand("banid 0 "..Target:UserID().." kick\n")
game.ConsoleCommand("writeid\n")
BAC.PrintAll(ply:Nick().." has PermaBanned "..Target:Nick()" for a cheating infraction")
else
game.ConsoleCommand("banid "..args[2].." "..Target:UserID().." kick\n")
game.ConsoleCommand("writeid\n")
BAC.PrintAll(ply:Nick().." has banned "..Target:Nick().." for a cheating infraction")
end
end
end[/lua]
[editline]02:49PM[/editline]
If that is what your looking for :) at least I tried to help.
Sorry, you need to Log In to post a reply to this thread.