How to add ding sound when you damage a player
#1

Can someone tell me how to add the 'ding' sound when you hit a player?
Reply
#2

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.
Reply
#3

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
Reply
#4

Thanks for both of you, +REP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)