Need help with OnPlayerTakeDamage
#1

this is my code

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
     if(!IsPlayerConnected(playerid)) return 0;
     if(!IsPlayerConnected(issuerid)) return 0;
     if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)
     {
        SetPlayerHealth(playerid, 0.0);
        GameTextForPlayer(playerid, "PWNED", 5000, 3);
        GameTextForPlayer(issuerid, "HEADSHOT", 5000, 3);
        PlayerPlaySound(issuerid,1147,0.0,0.0,0.0);
     }
     else if(issuerid != INVALID_PLAYER_ID)
        {
        PlayerPlaySound(issuerid,6401,0,0,0);
    	}
     return 1;
}
I want to play ding sound when we hit someone but its not working,if you guys could help me out.
Reply
#2

u want it for the killer or killing player?

use this for it,
Код:
PlayerPlaySound(issuerid,17802,0.0,0.0,0.0);
Reply
#3

I want to play it for the hitter
Reply
#4

If you saw my code you can see i already added it below
Reply
#5

i have seen
Reply
#6

https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage

playerid The ID of the player that took damage.
issuerid The ID of the player that caused the damage. INVALID_PLAYER_ID if self-inflicted.
Reply
#7

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
     if(!IsPlayerConnected(playerid)) return 0;
     if(!IsPlayerConnected(issuerid)) return 0;
    if(issuerid != INVALID_PLAYER_ID )
 {
     if( weaponid == 34 && bodypart == 9)
     {
        SetPlayerHealth(playerid, 0.0);
        GameTextForPlayer(playerid, "PWNED", 5000, 3);
        GameTextForPlayer(issuerid, "HEADSHOT", 5000, 3);
        PlayerPlaySound(issuerid,1147,0.0,0.0,0.0);
     }
     else 
        {
        PlayerPlaySound(issuerid,6401,0,0,0);
    	}
  }
     return 1;
}
Reply
#8

still not working
EDIT: The id of the sound was not working,replaced it and its fine now

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
     if(!IsPlayerConnected(playerid)) return 0;
     if(!IsPlayerConnected(issuerid)) return 0;
     if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)
     {
        SetPlayerHealth(playerid, 0.0);
        GameTextForPlayer(playerid, "PWNED", 5000, 3);
        GameTextForPlayer(issuerid, "[HEADSHOT]", 5000, 3);
        PlayerPlaySound(issuerid,1131,0.0,0.0,0.0);
     }
     else 
     {
        PlayerPlaySound(issuerid,6401,0,0,0);
     }
     return 1;
}
Reply
#9

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
   if(issuerid != INVALID_PLAYER_ID)
   {
      PlayerPlaySound(issuerid,17802,0.0,0.0,0.0);
   }
   if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)
   {
      SetPlayerHealth(playerid, 0.0);
      GameTextForPlayer(playerid, "PWNED", 5000, 3);
      GameTextForPlayer(issuerid, "[HEADSHOT]", 5000, 3);
   }
   return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)