SA-MP Forums Archive
HELP HEAD SHOT - 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: HELP HEAD SHOT (/showthread.php?tid=561030)



HELP HEAD SHOT - Mijata - 31.01.2015

HOW TO ADD HERE HEADSHOT ONLY IN HEAD

Код:
#include <a_samp>
#include <Shooter>
#pragma tabsize 0




#define COLOR_RED    0xFC3535FF
#define SERVER_MAX_PLAYERS 500


public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
   if (Shooter != INVALID_PLAYER_ID)
    {
        if (GetPlayerTeam(Target) == GetPlayerTeam(Shooter)) // check if the target is from the same team as the shooter.
        {

            new Float:hp;
            GetPlayerHealth(Target, hp);
            SetPlayerHealth(Target, hp + HealthLost);

        }
    }
    if ( Shooter != INVALID_PLAYER_ID )
    {
        if (GetPlayerTeam(Target) != GetPlayerTeam(Shooter)) // check if the target is not from the same team as the shooter.
        {
        if(GetPlayerWeapon(Shooter) == 33)
        {
            SetPlayerHealth(Target, 0);
            GameTextForPlayer(Target, "~r~Head Shot!", 3000, 3);
        }
        if(GetPlayerWeapon(Shooter) == 34)
        {
            SetPlayerHealth(Target, 0);
            GameTextForPlayer(Target, "~r~Head Shot!", 3000, 3);
        }
      }
    }
    return 1;
}
public OnPlayerDeath( playerid, killerid, reason )
{
    if( killerid != INVALID_PLAYER_ID ) // if killer is valid player
    {
        TogglePlayerSpectating( playerid, 1 ); // toggle the spectate to enabled for playerid
        PlayerSpectatePlayer( playerid, killerid ); // spectate the killer
        SetTimerEx( "OnPlayerStopSpectate", 5000, false, "i", playerid ); // set a timer that in 5 seconds it will stop spectating
    }
    return 1;
}



Re: HELP HEAD SHOT - 1fret - 31.01.2015

check this link

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

hope it helps you


Re: HELP HEAD SHOT - CalvinC - 31.01.2015

Use OnPlayerTakeDamage bodyparts.
If you don't know how, it's explained in my tutorial: https://sampforum.blast.hk/showthread.php?tid=558839.