Hey guys, im trying to make it so the following console command can be executed from the server console:
if (SERVER) then
function Kick( ply, cmd, args )
if !ply:IsUserGroup("moderator") and !ply:IsAdmin() and !ply:IsSuperAdmin() then return false end
local target = findplayer(args[1])
local reason = tostring(args[2])
target:Kick(reason)
end
end
concommand.Add("a_kick", Kick)
Now i made it so it checks to make sure the player is at least a moderator to run the command, but how would i go about making it so the command can be executed from the server console, since there wouldnt be a valid player sending the command in that case. I thought about using IsValid, but would that pose any security risks? (as in, is there a situation where someone could make their player entity invalid in order to run this command?)