• Garry's Mod /do command?
    3 replies, posted
Hi! I'd like to learn LUA! But that's not a problem, I can attempt to learn. But I've been trying to make a command. /do. It's used on SAMP roleplay servers to describe a roleplay item, e.g: "/do My M4A1 rifle would be painted in a desert camouflage." The command is just a rip off of /me just in a different context. I'd like it to print out to the chat, allowing other people to see it, like me. Like this: "<User Input> (( ply name ))", example: "The camera would be set to HDR mode. (( Cody Castle ))". Would the below code work? I tested it on single player and nothing happens. I would just like help:) Thanks! [HR][/HR] [CODE]hook.Add( "PlayerSay", "doCommand", function( ply, text, input ) text = string.lower( text ) if ( text == "/do" ) then v:ConCommand("say"..input.."(("..ply.."))") return "" end end )[/CODE]
[CODE]function checkForCommand(ply,text,tc,dead) local firstChar = string.sub( text, 1,1 ) if(firstChar=="!" or firstChar=="/")then if(string.sub(text,2,3)=="do")then chat.AddText( Color( 100, 100, 255 ), "** "..string.sub(text,5).." **") return true end end end hook.Add("OnPlayerChat","checkForCommand",checkForCommand)[/CODE] Here ya go, i loved having this command in samp and mta lol :D Have fun! :-)
[QUOTE=DamienTehDemo;48937172][CODE]function checkForCommand(ply,text,tc,dead) local firstChar = string.sub( text, 1,1 ) if(firstChar=="!" or firstChar=="/")then if(string.sub(text,2,3)=="do")then chat.AddText( Color( 100, 100, 255 ), "** "..string.sub(text,5).." **") return true end end end hook.Add("OnPlayerChat","checkForCommand",checkForCommand)[/CODE] Here ya go, i loved having this command in samp and mta lol :D Have fun! :-)[/QUOTE] Thank you so much! :D
[QUOTE=Ensky;48937378]Thank you so much! :D[/QUOTE] No problem! ^^
Sorry, you need to Log In to post a reply to this thread.