Tycka Posted October 4, 2014 Posted October 4, 2014 Hello, I have problem with new weapon sounds, I add some new items but how use new sounds to new weapons(I using new object on original weapon and dublicate it)? pls help, gamemode Dayz. And problem with snipers here is foto: http://i60.tinypic.com/2ufqb77.png Dayz (y)
darhal Posted October 4, 2014 Posted October 4, 2014 Use onClientPlayerWeaponFire and than use playSound3D on the weapon muzzle using getPedWeaponMuzzlePosition #include <iostream> int main() { std::cout << "C++ is amazing <3" << std::endl; return 0; } I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please
Anubhav Posted October 4, 2014 Posted October 4, 2014 One more function, setSoundMaxDistance See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
Tycka Posted October 4, 2014 Author Posted October 4, 2014 Use onClientPlayerWeaponFire and than use playSound3D on the weapon muzzle using getPedWeaponMuzzlePosition Can you give some example? Dayz (y)
darhal Posted October 4, 2014 Posted October 4, 2014 addEventHandler('onClientPlayerWeaponFire', getLocalPlayer(), function(id) local x, y, z = getPedWeaponMuzzlePosition(source) if id == 22 then local sound = playSound3D('colt45', x, y, z) setSoundMaxDistance(sound, 50) end end) #include <iostream> int main() { std::cout << "C++ is amazing <3" << std::endl; return 0; } I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please
Tycka Posted October 4, 2014 Author Posted October 4, 2014 addEventHandler('onClientPlayerWeaponFire', getLocalPlayer(), function(id) local x, y, z = getPedWeaponMuzzlePosition(source) if id == 22 then local sound = playSound3D('colt45', x, y, z) setSoundMaxDistance(sound, 50) end end) Didn't work Dayz (y)
darhal Posted October 4, 2014 Posted October 4, 2014 Didi you have the sound #include <iostream> int main() { std::cout << "C++ is amazing <3" << std::endl; return 0; } I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please
Tycka Posted October 4, 2014 Author Posted October 4, 2014 Didi you have the sound yes, I have. Here how I use it. addEventHandler('onClientPlayerWeaponFire', getLocalPlayer(), function(1) local x, y, z = getPedWeaponMuzzlePosition(source) if id == 34 then local sound = playSound3D('sounds/as50.waw', x, y, z) setSoundMaxDistance(sound, 50) end end And I have 3 sniper in 34Id, but with other object. Dayz (y)
darhal Posted October 4, 2014 Posted October 4, 2014 Well its function(id) and not function(1) #include <iostream> int main() { std::cout << "C++ is amazing <3" << std::endl; return 0; } I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please
Tycka Posted October 4, 2014 Author Posted October 4, 2014 Well its function(id) and not function(1) addEventHandler('onClientPlayerWeaponFire', getLocalPlayer(), function(id) local x, y, z = getPedWeaponMuzzlePosition(source) if id == 34 then local sound = playSound3D('sounds/as50.waw', x, y, z) setSoundMaxDistance(sound, 50) end end Still now working. That work but I can't use different sounds on 3 differents snipers. function disableSounds() setAmbientSoundEnabled( "gunfire", false ) end addEventHandler("onClientResourceStart",root,disableSounds) local function playGunfireSound(weaponID) local muzzleX, muzzleY, muzzleZ = getPedWeaponMuzzlePosition(source) local px, py, pz = getElementPosition ( source ) elseif weaponID == 34 then local sound = playSound3D("sounds/as50.waw", muzzleX, muzzleY, muzzleZ, false) setSoundMaxDistance(sound, 40) end end addEventHandler("onClientPlayerWeaponFire", root, playGunfireSound) Dayz (y)
darhal Posted October 4, 2014 Posted October 4, 2014 How you know that a player use x sniper and not y one ? #include <iostream> int main() { std::cout << "C++ is amazing <3" << std::endl; return 0; } I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please
Tycka Posted October 4, 2014 Author Posted October 4, 2014 How you know that a player use x sniper and not y one ? That code mod same sound for all 3 snipers. I want mode 3 sniper with different sounds. I think I need check sniper by name (But I dont know how.) Dayz (y)
darhal Posted October 4, 2014 Posted October 4, 2014 Object cant be a weapon you can get 1 weapon for 1 id and not 3 for one id #include <iostream> int main() { std::cout << "C++ is amazing <3" << std::endl; return 0; } I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please
Anubhav Posted October 4, 2014 Posted October 4, 2014 How can you expect it to work lol! function disableSounds() setAmbientSoundEnabled( "gunfire", false ) end addEventHandler("onClientResourceStart",root,disableSounds) local function playGunfireSound() local muzzleX, muzzleY, muzzleZ = getPedWeaponMuzzlePosition(source) local px, py, pz = getElementPosition ( source ) local weaponID = getElementModel(source) if weaponID == 34 then local sound = playSound3D("sounds/as50.waw", muzzleX, muzzleY, muzzleZ, false) setSoundMaxDistance(sound, 40) end end addEventHandler("onClientPlayerWeaponFire", root, playGunfireSound) Lol all can't check wiki See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
darhal Posted October 4, 2014 Posted October 4, 2014 You dont understand him ! #include <iostream> int main() { std::cout << "C++ is amazing <3" << std::endl; return 0; } I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please
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