ULX

Author Topic: stool and weapon restriction  (Read 8528 times)

0 Members and 1 Guest are viewing this topic.

Offline saintmark

  • Newbie
  • *
  • Posts: 27
  • Karma: 1
Re: stool and weapon restriction
« Reply #15 on: June 01, 2008, 03:51:00 PM »
btw any clue why mine prints the HUD message twice?

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: stool and weapon restriction
« Reply #16 on: June 01, 2008, 04:10:00 PM »
Tip:
When you aren't using complex tables, that is, if you just have a list of items in a table you want to recurse like
Code: [Select]
table_list = { a,b,c,d,e,f,g,h }
Lua handles the 'ipairs' more efficiently than 'pairs'
Code: [Select]
for _,item in ipairs( table_list ) do
-- do something with item
end

As for why printmessage twice, is it the exact same both times, not a different message, one from each of two of your three hooks?
« Last Edit: June 01, 2008, 04:14:56 PM by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline saintmark

  • Newbie
  • *
  • Posts: 27
  • Karma: 1
Re: stool and weapon restriction
« Reply #17 on: June 02, 2008, 04:54:00 AM »

As for why printmessage twice, is it the exact same both times, not a different message, one from each of two of your three hooks?

Yes it is exact both times...

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: stool and weapon restriction
« Reply #18 on: June 02, 2008, 06:47:55 PM »
No idea. While looking at PrintMessage on the Gmod Lua wiki, I found ChatPrint too. Perhaps try it, see if it does same.
http://wiki.garrysmod.com/wiki/?title=Player.ChatPrint
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming