• How to block console commands?
    3 replies, posted
Hi, im looking for help :) I want block some console commands, for example "kill" becasue its really annoying in RP. Thx
Well to disable player to use kill in console put this in init.lua [code] function GM:CanPlayerSuicide() return false; --False for no suicide, True for you can suicide! end [/code]
For the command kill just use [b][url=wiki.garrysmod.com/?title=Gamemode.CanPlayerSuicide]Gamemode.CanPlayerSuicide [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] , no need to disable the command itself. Also for admins able to suicide you can use this in the gamemode. [lua]function GM:CanPlayerSuicide(ply) return ply:IsAdmin() end [/lua] or this in a seperate lua file [lua]hook.Add("CanPlayerSuicide", "NoSuicide4u", function(ply) return ply:IsAdmin() end) [/lua]
Thx for both help :)
Sorry, you need to Log In to post a reply to this thread.