manawydan Posted January 8, 2013 Share Posted January 8, 2013 function jedi(weaponID) local muzzleX, muzzleY, muzzleZ = getPedWeaponMuzzlePosition(source) local px, py, pz = getElementPosition ( source ) if weaponID == 8 then local sound = playSound3D("jedi.mp3", muzzleX, muzzleY, muzzleZ, false) setSoundMaxDistance(sound, 40) end end addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), jedi ) what went wrong? Link to comment
manawydan Posted January 8, 2013 Author Share Posted January 8, 2013 the sound is not out Link to comment
Castillo Posted January 8, 2013 Share Posted January 8, 2013 The weapon ID 8 is a katana, onClientPlayerWeaponFire only works with weapons that can shot. Link to comment
manawydan Posted January 8, 2013 Author Share Posted January 8, 2013 has another function to be activated when a katana hit? I want to change the sound of it Link to comment
Castillo Posted January 8, 2013 Share Posted January 8, 2013 You can do: onClientKey or bindKey isControlEnabled Link to comment
manawydan Posted January 8, 2013 Author Share Posted January 8, 2013 function jedi(weaponID, Player) local muzzleX, muzzleY, muzzleZ = getPedWeaponMuzzlePosition(Player) local px, py, pz = getElementPosition ( Player ) if weaponID == 8 and isControlEnabled ( player, "fire" ) then local sound = playSound3D("jedi.mp3", muzzleX, muzzleY, muzzleZ, false) setSoundMaxDistance(sound, 40) end end addEventHandler ( "onClientResourceStart", getRootElement(), jedi ) this right? never used isControlEnabled Link to comment
Castillo Posted January 8, 2013 Share Posted January 8, 2013 I said onClientKey, not onClientResourceStart. Try this: function jedi ( ) local muzzleX, muzzleY, muzzleZ = getPedWeaponMuzzlePosition ( localPlayer ) local px, py, pz = getElementPosition ( localPlayer ) local weaponID = getPedWeapon ( localPlayer ) if ( weaponID == 8 and isControlEnabled ( "fire" ) ) then local sound = playSound3D ( "jedi.mp3", muzzleX, muzzleY, muzzleZ, false ) setSoundMaxDistance ( sound, 40 ) end end bindKey ( "fire", "down", jedi ) Link to comment
manawydan Posted January 8, 2013 Author Share Posted January 8, 2013 thank you very much. Link to comment
manawydan Posted January 8, 2013 Author Share Posted January 8, 2013 https://community.multitheftauto.com/ind ... ls&id=6277 thank you very much 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