-.Paradox.- Posted July 4, 2013 Share Posted July 4, 2013 Hello, i need help with this script i want add getPlayerName Function here is the lua function cmdPlaySound(cmd, file) if not file then return outputChatBox("[uSAGE] /startmusic [name]", getLocalPlayer()); end if playSound("sounds/" .. file .. ".mp3") then outputChatBox(Is Playing " .. file,255,255,255); end end addCommandHandler("startmusic", cmdPlaySound); i want when player start music it show on chatbox like example if playSound("sounds/" .. file .. ".mp3") then outputChatBox(..getPlayerName..#0096FFIs Playing " .. file,255,255,255); end Link to comment
PaiN^ Posted July 4, 2013 Share Posted July 4, 2013 To output the message to every one in chat, You'll have to send a trigger to the server-side, Because outputChatBox client-side dosn't have a element argument . I'v fixed the code, The trigger is on you : function cmdPlaySound( cmd, file ) if not file then return outputChatBox( "[uSAGE] /startmusic [name]" ) end if playSound ( "sounds/" .. file .. ".mp3" ) then outputChatBox( "Is Playing " .. file, 255, 255, 255 ) end end addCommandHandler( "startmusic", cmdPlaySound ) Link to comment
-.Paradox.- Posted July 4, 2013 Author Share Posted July 4, 2013 no no not that, when a player start the music i want to show like example Steven:Is playing..file.. Anything else ? Link to comment
Castillo Posted July 4, 2013 Share Posted July 4, 2013 Well, you'll have to either make command server side, and then trigger to play the sound, or make a trigger from the client side to show what is the player playing. Link to comment
-.Paradox.- Posted July 4, 2013 Author Share Posted July 4, 2013 i have server side here is it function cmdInstallSound(player, cmd, file) if not file then outputChatBox("[uSAGE] /installsound [sound name]", player); end local xml, soundNode; xml = xmlLoadFile(":soundplayer/meta.xml"); soundNode = xmlCreateChild(xml, "file"); xmlNodeSetAttribute(soundNode, "src", "sounds/" .. file .. ".mp3"); xmlSaveFile(xml); xmlUnloadFile(xml); if restartResource(getThisResource()) then outputChatBox("The sound file is installed, use /playsound " .. file, player); else outputChatBox("Restart this resource please", player); end end addCommandHandler("installsound", cmdInstallSound); can you do it to me please Link to comment
Castillo Posted July 4, 2013 Share Posted July 4, 2013 Can you at least try to do it? Link to comment
-.Paradox.- Posted July 4, 2013 Author Share Posted July 4, 2013 ok what i need to do now ? Link to comment
Castillo Posted July 4, 2013 Share Posted July 4, 2013 I already told you what to do. Link to comment
-.Paradox.- Posted July 4, 2013 Author Share Posted July 4, 2013 can you make it to me please Link to comment
-.Paradox.- Posted July 4, 2013 Author Share Posted July 4, 2013 i dont know how to make it Link to comment
PaiN^ Posted July 5, 2013 Share Posted July 5, 2013 Well he's not gonna help until you try . Link to comment
-.Paradox.- Posted July 5, 2013 Author Share Posted July 5, 2013 and i will never success, just give me an example. Link to comment
-.Paradox.- Posted July 5, 2013 Author Share Posted July 5, 2013 Can somebody help me ? Link to comment
#Al-Ha[J]aRii Posted July 5, 2013 Share Posted July 5, 2013 and i will never success, just give me an example. you want example for ? Link to comment
#Al-Ha[J]aRii Posted July 5, 2013 Share Posted July 5, 2013 I mean you want example for witch function ??? Link to comment
Castillo Posted July 5, 2013 Share Posted July 5, 2013 The functions you have to use already got examples on the wiki, but you obviously ignore them. 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