Jump to content

outputChatBox something for people who has "Admin" as elementData?


TrickyTommy

Recommended Posts

Hi! I want to send a message for the people, who has "Admin" as an element Data. This is what i could do so far:
 

function sendMessageToAdmins(msg)
	for k, v in ipairs (getElementsByType("player")) do
		if getElementData (v, "Admin", true) then
			outputChatBox (msg, v) end
end

dunno how to continue. :( 

Link to comment
8 minutes ago, NeXuS™ said:

The "true" in your getElementData is not required, as it's optional arguments is true too. Does this not work, or what? You miss an "end", maybe thats why.

Actually, i found the piece of code on Wikipedia, but i don't really know what this part "k, v in ipairs" of the code does. I looked it up, but did not really understand the explanations. 

Link to comment
1 hour ago, TrickyTommy said:

Hi! I want to send a message for the people, who has "Admin" as an element Data. This is what i could do so far:
 


function sendMessageToAdmins(msg)
	for k, v in ipairs (getElementsByType("player")) do
		if getElementData (v, "Admin", true) then
			outputChatBox (msg, v) end
end

dunno how to continue. :( 

function sendMessageToAdmins(msg)
	for i, admin in pairs (getElementsByType("player")) do
		if getElementData (admin, "Admin") then
			outputChatBox ("ADMIN Message: ".. msg, admin) 
		end
	end
end

 

  • Thanks 1
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...