Hello. For a gamemode I’m working on, I’m making a code that I NEED to get working by the end of development for the gamemode. It’s a script that supposedly, upon the player typing into the chat “!rebels” or “!combine”, it changes their team. Just so you know, nothing is wrong with my code for the teams themselves, they work fine and changing to the team via the console commands I created(called set_team and set_team2) also works. However, it’s just this code that doesn’t work, here it is:
function ISaid( ply, text, public ) if text == "!combine" then RunConsoleCommand( "set_team", "1" ) return false end if text == "!rebels" then RunConsoleCommand( "set_team2", "1" ) end end hook.Add( "PlayerSay", "ISaid", ISaid )
Note: I put this code in shared.lua.