Making a player joins a team if he says something in chat

How can i make someone join a team if he says something in chat?
ex he says /shopowner and joins team1

I tried this but it failed




function team1( ply, text)
        if GM:PlayerSay == ( "/shopowner" ) then
		ply:setTeam(1)
		end
end
    

GM:PlayerSay is a hook. I suggest reading more about hooks in the wiki before continuing.



local function sup( ply, text )
    if (string.sub(text, 1, 10) == "/shopowner") then
        ply:SetTeam(3)
    end
end
hook.Add( "PlayerSay", "sup", sup );



function becomeGang(ply)
			ply:SetTeam(4)
			ply:KillSilent()
			NotifyAll(1, 4, ply:Nick() .. " is now a Junkie!")
	end
	return ""
end
AddChatCommand("/junkie", becomeGang)


This isn’t DarkRP <_<

Could be. shrugs