Ulysses Stuff > Releases

URS BETA - A Highly Customizeable Restriction System (or will be)

<< < (113/117) > >>

Aaron113:

--- Quote from: theGoldTrigger on November 25, 2015, 02:07:35 PM ---Is there a way I could print the limit of a category to say a hud?

--- End quote ---
Uh, you would have to check to see if URS has the limit first.  You can do that through XGUI's data.  The table is xgui.data.URSLimits.  After that you would have to check default limit.  I would make a function that does this so you can just call one function.  There is no built in URS function in this version.  However, in the future version I have included one, but it could use some fine tweaking for this specific situation.

You can see my serverside code for checking here (do keep in mind you have to change it to use the above mentioned table):  https://github.com/Aaron113/urs/blob/master/lua/ulx/modules/urs_server.lua#L74-L85

EDIT: 800th post... WHOO!

theGoldTrigger:
Could I run it like this if every usergroup had a set limit?


--- Code: --- LocalPlayer():GetCount( "props" ) .. "/" .. xgui.data.URSLimits["prop"][LocalPlayer():GetUserGroup()]
--- End code ---

EDIT: It works... however, when I first load into the game I get lua errors saying: "prop" is a nil value. This goes away after a few seconds. My guess is that the table isn't getting initialized until I spawn. How could I make the table initialize before I completely load in?

Bite That Apple:
You can most likely fix that by doing this:


--- Code: ---if xgui != nil then
LocalPlayer():GetCount( "props" ) .. "/" .. xgui.data.URSLimits["prop"][LocalPlayer():GetUserGroup()]
end
--- End code ---

Aaron113:

--- Quote from: theGoldTrigger on November 26, 2015, 03:00:14 PM ---Could I run it like this if every usergroup had a set limit?


--- Code: --- LocalPlayer():GetCount( "props" ) .. "/" .. xgui.data.URSLimits["prop"][LocalPlayer():GetUserGroup()]
--- End code ---

EDIT: It works... however, when I first load into the game I get lua errors saying: "prop" is a nil value. This goes away after a few seconds. My guess is that the table isn't getting initialized until I spawn. How could I make the table initialize before I completely load in?

--- End quote ---
You have to check to make sure all the tables exist before trying to access them.  Otherwise you will get errors.  And this won't work for people who don't have limits.

theGoldTrigger:
Managed to make it work with a simple check

--- Code: --- if xgui.data.URSLimits["prop"] then
--- End code ---

Thanks bob ;-;

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version