I have an addon called PAC3 and I need to restrict it to admin only. How would I do this?
The addon is normally accessed through the context menu.
Thanks,
Jkarateking
You can use the [URL="https://github.com/CapsAdmin/pac3/blob/07615d36aae22c53e2252cbe8a38932a8b7dc504/lua/pac3/editor/server/wear.lua#L70"]PrePACConfigApply[/URL] hook and return false for any non-Admin.
[QUOTE=Mista Tea;51101163]You can use the [URL="https://github.com/CapsAdmin/pac3/blob/07615d36aae22c53e2252cbe8a38932a8b7dc504/lua/pac3/editor/server/wear.lua#L70"]PrePACConfigApply[/URL] hook and return false for any non-Admin.[/QUOTE]
So:
if !ply:IsAdmin() then return false
Where do I put this code of code and where do I save the whole script in my files as I have the workshop version of PAC3
Thankyou
[QUOTE=jkarateking;51102709]So:
if !ply:IsAdmin() then return false
Where do I put this code of code and where do I save the whole script in my files as I have the workshop version of PAC3
Thankyou[/QUOTE]
[CODE]!ply:IsAdmin() [/CODE]
You haven't defined "!ply" so this won't work.
:snip:
Nevermind, returning true seems to break this hook
[QUOTE=Skere_;51115789]You can shorten it with
[lua] return ply:IsAdmin() [/lua]
(assuming ply is defined)[/QUOTE]
Doing that would break the hook.
[QUOTE=Lemmie;51115781][CODE]!ply:IsAdmin() [/CODE]
You haven't defined "!ply" so this won't work.[/QUOTE]
Would actually work fine. You wouldn't easily be able to use an object named "!ply" anyway, and not at all without grabbing is via indexing. As long and ply exists and is a player "!ply:IsAdmin()" would work just fine.
Sorry, you need to Log In to post a reply to this thread.