• Is it possible to make it so that on a PropetySheet, only admins can see a tab?
    21 replies, posted
Does anyone possibly know how I could make it so that only administrators could view certain tabs in a "DPropertySheet"? Like I have some that I want normal users to see, but then I have one that I want only administrators to see. Could anybody possibly help me?
Try checking to see which group the player is in, if they are a normal player draw everything except that tab, if they are an admin draw everything including that tab. I would say just give it a try and if you can't get it to work show us what you got so far.
When you're making the menu, just say [lua]if LocalPlayer():IsAdmin() then sheet:AddSheet(args); end[/lua]
It appears if you're an administrator or not when I do it, this is that are of the code: [CODE]if LocalPlayer():IsAdmin() then PropertySheet:AddSheet("Administration", SheetItemSix, "gui/silkicons/application_view_detail", false, false, "blah blah blah" ) end[/CODE]When I created it I referenced off [URL="http://wiki.garrysmod.com/?title=DPropertySheet"]this[/URL]. So I'm not sure what the "false, false" are. Also, may I ask you how you did that syntax thing with your post? I tried to quote it but it doesn't pop up saying it. :S
What I would do is something like [lua]if LocalPlayer():IsAdmin() then Code for the stuff on the PropertySheet else Message saying you are not admin that shows instead of all the buttons n stuff. end[/lua]
[QUOTE=samwilki;25025373]What I would do is something like if LocalPlayer():IsAdmin() then Code for the stuff on the PropertySheet else Message saying you are not admin that shows instead of all the buttons n stuff. end[/QUOTE] For some reason any of the things I use it keeps making it so administrators and non-administrators can see it.
I added you on Steam.
Garry broke IsAdmin() and IsSuperAdmin() on the client in the last update.
[QUOTE=Dragge;25037771]Garry broke IsAdmin() and IsSuperAdmin() on the client in the last update.[/QUOTE] [lua] ] lua_run_cl for k,v in pairs(player.GetAll()) do print(v:Nick(),v:IsSuperAdmin()) end Bot01 false -=SiN=- Cuber true [/lua] Seems to work fine
I think he means just on the client. Unless that code you put is on the client Cubar, then I don't know. Because it works fine saying text when I come on, but on the client it's broken.
IsAdmin works perfectly fine.
[QUOTE=Wizard of Ass;25043377]IsAdmin works perfectly fine.[/QUOTE] Not on the client sided parts. Anyways, I switched my steam folders on hard drives, and I lost everything, so I'm going to restart the game mode.
The two falses on the AddSheet function are just Booleans saying if its true then you can stretch the box on the x / y axis. First one is X second one is Y
[QUOTE=devinpro;25045209]The two falses on the AddSheet function are just Booleans saying if its true then you can stretch the box on the x / y axis. First one is X second one is Y[/QUOTE] Oh, okay! Thanks a lot for that! So if they were set to true the person could change the size of that box pretty much?
[QUOTE=Reactors;25043128]I think he means just on the client. Unless that code you put is on the client Cubar, then I don't know. Because it works fine saying text when I come on, but on the client it's broken.[/QUOTE] lua_run_cl = client
[QUOTE=Reactors;25045304]Oh, okay! Thanks a lot for that! So if they were set to true the person could change the size of that box pretty much?[/QUOTE] Yes, precisely.
[QUOTE=devinpro;25045568]Yes, precisely.[/QUOTE] Well, thanks. That's the only thing I don't like about Lua so far, there's so many like, unexplained (in a way) things lol
[QUOTE=Reactors;25045791]Well, thanks. That's the only thing I don't like about Lua so far, there's so many like, unexplained (in a way) things lol[/QUOTE] It was in the wiki good sir, [URL="http://wiki.garrysmod.com/?title=DPropertySheet.AddSheet"]here[/URL] is the link.
[QUOTE=devinpro;25047489]It was in the wiki good sir, [URL="http://wiki.garrysmod.com/?title=DPropertySheet.AddSheet"]here[/URL] is the link.[/QUOTE] Oh, I feel dumb. I've never checked that top Syntax bar.
[QUOTE=iRzilla;25053042]This code won't work anyway. There will be a blank panel just floating, use this instead: [lua]if LocalPlayer():IsAdmin() then PropertySheet:AddSheet("Administration", SheetItemSix, "gui/silkicons/application_view_detail", false, false, "blah blah blah" ) else SheetItemSix:SetVisible(false) end[/lua][/QUOTE] You mad? Just don't create the panel if you don't need it and don't hide it.
Sorry, you need to Log In to post a reply to this thread.