• Fadmin spectate permission doesn't apply to moderators
    18 replies, posted
I have given the Moderator rank permission to use Fspectate & ulx spectate https://puu.sh/Cqru0.png Even if they have permission they still can't Fspectate, though, as an admin/superadmin I can use Fspectate. Everytime Moderators try to spectate only ulx spectate works rather than fspectate, and yes they use the xgui menu for that. When Moderators type !spectate it gives them "No access" in chat. Does anyone have any clue how I can fix this? Notes: FSpectate should not mess up because I have given them the ability to ulx spectate, the command still exists and they just don't have access to it. I do not own on my server any other spectating tools, it's really just matter of permission not being given to them.
FSpectate uses CAMI Here is the version that FSpectate uses https://github.com/FPtje/FSpectate/blob/6f5bd32ef48f71d1a14e43fa07736b6582400680/lua/sh_cami.lua I can’t fully work out what is going on here without testing myself but it seems to me you need to register your mod user group with a function and the FSpectate permission string
Can you explain further please?, I'm not the best at lua and am still learning. Thank you for your attention regarding my problem as this problem is quite annoying.
You're going to have to extract the add-on and place it in your server files. Go to this file FSpectate/sh_init.lua at 6f5bd32ef48f71d1a14e43fa07736b658240068.. Follow the steps to register a user group in the first link and change min access here to mod
Hello!, I've done exactly that and it still hasn't worked, I assumed it wouldn't have worked beforehand as well that function is for third party addons from what the developer has stated. https://puu.sh/CrINu.png Here are screenshots incase I've done something wrong: https://puu.sh/CrId4.png https://puu.sh/CrIdu.png If there's anything else that might come up to your mind let me know, I'm still trying to figure this out.
If you scroll down to the PlayerHasAccess function in that second file you are able to perform another ply:IsUserGroup("moderator") in there. Usually I would not like to change how the functions work but I'm not familiar with how CAMI works. Hopefully changing the function should work though I'm not going to be much help beyond that
I assume this is what you meant https://puu.sh/CrY7a.png It still hasn't worked, and I do not get any errors.
Ive done some more reading on the doc they have. I’ve been quite dumb when it comes to this quite possibly as when registering a privilage you are able to add a HasAccess function. Change everything back to how it was and let’s start fresh. First off you’re going to have to get the exact privilage name for this function, one way that should work is to have your server running and run this in console. lua_run print(CAMI.GetPrivileges()) That should return the exact format needed to itentify the privilages needed in the function as I am not certain if the privilages are going to be stored the same way as they are init. Just for the sake of this I’m just going to put in the string of the privilage though as I say I’m not sure, I’m simply just trying to understand this system based of reading the code and their documentation. Go to where the privilage is registered and create a new key in the table with a function that checks to return true if you have access. Should look something like this, this code is not perfect, to fully optimise it would be better to store the user groups in a table and check though the table than how it’s currently checking, though cba to do that right now CAMI.RegisterPrivilege{ Name = "FSpectate", MinAccess = "admin", HasAccess = function(CAMI_FSpectate, actPly, targPly) return actPly:IsSuperAdmin() or actPly:IsAdmin() or actPly:IsUserGroup(“moderator”) end }
Hello, I assume you wanted it to look like this? https://puu.sh/Csd0b.png You didn't quite explain what I do with the output of lua_run print(CAMI.GetPrivileges()) I got an output of "table: 0x24222570" but what's the use of it? Anyway, I still do not have access as moderator. Thanks for trying to help, I really appreciate it.
Ah in the case of it's a table change print to PrintTable Basically what this is going to do is return true if you are any of those. Reason it may not have worked is because the permission name is wrong, hence why the output of GetPrivileges is needed
Well we found the problem, changing sh_init.lua minaccess of FSpectate to Moderator doesn't actually change the minaccess of FSpectate https://puu.sh/Cspiv.png Log Output of lua_run PrintTable(CAMI.GetPrivileges()): FSpectate:                 MinAccess       =       admin                 Name    =       FSpectate
DarRP tends to overwrite functions yes, but as I said change everything back to default, MinAccess should be admin again. Change CAMI_FSpectate in the first part to “CAMI.FSpectate”. I think that’s how it wants this privilage to be accessed
Good News I managed to get it working!, for anyone else who has this problem here is what I did: Download FSpectate from here: GitHub Go to garrysmod\addons\FSpectate-master\lua\fspectate\sh_init.lua change the following code to this: if not CAMI then return end CAMI.RegisterPrivilege{     Name = "FSpectate",     MinAccess = "moderator", HasAccess = function(CAMI.FSpectate, actPly, targPly)return actPly:IsSuperAdmin() or actPly:IsAdmin() or actPly:IsUserGroup(“moderator”) end } CAMI.RegisterPrivilege{     Name = "FSpectateTeleport",     MinAccess = "moderator", HasAccess = function(CAMI.FSpectate, actPly, targPly)return actPly:IsSuperAdmin() or actPly:IsAdmin() or actPly:IsUserGroup(“moderator”) end } That's what I did, and it even did so for tmod which I don't even get how but it works, user and VIP groups don't have access while admin groups who should've had access now do have access. I assume you just need to add any ulx rank lower than admin (instead of moderator in the code) that you want to be able to FSpectate and give it FSpectate Permissions through ulx Menu.
Glad that it finally worked, sorry for being dumb for a few days at the beginning of this, should have read the documentation a bit better.
so apparently it was FAdmin's Access folder causing the problem, my fix did work but it only works if you remove the Access folder from FAdmin as well. I'm not quite sure if that's safe to do.. garrysmod\gamemodes\DarkRP\gamemode\modules\fadmin\fadmin\access I've tried to pinpoint the exact code but wasted over 5 hours on it just restarting over and over, it's a big pain.
Oh you’re on DarkRP? i thought you were just using the addon. You have to enable the FSpectate permission under the FAdmin group management option. You can find it on the scoreboard. Default DarkRP scoreboard it’s going to be easiest way to find this
Wow!, you're a life saver! it works! Just as a tip, do you know where it saves so I would be able to transfer the changes to my hosted server from my private one without turning custom scoreboard off and on? Thank you.
FAdmin perms save to sv.db in order to transfer the data you’re going to need to download both the database files and open them in an SQLite editor.
Yeah no worries I just did it on my own, thanks for the help anyhow though. This problem is now solved.
Sorry, you need to Log In to post a reply to this thread.