StefanAlmighty Posted November 21, 2015 Share Posted November 21, 2015 I have several admin ranks saved to a database and I have seperate functions for recognizing each admin rank. But now, I need a function which recognizes all admin ranks. Here is that function: function isPlayerAdmin(player) if not player or not isElement(player) or not getElementType(player) == "player" then return false end return isPlayerJuniorAdmin(player) or isPlayerGeneralAdmin(player) or isPlayerSeniorAdmin(player) or isPlayerHeadAdmin(player) or isPlayerCommunityDirector(player) end My issue is, it doesn't recognize the final "isPlayerCommunityDirector(player)" when using it in commands. For example I have an admin chat (/a) which uses "exports.chat:isPlayerAdmin(source)". It works for every admin except Community Directors, where it simply doesn't allow them to use the command. All of the others are able to use it. Here is the function, which works fine in any other scenario: function isPlayerCommunityDirector(player) if not player or not isElement(player) or not getElementType(player) == "player" then return false end local rank = getElementData(player, "admin_rank") or 0 return (rank >= 5) end Link to comment
Addlibs Posted November 21, 2015 Share Posted November 21, 2015 Can't you just check isPlayerAdmin through local rank = getElementData(player, "admin_rank") or 0 if rank >= 1 then -- if 1 or greater This would include all admin ranks Link to comment
StefanAlmighty Posted November 22, 2015 Author Share Posted November 22, 2015 What about if I added my other ranks? function isPlayerAdmin(player) if not player or not isElement(player) or not getElementType(player) == "player" then return false end return isPlayerJuniorAdmin(player) or isPlayerGeneralAdmin(player) or isPlayerSeniorAdmin(player) or isPlayerHeadAdmin(player) or isPlayerCommunityDirector(player) or isPlayerHelper(player) or isPlayerScripter(player) end getElementData(player, "scripter_rank") getElementData(player, "helper_rank") Link to comment
Addlibs Posted November 22, 2015 Share Posted November 22, 2015 local rankAdm = getElementData(player, "admin_rank") or 0 local rankHlp = getElementData(player, "helper_rank") or 0 local rankScr = getElementData(player, "scripter_rank") or 0 if rankAdm >= 1 or rankHlp >= 1 or rankScr >=1 then -- if any is 1 or greater Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now