• Print

Author Topic: Using ULib as an all around admin system  (Read 34756 times)

0 Members and 1 Guest are viewing this topic.

Offline aschmack

  • Newbie
  • *
  • Posts: 13
  • Karma: 2
Re: Using ULib as an all around admin system
« Reply #15 on: July 27, 2006, 08:59:39 pm »
I got a cheap fix, this should work, sadly it requires you to suicide once when you connect. I suppose that someone could add in a silent kill, but I don't really feel like doing that now.

JamminR, ULib.mainUcl is the access table that gets added from users.ini, so yes, I got it right.

PASTE this over the hooks and CONCOMMANDS at the bottom of eSWEPmenu.lua. Then change the name of ulx_init.lua to aulx_init.lua (so that it loads before everything.


New Version Below.
« Last Edit: July 27, 2006, 09:44:55 pm by aschmack »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Using ULib as an all around admin system
« Reply #16 on: July 27, 2006, 09:19:33 pm »
Sounds like an odd hack that the person has to 'kill' themselves.
Like you said, sounds as though thier access is being loaded after this script.
Any errors being returned in console?
Two suggestions... use a timer to count 2 seconds before testing access?
Or, hook eventPlayerActive instead? This is called after connecting of course, might give the necessary time needed. (Then again, might be too slow)

The project I'm working on had odd results using the HookEvent(eventPlayerActive) command, which calls a function that was supposed to declare some key tables and switches for those tables related to the user. Doesn't seem to call it
So what I've done is wrote the code so that when the console command to turn on my project is turned 'on', it tests to see if those variables are set, if not, it too calls the original 'setup' function, then returns to turn on the project.

So far, its worked, and better than having to have my user reconnect or respawn. :)


"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline aschmack

  • Newbie
  • *
  • Posts: 13
  • Karma: 2
Re: Using ULib as an all around admin system
« Reply #17 on: July 27, 2006, 09:46:22 pm »
I seem to have gotten past the suicide hack. Here's the code for now, I'm going to bed.

Code: Lua
  1. --MOD BELOW
  2. needsmenu = {}
  3. for userid = 1, _MaxPlayers() do
  4.         needsmenu[ userid ] = 1
  5. --      ULib.tsay(0,"needsmenu table is set.")
  6. end
  7. --[[ Currently Unused
  8. function setneeds(userid)
  9.         if not needsmenu[userid] then
  10.                 ULib.tsay(0,_PlayerInfo(userid,"name") .. " already has the menu.")
  11.                 return
  12.         else
  13.                 -- If he already got the menu, he doesnt need it again
  14.         ULib.tsay(0,_PlayerInfo(userid,"name") .. " needs the menu.")
  15.                 needsmenu[userid] = true
  16.                 giveneeds(userid)
  17.         end
  18. end
  19. ]]--
  20. function wait2(userid)
  21.         if needsmenu[userid] >= 1 then
  22.                 AddTimer(2,0,giveneeds,userid)
  23.         end
  24. end
  25.  
  26. function giveneeds(userid)
  27.         if _PlayerInfo(userid, "connected") then
  28. --[[            if needsmenu[userid] >= 2 then
  29.                         ULib.tsay(userid,_PlayerInfo(userid,"name") .. ", the next time you die and spawn you will receive the eSWEP menu.")
  30.                         if ULib.mainUcl:query(userid,ACCESS_MENU) then ULib.tsay(userid,"BTW, you will get the admin menu") end
  31.                         needsmenu[userid] = needsmenu[userid] - 1 ]]--
  32.                 if needsmenu[userid] == 1 then
  33. --                      ULib.tsay(0,_PlayerInfo(userid,"name") .. " is being sent the client menu")
  34.                         eSWEP.sendclient(userid)
  35.                         if ULib.mainUcl:query(userid, ACCESS_MENU) then
  36. --                              ULib.tsay(0,_PlayerInfo(userid,"name") .. " has access and is being sent the menu.")
  37.                                 eSWEP.sendadmin(userid)
  38.                                 needsmenu[userid] = 0
  39.                         else
  40. --                              ULib.tsay(0,_PlayerInfo(userid,"name") .. " doesn't have access and isn't getting the menu")
  41.                                 needsmenu[userid] = 0
  42.                         end    
  43.                 elseif needsmenu[userid] == 0 then
  44. --                      ULib.tsay(userid,"You already have the menu!")
  45.                 end
  46.         end
  47. end
  48.  
  49. function nomoreneeds(name,userid)
  50. --              ULib.tsay(0,name .. " has disconnected, resetting the table for that userid")
  51.                 needsmenu[userid] = 2
  52. end
  53.  
  54. CONCOMMAND("eSWEPcrate", cc_eSWEPcrate)
  55. CONCOMMAND("eSWEPspawn", cc_eSWEPspawn)
  56. CONCOMMAND("eSWEP_resend", cc_eSWEP_resend)
  57. HookEvent("eventPlayerSpawn", wait2)
  58. HookEvent("eventPlayerDisconnect", nomoreneeds)

Like before, paste it over the CONCOMMAND/HookEvent block at the bottom of eSWEPmenu.lua and change ulx_init.lua to aulx_init.lua

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Using ULib as an all around admin system
« Reply #18 on: July 27, 2006, 09:56:33 pm »
Great!
Too bad it the odd timer workaround, but MUCh better than having the user have to do anything.

Good night.
I'm still working on mine. Its not ULib though.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline foeggy

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Using ULib as an all around admin system
« Reply #19 on: July 30, 2006, 09:30:42 am »
Now it is really weird.

I used the fix.  And now VMFLoader works, but eswep doesn't.

And with the vmfloader, I can't see previews.

Offline aschmack

  • Newbie
  • *
  • Posts: 13
  • Karma: 2
Re: Using ULib as an all around admin system
« Reply #20 on: July 30, 2006, 10:47:46 am »
one of the functions I registered may already be used by VMFloader. I didn't check that because VMFloader was giving me errors in console, so I took it off. I'll check out VMFloader later on tonight.

Offline foeggy

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Using ULib as an all around admin system
« Reply #21 on: July 30, 2006, 10:56:48 am »
Well the newest one didn't work for me but here is the one I use, its like a half way between the first one and newest one.

http://files.filefront.com/VMF_Loader___Installer/;5217305;;/fileinfo.html

  • Print