local weapFunc = { [26]={nil,0.4},[30]={'ak1',0.2},[31]={'M4',0.15},[29]={'MP5',0.1},[34]={'SNIPER',0.5},[24]={'deagle',0.05},[25]={'Shotgun',0.3},[27]={'Shotgun',0.3} }
local localPlayer = getLocalPlayer ( )
function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement )
local x,y,z = getPedWeaponMuzzlePosition ( source )
if(getDistanceBetweenPoints3D(x,y,z,px,py,pz) < 80) then
if weapFunc[weapon] then
if weapFunc[weapon][1] then
playSound3D ( "sounds/"..weapFunc[weapon][1]..".ogg")
end
if(source == localPlayer) then
createExplosion ( x,y,z + 10,12,false,weapFunc[weapon][2],false)
end
end
end
end
addEventHandler ( "onClientPlayerWeaponFire", getRootElement(), onClientPlayerWeaponFireFunc )
This command should play the sound for everyone in range but only the one who shoots hear this sounds.
Question
Deixell
local weapFunc = { [26]={nil,0.4},[30]={'ak1',0.2},[31]={'M4',0.15},[29]={'MP5',0.1},[34]={'SNIPER',0.5},[24]={'deagle',0.05},[25]={'Shotgun',0.3},[27]={'Shotgun',0.3} } local localPlayer = getLocalPlayer ( ) function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) local x,y,z = getPedWeaponMuzzlePosition ( source ) if(getDistanceBetweenPoints3D(x,y,z,px,py,pz) < 80) then if weapFunc[weapon] then if weapFunc[weapon][1] then playSound3D ( "sounds/"..weapFunc[weapon][1]..".ogg") end if(source == localPlayer) then createExplosion ( x,y,z + 10,12,false,weapFunc[weapon][2],false) end end end end addEventHandler ( "onClientPlayerWeaponFire", getRootElement(), onClientPlayerWeaponFireFunc )This command should play the sound for everyone in range but only the one who shoots hear this sounds.
Link to comment
3 answers to this question
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