samp.directory
← Scripts e bibliotecas

Bren828/HitMarker-SA-MP

A lightweight, highly customizable hitmarker library for SA-MP

Biblioteca★ 4atualizado mai. de 2026GPL-3.0Pawn
Abrir no GitHub

README.md

HitMarker SA-MP

A lightweight, highly customizable hitmarker library for SA-MP

Main features

  • Customizable colors for different body parts and vehicles.
  • Weapon exclusion: disable the marker for specific weapons (e.g., vehicle weapons).
  • Audio feedback: play a sound on every successful hit.
  • Fully adjustable: set custom position and size for the marker.

Reference

Installation

Include in your code and begin using the library:

#include <hitmarker>

Example

CMD:hitmarker(playerid) {

    if(!IsHitmarkerEnabled(playerid)) {

        HitmarkerEnable(playerid);

        // Setting the hit colors
        SetHitmarkerColor(playerid, HITMARKER_BODYPART_TORSO, 0xFFFFFFFF);
        SetHitmarkerColor(playerid, HITMARKER_BODYPART_GROIN, 0x7CFC00FF);
        SetHitmarkerColor(playerid, HITMARKER_BODYPART_LEFT_ARM, 0xFFA500FF);
        SetHitmarkerColor(playerid, HITMARKER_BODYPART_RIGHT_ARM, 0xFFD700FF);
        SetHitmarkerColor(playerid, HITMARKER_BODYPART_LEFT_LEG, 0x00BFFFFF);
        SetHitmarkerColor(playerid, HITMARKER_BODYPART_RIGHT_LEG, 0x00FFFFFF);
        SetHitmarkerColor(playerid, HITMARKER_BODYPART_HEAD, 0xFF00FFFF);

        SetHitmarkerColor(playerid, HITMARKER_COLOR_KILLSHOT, 0xFF0000FF);
        SetHitmarkerColor(playerid, HITMARKER_COLOR_VEHICLE, 0xB03060FF);

        ToggleHitmarkerVehicleDamage(playerid, true);

        ToggleHitmarkerWeapon(playerid, WEAPON_BAT, true);
        ToggleHitmarkerWeapon(playerid, HITMARKER_AIR_WEAPON_MINIGUN, true);

        GameTextForPlayer(playerid, "Hitmarker ~g~~h~On", 1200, 4);
    }
    else {
        HitmarkerDisable(playerid);
        GameTextForPlayer(playerid, "Hitmarker ~r~~h~Off", 1200, 4);
    }
    return 1;
}

Functions

HitmarkerEnable(playerid)

Enables the hitmarker for a player.

  • playerid - The ID of the player
HitmarkerDisable(playerid)

Disables the hitmarker for a player.

  • playerid - The ID of the player
IsHitmarkerEnabled(playerid)

Checks if the hitmarker is enabled.

  • playerid - The ID of the player
  • Return (true) if enabled or (false) if disabled
SetHitmarkerColor(playerid, type, color)

Set hitmarker color

  • playerid - The ID of the player
  • type - Color Ids
  • color - The color to set. Supports alpha values.
GetHitmarkerColor(playerid, type)

Get hitmarker color

  • playerid - The ID of the player
  • type - Color Ids
  • Returns the color
ToggleHitmarkerWeapon(playerid, weaponid, bool:toggle)

Disable the hitmarker for a specific weapon

  • playerid - The ID of the player
  • weaponid - Weapon IDs
  • toggle - true to disable / false to enable
  • Disabling certain firearms also affects associated weapons (IDs: 18, 37).
  • Disabling explosive weapons also affects associated weapons (IDs: 16, 35, 36, 39, 51). This rule does not apply to air transport.
IsHitmarkerWeaponDisabled(playerid, weaponid)

Get hitmarker status for a certain weapon

  • playerid - The ID of the player
  • weaponid - Weapon IDs
  • Return (true) if disabled or (false) if enabled
SetHitmarkerSoundDamage(playerid, soundid)

Enable hit sound

  • playerid - The ID of the player
  • soundid - Sound IDs
GetHitmarkerSoundDamage(playerid)

Get current hit sound

  • playerid - The ID of the player
  • Returns sound ID
SetHitmarkerPosition(playerid, crosshair_type, Float:x, Float:y, Float:sizeX, Float:sizeY)

Set the marker position

  • playerid - The ID of the player
  • crosshair_type - Change position
  • Float:x - The X (left/right) coordinate to create the textdraw at.
  • Float:y - The Y (up/down) coordinate to create the textdraw at.
  • Float:sizeX - Width
  • Float:sizeY - Height
GetHitmarkerPosition(playerid, crosshair_type, &Float:x, &Float:y, &Float:sizeX, &Float:sizeY)

Get current hitmarker position

  • playerid - The ID of the player
  • crosshair_type - Change position
  • &Float:x - The X (left/right) coordinate
  • &Float:y - The Y (up/down) coordinate
  • &Float:sizeX - Width
  • &Float:sizeY - Height
ToggleHitmarkerPlayerDamage(playerid, bool:toggle)

Enable player damage indication

  • playerid - The ID of the player
  • toggle - true to enable / false to disable
  • Enabled by default.
IsHitmarkerPlayerDamageEnabled(playerid)

Get player damage status

  • playerid - The ID of the player
  • Return (true) if enabled or (false) if disabled
ToggleHitmarkerVehicleDamage(playerid, bool:toggle)

Enable vehicle damage indication

  • playerid - The ID of the player
  • toggle - true to enable / false to disable
IsHitmarkerVehicleDamageEnabled(playerid)

Get vehicle damage status

  • playerid - The ID of the player
  • Return (true) if enabled or (false) if disabled

Definitions

Color IDs
DefinitionIDNotes
HITMARKER_COLOR_KILLSHOT0The player died
HITMARKER_COLOR_VEHICLE1Vehicle damage dealt.
HITMARKER_BODYPART_TORSO3Hit on the torso
HITMARKER_BODYPART_GROIN4Hit in the groin
HITMARKER_BODYPART_LEFT_ARM5Hit on the left arm
HITMARKER_BODYPART_RIGHT_ARM6Hit on the right arm
HITMARKER_BODYPART_LEFT_LEG7Hit on the left leg
HITMARKER_BODYPART_RIGHT_LEG8Hit on the right leg
HITMARKER_BODYPART_HEAD9Headshot hit
Usage
SetHitmarkerColor(playerid, HITMARKER_BODYPART_TORSO, 0xFFFFFFFF);
Weapon IDs
IconDefinitionIDNotes
HITMARKER_WEAPON_FIST0Damage received by fist
HITMARKER_WEAPON_VEHICLE_CRUSH50Death by vehicle crush or helicopter blades
HITMARKER_ALL_EXPLOSION51Death by explosion
HITMARKER_AIR_WEAPON_MINIGUN52Death from vehicle-mounted machine guns
HITMARKER_AIR_WEAPON_ROCKETS53Death from vehicle-mounted rockets
Usage
ToggleHitmarkerWeapon(playerid, HITMARKER_AIR_WEAPON_MINIGUN, true);
Change position
DefinitionIDNotes
HITMARKER_POS_STANDARD0Set standard positionUsed for firearms (ID: 22 - 33, 37 - 38)
HITMARKER_POS_CENTER1Set the center positionUsed for melee weapons and vehicles
Usage
SetHitmarkerPosition(playerid, HITMARKER_POS_STANDARD, 332.5, 172.5, 0.33, 0.7);
Other
#define HITMARKER_VISIBLE_TIME 400
#define HITMARKER_TICK_RATE 400 
#define HITMARKER_DEFAULT_COLOR 0xFFFFFFFF

hitmarker-pawnhitmarker-samppawn-packagesa-mpsamp

Esta página é montada com o que o GitHub publica sobre o repositório. O samp.directory não hospeda o código. Avisar de um problema com esta página