Jump to content

Playing A Sound?


Maccer.

Recommended Posts

Posted

Well, I tried to use a sound, but it fails. Obviously, I defined it in the meta.xml and it downloaded. Here's the code.

addEventHandler("onClientPlayerDamage", getLocalPlayer(),
function (attacker, weapon, bodypart, loss)
	if bodypart == 9 then
		local sound = playSound("fu_neck.mp3")
		setSoundVolume(sound, 0.75)
		setGameSpeed(0.3)
	end
end
)

Not sure why it won't play. :? Yes it's a client-side script.

Posted

Because of the game speed? I'm 99% sure that game speed affects sounds, even original ingame sounds. If the game speed is too low you won't hear any music in your car, so that might be game speed issue.

Posted (edited)
Because of the game speed? I'm 99% sure that game speed affects sounds, even original ingame sounds. If the game speed is too low you won't hear any music in your car, so that might be game speed issue.

I tried removing the gamespeed. It still doesn't work. Plus the libary is external, why should it not play during slow downs?

Edited by Guest
Posted
Is the event triggered at all?

Does it have to be? Because this client-script isn't triggered but does its job. (addEventHandler BTW)

In-case anyone is interested. The server shows up as "Maccer's Test Server"

Posted

Every event is triggered when something occurs. Are you sure it's triggered? Try onClientPedDamage too.

Posted
Every event is triggered when something occurs. Are you sure it's triggered? Try onClientPedDamage too.

I even tried it on spawn. It just won't play anywhere.

Posted
Try to see what playSound returned. Eg:
outputDebugString( tostring( sound ) )

It returns false. ): Not sure why.

^ The meta.xml, I see nothing wrong with it though.

Edit: I fixed it! :D I removed the "type" attribute. Apparently it caused problems.

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