Hi, I have been trying to figure this out for a while, but I'm not sure how to script a chat command such as '!kick Player Reason', I already understand the hook I need, but need to know how to use things such as arguments.
You just need to use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/string/sub]string.sub[/url] for that
[editline]14th July 2016[/editline]
E.G.
[CODE]
hook.Add( 'PlayerSay', 'kicktest', function( ply, txt, team )
if string.sub( txt, 1, 5 ) == '!kick' then
local args = string.sub( txt, 6 ) -- This is the text after the !kick. You can string.Explode it if you want to get individual args
-- do stuff with the arguments
return "" -- block the message from showing in chat
end
end )
[/CODE]
Sorry, you need to Log In to post a reply to this thread.