Jump to content

help


Actimel

Recommended Posts

Posted

Hi i want replace sounds for weapons but when i change weapon id because its custom weapons and doesnt work but when i put id 30 AK then works but not on the custom weapon

 

addEventHandler("onClientPlayerWeaponFire", getRootElement(), 
function ( weapon, ammo, ammoInClip ) 
                local x,y,z = getElementPosition(source) 
                if weapon == 1834 then 
                local sound = playSound3D("sounds/AK74.wav", x,y,z) 
                setSoundVolume(sound,10) 
                setSoundMaxDistance(sound,75) 
        end 
    end 
) 

can someone help?

Posted
1 minute ago, NeXuS™ said:

Try debugging. Output the weapon into the chat. See if the event is called or not.

can you explain more better because my english not good :D

Posted
addEventHandler("onClientPlayerWeaponFire", getRootElement(), 
function ( weapon, ammo, ammoInClip )
	outputChatBox(weapon)
	local x,y,z = getElementPosition(source) 
	if weapon == 1834 then 
		local sound = playSound3D("sounds/AK74.wav", x,y,z) 
		setSoundVolume(sound,10) 
		setSoundMaxDistance(sound,75) 
	end 
end) 

 

  • Like 1
Posted
9 minutes ago, NeXuS™ said:

addEventHandler("onClientPlayerWeaponFire", getRootElement(), 
function ( weapon, ammo, ammoInClip )
	outputChatBox(weapon)
	local x,y,z = getElementPosition(source) 
	if weapon == 1834 then 
		local sound = playSound3D("sounds/AK74.wav", x,y,z) 
		setSoundVolume(sound,10) 
		setSoundMaxDistance(sound,75) 
	end 
end) 

 

now when i shoot it doesnt make sounds but spawns in chat id or something

  • MTA Team
Posted

He's trying to teach you how to test your scripts, to work out what's going wrong. This way you'll learn more.

Posted
Just now, LopSided_ said:

He's trying to teach you how to test your scripts, to work out what's going wrong. This way you'll learn more.

now got it thanks so much like understand he made outputChatBox(weapon) spawns weapon id

and i can easy find id of weapon

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...