ULX

Author Topic: Ugh  (Read 1598 times)

0 Members and 3 Guests are viewing this topic.

Offline rocky123xo

  • Newbie
  • *
  • Posts: 19
  • Karma: 1
Ugh
« on: January 23, 2013, 08:06:46 PM »
Two custom ULX commands are clashing. I fixed it earlier, and it's doing it again.
I have two custom chat commands, both linking to websites. Here they are. Problem is, they don't work together, one works, the other doesn't. Any ideas?
Code: [Select]
function forumCommand( pl, text, teamonly )
     if (text == "!forum") then
    pl:SendLua([[gui.OpenURL("http://dark.freeforums.org")]]) -- Change ADDRESS to your chosen page.
     for k, v in pairs(player.GetAll()) do v:ChatPrint( "Player " .. pl:Nick() .. " has gone to our forum!" )
end
end
end
hook.Add( "PlayerSay", "Chat", forumCommand )


Code: [Select]
function donateCommand( pl, text, teamonly )
     if (text == "!donate") then
    pl:SendLua([[gui.OpenURL("http://dark.freeforums.org/donations-t6.html")]]) -- Change ADDRESS to your chosen page.
     for k, v in pairs(player.GetAll()) do v:ChatPrint( "Player " .. pl:Nick() .. " has considered donating!" )

end
end
end
hook.Add( "PlayerSay", "Chat", donateCommand )

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Ugh
« Reply #1 on: January 23, 2013, 08:59:29 PM »
Code: [Select]
hook.Add( "PlayerSay", "Chat", donateCommand )

The second string "Chat" is supposed to be the name of the hook you're creating-- in other words, it should be a unique name that won't get used anywhere else. Change each hook to have different strings there, and you should be good.
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline rocky123xo

  • Newbie
  • *
  • Posts: 19
  • Karma: 1
Re: Ugh
« Reply #2 on: January 23, 2013, 09:16:07 PM »
Wow. Didn't even notice that. Thanks!