Actimel Posted March 26, 2017 Posted March 26, 2017 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?
NeXuS™ Posted March 26, 2017 Posted March 26, 2017 Try debugging. Output the weapon into the chat. See if the event is called or not.
Actimel Posted March 26, 2017 Author Posted March 26, 2017 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
NeXuS™ Posted March 26, 2017 Posted March 26, 2017 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) 1
Actimel Posted March 26, 2017 Author Posted March 26, 2017 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 Lpsd Posted March 26, 2017 MTA Team Posted March 26, 2017 He's trying to teach you how to test your scripts, to work out what's going wrong. This way you'll learn more.
Actimel Posted March 26, 2017 Author Posted March 26, 2017 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
Abdul KariM Posted March 26, 2017 Posted March 26, 2017 Did you mean custom weapons this ? createWeapon
aka Blue Posted March 26, 2017 Posted March 26, 2017 Where are you from? There are language subforums for people who dont know how to talk English...
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