S7waj Posted June 14, 2020 Share Posted June 14, 2020 (edited) I need codes to make a sound on ped when spawn and death ( sound from desktop ) Edited June 14, 2020 by S7waj Link to comment
Sisqo0 Posted June 14, 2020 Share Posted June 14, 2020 (edited) See the example in wiki playSound Or playSound3D addEventHandler("onPedWasted") -- for ped not player Edited June 14, 2020 by Sisqo0 Link to comment
S7waj Posted June 14, 2020 Author Share Posted June 14, 2020 ok i will try it 6 hours ago, Sisqo0 said: playSound Or playSound3D addEventHandler("onPedWasted") -- for ped not player man i want to play sound on ped not on location i want to know playSound3D codes pls Link to comment
Sisqo0 Posted June 14, 2020 Share Posted June 14, 2020 (edited) @S7waj You want another example as well as in wiki? I don't know what you mean exactly Edited June 14, 2020 by Sisqo0 Link to comment
S7waj Posted June 14, 2020 Author Share Posted June 14, 2020 2 hours ago, Sisqo0 said: @S7waj You want another example as well as in wiki? I don't know what you mean exactly Like Zombie Moan Link to comment
Gribixtugaz Posted June 14, 2020 Share Posted June 14, 2020 local sound = playSound3D("sounds/song.mp3", 373.14, -125.21, 1001, true) local uSound = playSound3D('http://977music.com/itunes/80s.pls', 2498, -1659, 12) You can either download the sound from the internet and then redirect it with the first code i copied or if you want to stream it from somewhere else you use the second code. I'm no scripter myself so there's not much i can do to help you more on this. Hope i could help you out Link to comment
S7waj Posted June 14, 2020 Author Share Posted June 14, 2020 (edited) 13 minutes ago, Gribixtugaz said: local sound = playSound3D("sounds/song.mp3", 373.14, -125.21, 1001, true) local uSound = playSound3D('http://977music.com/itunes/80s.pls', 2498, -1659, 12) You can either download the sound from the internet and then redirect it with the first code i copied or if you want to stream it from somewhere else you use the second code. I'm no scripter myself so there's not much i can do to help you more on this. Hope i could help you out man i said i want it on ped not on location ( when ped move sound follow him ) Edited June 14, 2020 by S7waj Link to comment
Sisqo0 Posted June 14, 2020 Share Posted June 14, 2020 Ok i understood what you wanted --Client function attachsound () local ped = createPed(120,0,0,0) local x,y,z = getElementPosition( ped ) local sound = playSound3D( "sound", x, y, z, true) attachElements ( sound, ped) end Link to comment
S7waj Posted June 15, 2020 Author Share Posted June 15, 2020 4 hours ago, Sisqo0 said: Ok i understood what you wanted --Client function attachsound () local ped = createPed(120,0,0,0) local x,y,z = getElementPosition( ped ) local sound = playSound3D( "sound", x, y, z, true) attachElements ( sound, ped) end i will trry it Where's the Wrong Here? addEvent ( "tanks", true ) addEventHandler ( "tanks", root, function ( ) local x,y,z = getElementPosition( tanks ) local sound = playSound3D( "tank_spawn.wav", x,y,z, true) attachElements ( sound, tanks) end ) Link to comment
Sisqo0 Posted June 15, 2020 Share Posted June 15, 2020 maybe you didn't define "tanks" or you didn't add sound in meta.xml <file src="tank_spawn.wav" /> Link to comment
S7waj Posted June 15, 2020 Author Share Posted June 15, 2020 4 hours ago, Sisqo0 said: maybe you didn't define "tanks" or you didn't add sound in meta.xml <file src="tank_spawn.wav" /> sound is added and sound diden't start Link to comment
MrKAREEM Posted June 15, 2020 Share Posted June 15, 2020 local xPos,yPos,zPos local sound function onWasted() if isElement(sound) then destroyElement(sound) end sound = playSound3D( "tank_spawn.wav", xPos,yPos,zPos) setSoundMaxDistance(sound, 100) end addEventHandler("onClientPedWasted", getRootElement(), onWasted) function onSpawn() if isElement(sound) then destroyElement(sound) end sound = playSound3D( "tank_spawn.wav", xPos,yPos,zPos) setSoundMaxDistance(sound, 100) end addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), onSpawn ) function position() if isElement(sound) then xPos,yPos,zPos = getElementPosition(localPlayer) end end addEventHandler('onClientRender',root,position) use this and check your audio file extension if it .wav or not 12 hours ago, S7waj said: i will trry it Where's the Wrong Here? addEvent ( "tanks", true ) addEventHandler ( "tanks", root, function ( ) local x,y,z = getElementPosition( tanks ) local sound = playSound3D( "tank_spawn.wav", x,y,z, true) attachElements ( sound, tanks) end ) here you try to get position and attach elements to a nil value 'tanks' Link to comment
S7waj Posted June 15, 2020 Author Share Posted June 15, 2020 1 minute ago, MrKAREEM said: local xPos,yPos,zPos local sound function onWasted() if isElement(sound) then destroyElement(sound) end sound = playSound3D( "tank_spawn.wav", xPos,yPos,zPos) setSoundMaxDistance(sound, 100) end addEventHandler("onClientPedWasted", getRootElement(), onWasted) function onSpawn() if isElement(sound) then destroyElement(sound) end sound = playSound3D( "tank_spawn.wav", xPos,yPos,zPos) setSoundMaxDistance(sound, 100) end addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), onSpawn ) function position() if isElement(sound) then xPos,yPos,zPos = getElementPosition(localPlayer) end end addEventHandler('onClientRender',root,position) use this and check your audio file extension if it .wav or not here you try to get position and attach elements to a nil value 'tanks' ok MrKAREEM I will try it + do you remember me? i'am itsMessi on FFS Gaming 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