SA-MP Forums Archive
Hit Sound - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Hit Sound (/showthread.php?tid=533317)



Hit Sound - Leasbone - 23.08.2014

Hi everyone. I'm looking for bullet hit sound name in this video http://www.youtube.com/watch?v=CGxyY...ature=*********

How can i add this sound to my gamemode script I'm using samp 0.3z.

I'm new in forum, sorry for my bad english and mistakes.


Re: Hit Sound - rymax99 - 23.08.2014

Under the 'OnPlayerTakeDamage' callback put:
pawn Код:
PlayerPlaySound(issuerid, 17802, 0, 0, 0);



Re: Hit Sound - iSkate - 23.08.2014

You can use PlayerPlaySound to play San Andreas' in-built sound "Ding". The ID of that sound is 17802, not quite sure.
Use the function OnPlayerGiveDamage to create the sound for the player (playerid in OnPlayerGiveDamge and targetid in OnPlayerTakeDamage)who is getting damage. When a player will shoot someone (successfully) or in other words, give damage, then the sound will be played if you use such method as stated below.

pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
    PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0); // Ding Sound
    return 1;
}
You can also use OnPlayerTakeDamageinstead of OnPlayerGiveDamge. They both are almost the same. There is also an include which has a function OnPlayerShootPlayer which is a little more advanced (in my opinion). OPSP - by wups.

EDIT: OPSP is an include which should be downloaded. OnPlayerGive/TakeDamage and OnPlayerWeaponShot are in-built (I guess I'm using the right word....) as stated by Abagail.


Re: Hit Sound - Abagail - 23.08.2014

Why use OPSP? - There's a function you can use with no includes needed called OnPlayerWeaponShot, which gives the coordinates, and everything. No need to download anything new when you have what you need right here.


Re: Hit Sound - iSkate - 23.08.2014

You are quite right. I just stated OPSP because I only thought it was a little (teeny tiny) more advanced than the in-built callbacks for damages and shots.


Re: Hit Sound - HazardouS - 23.08.2014

As inshal said, you should use the ding sound under OnPlayerGiveDamage, because OnPlayerTakeDamage gets called every time a player takes damage, so you would hear a sound whenever a vehicle hits you or you fall from a building or something like that.


Re: Hit Sound - Leasbone - 23.08.2014

Thanks it worked, but i got simple error how can i fix it:
Код:
warning 235: public function lacks forward declaration (symbol "OnPlayerTakeDamage")
Thank you again


Re: Hit Sound - iSkate - 23.08.2014

Download the latest 0.3z includes. If you have done so and it still gives errors, it simply means that you have multiple version of pawno.

-Forgot to quote. Too lazy to go back and quote.