-.Paradox.- Posted November 4, 2013 Posted November 4, 2013 So i made this music player but i want to reduce it into a table, & play every sound with command /music test1 /music test2 etc thanks for helping Client ------americano function music10( name ) local sound = playSound("music/amricano.mp3") setSoundVolume(sound, 50) setSoundMaxDistance( sound, 5000 ) end addEvent( "amricano", true ) addEventHandler( "amricano", getRootElement(), music10 ) ------joker function music9( name ) local sound = playSound("music/joker.mp3") setSoundVolume(sound, 50) setSoundMaxDistance( sound, 5000 ) end addEvent( "joker", true ) addEventHandler( "joker", getRootElement(), music9 ) ------badboy function music8( name ) local sound = playSound("music/badboys.mp3") setSoundVolume(sound, 50) setSoundMaxDistance( sound, 5000 ) end addEvent( "badboys", true ) addEventHandler( "badboys", getRootElement(), music8 ) --------- boys ... ---------- function music7( name ) local sound = playSound("music/boysboysboys.mp3") setSoundVolume(sound, 50) setSoundMaxDistance( sound, 5000 ) end addEvent( "boysboysboys", true ) addEventHandler( "boysboysboys", getRootElement(), music7 ) Server ----americano function music(player, cmd) local name = getPlayerName(player) local r,g,b = getPlayerNametagColor (player) local accountname = getAccountName (getPlayerAccount(player)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "vip" ) ) then outputChatBox ( "" .. name .. ": #2600FF We No Speak Americano.", getRootElement(), r, g, b, true ) triggerClientEvent ("amricano", getRootElement()) else outputChatBox ( "this command for vip group", player, 255, 0, 0, true ) return end end addCommandHandler("amricano", music) ----joker function music(player, cmd) local name = getPlayerName(player) local r,g,b = getPlayerNametagColor (player) local accountname = getAccountName (getPlayerAccount(player)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "vip" ) ) then outputChatBox ( "" .. name .. ": #2600FF Giggle bitch.", getRootElement(), r, g, b, true ) triggerClientEvent ("joker", getRootElement()) else outputChatBox ( "this command for vip group", player, 255, 0, 0, true ) return end end addCommandHandler("joker", music) ----badboys function music(player, cmd) local name = getPlayerName(player) local r,g,b = getPlayerNametagColor (player) local accountname = getAccountName (getPlayerAccount(player)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "vip" ) ) then outputChatBox ( "" .. name .. ": #2600FF is a good boy.", getRootElement(), r, g, b, true ) triggerClientEvent ("badboys", getRootElement()) else outputChatBox ( "this command for vip group", player, 255, 0, 0, true ) return end end addCommandHandler("isagoodboy", music) -----boysboysboys-------- addCommandHandler("music.boysboysboys", function (player, cmd) local name = getPlayerName(player) local r,g,b = getPlayerNametagColor (player) local accountname = getAccountName (getPlayerAccount(player)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "vip" ) ) then outputChatBox ( "" .. name .. ": #2600FF boys boys boys.", getRootElement(), r, g, b, true ) triggerClientEvent ("boysboysboys", getRootElement()) else outputChatBox ( "this command for vip group", player, 255, 0, 0, true ) return end end ) I want it like that /music joker it play joker sound /music badboys it plays bad boys sound etc If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
xXMADEXx Posted November 4, 2013 Posted November 4, 2013 You need to make another argument for the "music" function. The Ultimate Lua Tutorial! | MTA PHP SDK
-.Paradox.- Posted November 4, 2013 Author Posted November 4, 2013 how? If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
RoMaNd! Posted November 4, 2013 Posted November 4, 2013 What in server Name In MTA : Mr.I6FraN||71|| Servers Join : GTA-AR / MGP
-.Paradox.- Posted November 4, 2013 Author Posted November 4, 2013 It's working good, but i want to reduce it into table and add a command /music [musicname] to get the music from table ['joker'] = ['music/joker.mp3'] or something like that If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Dealman Posted November 4, 2013 Posted November 4, 2013 You could easily google to find out how to work with tables in LUA. There are multiple ways of achieving what you want. It's just a matter of what you prefer and what you find the most efficient. Alternatively you could take a look at the Radio I made, since that uses a table for streaming internet radios. You'll need to modify it a bit, of course. But should point you in the right direction. If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
-.Paradox.- Posted November 4, 2013 Author Posted November 4, 2013 Can somebody help me with a code, because idk how to get the command from table and location too. If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Castillo Posted November 5, 2013 Posted November 5, 2013 What do you mean? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
-.Paradox.- Posted November 5, 2013 Author Posted November 5, 2013 Just a code, i want in it a table of music locations and command for it If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
pa3ck Posted November 5, 2013 Posted November 5, 2013 Like: music = { {"mymusic.mp3"}, {"mymusic2.mp3"}, } addCommandHandler('music', function(cmd, song) if song == '1' then playSound(music[1]) elseif song == '2' then playSound(music[2]) end end) Is that what you need? This might be easier: music = { {"mymusic.mp3"}, {"mymusic2.mp3"}, } addCommandHandler('music', function(cmd, song) local num = tonumber(song) if num and num > 0 and num < 3 then playSound(music[num]) else outputChatBox('Invalid song number', 255, 0, 0) end end)
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