SA-MP Forums Archive
Need help with OnPlayerTakeDamage - 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: Need help with OnPlayerTakeDamage (/showthread.php?tid=563031)



Need help with OnPlayerTakeDamage - Nabster - 13.02.2015

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.


Re: Need help with OnPlayerTakeDamage - Rog - 13.02.2015

u want it for the killer or killing player?

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



Re: Need help with OnPlayerTakeDamage - Nabster - 13.02.2015

I want to play it for the hitter


Re: Need help with OnPlayerTakeDamage - Nabster - 13.02.2015

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


Re: Need help with OnPlayerTakeDamage - Rog - 13.02.2015

i have seen


Re: Need help with OnPlayerTakeDamage - JonathanFeitosa - 13.02.2015

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.


Re: Need help with OnPlayerTakeDamage - MBilal - 13.02.2015

Код:
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;
}



Re: Need help with OnPlayerTakeDamage - Nabster - 14.02.2015

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;
}



Re: Need help with OnPlayerTakeDamage - ReD_HunTeR - 14.02.2015

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;
}