• Spawn an entity after a specific phrase is said in chat
    1 replies, posted
Right, so I'm trying to work out a way to spawn an entity by saying a phrase in chat, for instance if I said "!ball" it'd spawn a ball in front of me. I think I know how to do the spawning bit, but I have no bloody idea how to do the bit with the chat. Do any of you know how I could go about making this thing? Also, sorry if this is the wrong section to ask this, I don't post here enough.
heres an example [code] hook.Add( "PlayerSay", "Killurself", function( ply, text, public ) text = string.lower( text ) -- Make the chat message entirely lowercase if ( text == "Im gay" ) then -- the text your looking for in chat npc:Spawn() -- call the function return "" -- this will make the IM gay text not show up in chat but still spawns the npc end end ) [/code] This is Serverside Btw for the Clientside Equivalent use [URL="https://wiki.garrysmod.com/page/GM/OnPlayerChat"]OnPlayerChat[/URL]
Sorry, you need to Log In to post a reply to this thread.