Jump to content

[HELP] Admins Online


xXGhostXx

Recommended Posts

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 by xXGhostXx
Link to comment
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

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
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 by xXGhostXx
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...