General > Developers Corner

Using ULib as an all around admin system

<< < (3/5) > >>

aschmack:
Well, I was able to get myself the weapons by doing a "lua giveneeds(3)", so nothing is apparently wrong with that function. I think that either setNeeds isn't working or the tables aren't resetting properly.

JamminR:

Try adding 'else' to setneeds?

--- Code: ---function setneeds(userid)
if not needsmenu[userid] then
-- ULib.tsay(0,_PlayerInfo(userid,"name") .. " already has the menu.")
return
else  -- If he already got the menu, he doesnt need it again
-- ULib.tsay(0,_PlayerInfo(userid,"name") .. " needs the menu.")
needsmenu[userid] = true
giveneeds(userid)
end

--- End code ---

JamminR:
Might also add a return to nomoreneeds.
I've had various issues with mixing multiple scripts (as you too have experienced), and feel that if several hook the same function, if return isn't used, that it messes up others up someway.

This is a feeling I have, and don't have hard fact

aschmack:
That may have sped up the script a little bit, but I found that it is the tables not being reset correctly(I tried rejoining, and it said that I already had the menu) So I took out the "if not connected" bit, since it would just be called on disconnects anyways, and the table gets reset. But, on rejoin I dont have access yet when it does the send so it doesnt work. Ideas?

JamminR:
According to the ucl.lua file, the function to query is ULib.ucl:query(userid, access)

Your code has Ulib.mainUcl:query

(yours has a 'main' in it)

You may have that function already remapped and just not in that code sample.
Or my understanding of lua objects is way off. :)
Also, make sure Ulib is loading first. See the readme.txt file for the assert commands to add to top of your code.
Other than that, no other ideas at this time.
I'm working on a small project of my own right now, so will check back in a few. Let me know how it goes.

Edit: Removed two extraneous posts for 'neatness' sake

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version