Sande Posted November 19, 2013 Share Posted November 19, 2013 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
Castillo Posted November 19, 2013 Share Posted November 19, 2013 playSound is client side only, which means if you use the command, all the sounds will be only heard by the player that used the command. Link to comment
Sande Posted November 20, 2013 Author Share Posted November 20, 2013 I getted it work, and how: Il do the player check in server side, and then triggerclient event the sound. but thanks. 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