Ulysses

General => Developers Corner => Topic started by: Darklordx on December 08, 2019, 04:27:19 AM

Title: Spawnmenu as Permission
Post by: Darklordx on December 08, 2019, 04:27:19 AM
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.
Title: Re: Spawnmenu as Permission
Post by: JamminR on December 08, 2019, 08:23:40 AM
https://forums.ulyssesmod.net/index.php/topic,11037.0.html
Title: Re: Spawnmenu as Permission
Post by: Darklordx on December 16, 2019, 02:25:07 AM
Yeah but how can i make a Permission with this?
Title: Re: Spawnmenu as Permission
Post by: Darklordx on December 18, 2019, 07:29:19 AM
I had try a little bit but i get the Error:

Code: [Select]
[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


I only want to disable the Spawnmenu with an Ulx permission

my code :
Code: [Select]
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()

)
What is wrong? pls help me im very lost




Title: Re: Spawnmenu as Permission
Post by: JamminR on December 18, 2019, 06:22:51 PM
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