General > Developers Corner

Spawnmenu as Permission

(1/1)

Darklordx:
First off all Im sorry for my bad english and my very bad lua skills

I want to make a Permission wich can open the Spawnmenu. So a group without this permission can't open the Spawnmenu.

JamminR:
https://forums.ulyssesmod.net/index.php/topic,11037.0.html

Darklordx:
Yeah but how can i make a Permission with this?

Darklordx:
I had try a little bit but i get the Error:


--- Code: ---[ERROR] addons/ulx/lua/ulx/modules/sh/roger.lua:41: attempt to call field 'registerAccess' (a nil value)
  1. unknown - addons/ulx/lua/ulx/modules/sh/roger.lua:41
   2. include - [C]:-1
    3. unknown - addons/ulx/lua/ulx/cl_init.lua:17
     4. include - [C]:-1
      5. unknown - addons/ulx/lua/ulib/modules/ulx_init.lua:4
       6. include - [C]:-1
        7. unknown - addons/ulib/lua/ulib/cl_init.lua:24
         8. include - [C]:-1
          9. unknown - addons/ulib/lua/autorun/ulib_init.lua:5

--- End code ---


I only want to disable the Spawnmenu with an Ulx permission

my code :

--- Code: ---ULib.ucl.registerAccess("Qmenu", ULib.ACCESS_ALL, "Öffne das Spawnmenu", "Darklord")

local function  qmenu()
    if ULib.ucl.query(ply, qmenu) then
        return true
    else
        return false
    end
end

hook.Add("SpawnMenuOpen", "dontspawn", qmenu()

)
--- End code ---
What is wrong? pls help me im very lost




JamminR:
I'm not 100% sure why.
That first line says 'registerAccess' isn't working.
In looking at our other code, it often seems to run on 'server' side. Tried "if SERVER then ULib.ucl.registerAccess(... "?
It isn't _always_ used on server though, so if that doesn't help it, unsure.
You also include an extra close parenthesis ")" at bottom of your code. Make sure that's after your hook function, and don't call the function using qmenu(), just use ", qmenu)"

Also, try to never return 'true' when using a hook. It will often break other functions using the same hook.
Either just 'return', or 'return false'.

Your query player statement is incorrect.
You call function qmenu(), but don't pass information to it in ().

function qmenu(ply)
 if ULib.ucl.query(ply, "Qmenu") then



Navigation

[0] Message Index

Go to full version