xXGhostXx Posted October 18, 2018 Share Posted October 18, 2018 (edited) Hi all. I have a problem ! I making script for show online Admin ! If I was an admin, just show me. function adminOnline (thePlayer, command) local playerid = getElementData( thePlayer, "id" ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) outputChatBox("#ff4500[Admins]:", thePlayer, 255, 255, 255, true) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then outputChatBox("#ff0000Admin: #ffffff"..getPlayerName(thePlayer).." ("..playerid..") #ff0000Rank: #ffffffFounder", thePlayer, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "SuperModerator" ) ) then outputChatBox("#ff0000Admin: #ffffff"..getPlayerName(thePlayer).." ("..playerid..") #ff0000Rank: #ffffffDeveloper", thePlayer, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Moderator" ) ) then outputChatBox("#ff0000Admin: #ffffff"..getPlayerName(thePlayer).." ("..playerid..") #ff0000Rank: #ffffffDirector", thePlayer, 255, 255, 255, true) end end addCommandHandler("admins", adminOnline) What is problem ? @iMr.WiFi..! @Dimos7 @N3xT Please help me fast. Thanks. Edited October 18, 2018 by xXGhostXx Link to comment
LyricalMM Posted October 18, 2018 Share Posted October 18, 2018 (edited) The problem is that you put the variable "thePlayer" and that shows only to you if you are an admin, you need to get other player names and if the other players are admins. Edited October 18, 2018 by LyricalMM Link to comment
xXGhostXx Posted October 18, 2018 Author Share Posted October 18, 2018 3 minutes ago, LyricalMM said: The problem is that you put the variable "thePlayer" and that shows only to you if you are an admin, you need to get other player names and if the other players are admins. function adminOnline (thePlayer, command) local playerid = getElementData( thePlayer, "id" ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) outputChatBox("#ff4500[Admins]:", thePlayer, 255, 255, 255, true) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then outputChatBox("#ff0000Admin: #ffffff"..getPlayerName(player).." ("..playerid..") #ff0000Rank: #ffffffFounder", thePlayer, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "SuperModerator" ) ) then outputChatBox("#ff0000Admin: #ffffff"..getPlayerName(player).." ("..playerid..") #ff0000Rank: #ffffffDeveloper", thePlayer, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Moderator" ) ) then outputChatBox("#ff0000Admin: #ffffff"..getPlayerName(player).." ("..playerid..") #ff0000Rank: #ffffffDirector", thePlayer, 255, 255, 255, true) end end addCommandHandler("admins", adminOnline) It didn't work ! Please give me a write code. Link to comment
LyricalMM Posted October 18, 2018 Share Posted October 18, 2018 for example function getAdmins() local players = #getElementsByType("player") local admins = { } local accName = getAccountName ( getPlayerAccount ( value ) ) for key, value in ipairs(players) do if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then table.insert(admins,value) end end return admins end and local players = exports.yourScript:getAdmins() for k, arrayPlayer in ipairs(players) do if --your condition if it's admin-- then --your code end end Link to comment
xXGhostXx Posted October 18, 2018 Author Share Posted October 18, 2018 (edited) 1 hour ago, LyricalMM said: for example function getAdmins() local players = #getElementsByType("player") local admins = { } local accName = getAccountName ( getPlayerAccount ( value ) ) for key, value in ipairs(players) do if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then table.insert(admins,value) end end return admins end and local players = exports.yourScript:getAdmins() for k, arrayPlayer in ipairs(players) do if --your condition if it's admin-- then --your code end end It didn't work ! Please fix my code and give me code. Edited October 18, 2018 by xXGhostXx Link to comment
LyricalMM Posted October 19, 2018 Share Posted October 19, 2018 7 hours ago, SaNoR said: GetOnlineAdmins It is like the same that i gave him Link to comment
Abdul KariM Posted October 19, 2018 Share Posted October 19, 2018 https://wiki.multitheftauto.com/wiki/GetPlayersInGroup 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