Script not running properly?

Hello, I have a TTT server and the following LUA code isn’t running properly:


function webCommand( pl, text, teamonly )
                    if (text == "!donate") then 
                            pl:SendLua([[gui.OpenURL("http://yoshismod.ml/donate")]]) -- Change ADDRESS to your chosen page.
 
                end
function webCommand( pl, text, teamonly )
                    if (text == "!css") then 
                            pl:SendLua([[gui.OpenURL("http://yoshismod.ml/forum/m/40072318/viewthread/28373145-installing-css-content-on-your-garrys-mod-to-fix-unknown-textures-errors/page/1")]]) -- Change ADDRESS to your chosen page.
 
                end
        end
hook.Add( "PlayerSay", "Chat", webCommand )

What happens is only one of them works. I think its probably because of a conflict. Any ideas why?

you redefine the function the second time so the first one is removed - just combine the two functions into one.

Okay, thanks so much! That makes a lot of sense, and I’m still new to lua coding so its kind of difficult for me

To be clear you mean it should look like this right


function webCommand( pl, text, teamonly )
                    if (text == "!donate") then 
                            pl:SendLua([[gui.OpenURL("http://yoshismod.ml/donate")]]) -- Change ADDRESS to your chosen page.
                    if (text == "!css") then 
                            pl:SendLua([[gui.OpenURL("http://yoshismod.ml/forum/m/40072318/viewthread/28373145-installing-css-content-on-your-garrys-mod-to-fix-unknown-textures-errors/page/1")]]) -- Change ADDRESS to your chosen page.
                end
        end
hook.Add( "PlayerSay", "Chat", webCommand )


function webCommand(pl, text, teamonly)
	if (text == "!donate") then
		pl:SendLua([[gui.OpenURL("http://yoshismod.ml/donate")]]) -- Change ADDRESS to your chosen page.
	elseif (text == "!css") then
		pl:SendLua([[gui.OpenURL("http://yoshismod.ml/forum/m/40072318/viewthread/28373145-installing-css-content-on-your-garrys-mod-to-fix-unknown-textures-errors/page/1")]]) -- Change ADDRESS to your chosen page.
	end
end

hook.Add("PlayerSay", "Chat", webCommand)