Jump to content

outputChatBox depending setElementData?


Recommended Posts

Posted

Hello, in my server there's a key (F2) which sends an outputChatBox to rootElement with your Stats.

I want to add this: when you join the server, you've to choose between two images (SECTION1 and SECTION2).

I want to do that ONLY SECTION1 players (let's use getElementData) receive this outputChatBox, but SECTION2 don't.

How could I do this?

Posted
Post the code.

Not needed, I have just a GUI to choose Section1 and 2.

I want to do that if the player is Section1, he gets the outputChatBox.

Maybe a loop?

But I dunno how to do it.

Posted
Post the code.

Not needed, I have just a GUI to choose Section1 and 2.

I want to do that if the player is Section1, he gets the outputChatBox.

Maybe a loop?

But I dunno how to do it.

  • 2 months later...
Posted
Clear English please.

I think I was very clear...

I want to send an outputChatBox only to the users who have some certain elementData value, others cannot see the outputchatbboz

Posted

Putting this code dirrectly in the server side will not work correctly, you'll have to define the player element else the entire code will be failed to load.

Posted

KariiiM, I put that assuming he would know how to do it.

Any ways

     
function join () 
for i,player in pairs(getElementsByType("player") do 
if getElementData(player,"Test") == true then -- "Test" -> Set your element data here 
        outputChatBox("TEST",player) -- > Set your text Here 
          end 
      end 
  end 
  
addEventHandler ( "onPlayerJoin", getRootElement(), join ) 

Posted
KariiiM, I put that assuming he would know how to do it.

Yes Codly, I was just reminding him that's all.

By the way, this line number '2' is going to output an error, you forgot to add an ')' before do

      
for i,player in pairs(getElementsByType("player") do 
  

for _, player in ipairs ( getElementsByType ( "player" ) ) do 

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...