HELP HEAD SHOT
#1

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;
}
Reply
#2

check this link

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

hope it helps you
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)