Jump to content

[HELP] Voice and text system


Sande

Recommended Posts

Hey, im trying to make a command what puts text and voice to players who have elementData "metroLippu" true. But now the problem is, the count of element datas like example 4, and if i do the command il get 4 x sounds, and 4x text to the chat. Only me, other players who have that element data true doesn´t hear anything or get the message to the chat. Only they who use the command. Can someone help me, it needs to work like, i can write the command and then all players who have that elementData true hear that sound, and get message to chat. That is so inportant to me please help, or fix the whole code. Thanks :9

BTW: code is clientside, and sounds added to meta.xml.

function kuulutus1() 
local players = getElementsByType ( "player" ) -- get a table of all the players in the server 
for theKey,thePlayer in ipairs(players) do  
if getElementData ( thePlayer, "metroLippu") == true then 
    outputChatBox("[Metro] Hyvät matkustajat, jatkamme matkaa hetken kuluttua.", thePlayer, 0,255,0) 
    local kuulutus = playSound("kuulutus/m1.mp3") 
    setSoundVolume(kuulutus, 2.0) 
    end 
    end 
    end 
    addCommandHandler("metro-k1", kuulutus1 ) 

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