How to add ding sound when you damage a player - 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: How to add ding sound when you damage a player (
/showthread.php?tid=433437)
How to add ding sound when you damage a player -
Hitman-97- - 27.04.2013
Can someone tell me how to add the 'ding' sound when you hit a player?
Re: How to add ding sound when you damage a player -
Lordzy - 27.04.2013
You can do that using 'PlayerPlaySound' function to play the sound and 'OnPlayerTakeDamage' and play the sound to the issuerid.
Code:
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID) //If issuer isn't a invalid player. (!= means not equal to)
{ //Then
PlayerPlaySound(playerid, 6401, 0.0, 0.0, 0.0); //Plays a sound of kinda bell.
//if you need it for the guy who takes damage, change 'playerid' to issuerid.
}
return 1;
}
Can annoy the player if the sound is played many times as he/she hits a player.
Re: How to add ding sound when you damage a player -
RajatPawar - 27.04.2013
pawn Код:
#define DING_SOUND_ID 1111
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID)
{
PlayerPlaySound(playerid, DING_SOUND_ID, 0.0, 0.0, 10.0);
}
return 1;
}
EDIT: Late, ignore
Re: How to add ding sound when you damage a player -
Hitman-97- - 28.04.2013
Thanks for both of you, +REP