Jump to content

Play a sound when someone throws a Grenade


Sockylite

Recommended Posts

Posted

Hi there! Hope y'all doing fine, so, today I'm here to know if it's possible to play a sound when someone throws a grenade, like "Fire In The Hole" or even "Grenade!"

Is that possible? o.O

Posted (edited)
function projectileCreation( creator )
	local projectileType = getProjectileType( source ) -- We get the projectile type
	if projectileType == 16 then -- If is grenade then...
		playsound3D("sound.mp3",getElementPosition(creator),false) --Play your grenade sound
	end
end
addEventHandler( "onClientProjectileCreation", getRootElement( ), projectileCreation )

for some reason i can't select LUA syntax...

Edited by loki2143
  • Like 1
Posted
3 minutes ago, Khadeer143 said:

We should need to add meta.XML also with this lua? Right then run it ?

You will have to add the sound file location in the meta.xml and then play it using PlaySound with the file path. For example:

<!-- Meta.xml-->
<meta>
  <file src="fileName.mp3" />
</meta>  
-- lua file
playSound("fileName.mp3")

 

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...