BorderLine Posted November 14, 2011 Share Posted November 14, 2011 hi again people of forums well im try to make this script i want sound in weapons but with some distannce. my bug is.. dont sound like 3d sound.. if you are away from others players.. you can hear the others weapons sounds.. so im do this.. i dont know what is wrong.. the sounds are good.. but dont wokr the 3d sound Clientside function onClientPlayerWeaponFire ( weapon ) local Zx, Zy, Zz = getPedWeaponMuzzlePosition ( getLocalPlayer() ) if weapon == 22 then--colt45 local sound = playSound3D("sounds/Colt45.mp3", Zx, Zy, Zz, false) setSoundMaxDistance(sound, 30) end end addEventHandler ( "onClientPlayerWeaponFire", getRootElement(), onClientPlayerWeaponFire ) The resource is more bigger.. but this is the example thanks Link to comment
AGENT_STEELMEAT Posted November 14, 2011 Share Posted November 14, 2011 What exactly is wrong? Is the sound not playing at all, is it too loud, being heard from to great a distance? Be specific. Link to comment
bandi94 Posted November 14, 2011 Share Posted November 14, 2011 hi again people of forums well im try to make this script i want sound in weapons but with some distannce. my bug is.. dont sound like 3d sound.. if you are away from others players.. you can hear the others weapons sounds.. so im do this.. i dont know what is wrong.. the sounds are good.. but dont wokr the 3d sound i think he explain you the sound is begin played but you can hear it from distance i took a quick look at the script and look's fine you tryed whit that scirpt ? Link to comment
AGENT_STEELMEAT Posted November 14, 2011 Share Posted November 14, 2011 i think he explain you the sound is begin played but you can hear it from distance i took a quick look at the script and look's fine you tryed whit that scirpt ? Nevermind. local function playGunfireSound(weaponID) local muzzleX, muzzleY, muzzleZ = getPedWeaponMuzzlePosition(source) if weaponID == 22 then --colt45 local sound = playSound3D("sounds/Colt45.mp3", muzzleX, muzzleY, muzzleZ, false) setSoundMaxDistance(sound, 30) end end addEventHandler("onClientPlayerWeaponFire", root, playGunfireSound) 1 - This function does not need to be global, so make it local. 2 - It is not a good practice to have function names the same as event names. 3 - You want to find the muzzle position of the source player (the player who shot the weapon), not the local player. If the local player does shoot, however, source will be the local player. So use source. Link to comment
BorderLine Posted November 14, 2011 Author Share Posted November 14, 2011 perfect.. is working.. thanks a loot again 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