-.Paradox.- Posted July 4, 2013 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
PaiN^ Posted July 4, 2013 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 )
-.Paradox.- Posted July 4, 2013 Author 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 ?
Castillo Posted July 4, 2013 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.
-.Paradox.- Posted July 4, 2013 Author 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
-.Paradox.- Posted July 5, 2013 Author Posted July 5, 2013 and i will never success, just give me an example.
#Al-Ha[J]aRii Posted July 5, 2013 Posted July 5, 2013 and i will never success, just give me an example. you want example for ?
Castillo Posted July 5, 2013 Posted July 5, 2013 The functions you have to use already got examples on the wiki, but you obviously ignore them.
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