AMX Mod X API Documentation

Shared natives
Signature
native custom_weapon_add(const wpnname[], melee = 0, const logname[] = "");
Description

Adds a custom weapon to the stats system.

Notes
  • The weapon name should be the full display name of the gun such as

    "Desert Eagle" while the logname should be "weapon_deagle".

Parameters
  • wpnname Full weapon name
  • melee If nonzero the weapon will be considered a melee weapon
  • logname Weapon short name
Returns

Cusom weapon id (>0) on success, 0 if no more custom weapons

can be added

Signature
native custom_weapon_dmg(weapon, att, vic, damage, hitplace = 0);
Description

Triggers a damage event on a custom weapon, adding it to the internal stats.

Notes
  • This will also call the client_damage() and client_kill() forwards if

    applicable.

  • For a list of possible body hitplaces see the HIT_* constants in

    amxconst.inc

Parameters
  • weapon Custom weapon id
  • att Attacker client index
  • vic Victim client index
  • damage Damage dealt
  • hitplace Optional body hitplace
No return value
Errors
  • If the weapon id is not a custom weapon, an invalid client

    index, damage value or hitplace is provided, an error will

    be thrown.

Signature
native custom_weapon_shot(weapon, index);
Description

Adds a shot event on a custom weapon to the internal stats.

Parameters
  • weapon Custom weapon id
  • index Client index
No return value
Errors
  • If the weapon id is not a custom weapon or an invalid client

    index is provided, an error will be thrown.

Signature
native xmod_is_melee_wpn(wpnindex);
Description

Returns if the weapon is considered a melee weapon.

Notes
  • For a list of default CS weapon ids see the CSW_* constants in

    amxconst.inc, this function also works on custom weapons.

  • For the default CS weapons this obviously returns true only for

    CSW_KNIFE.

Parameters
  • wpnindex Weapon id
Returns

1 if weapon is a melee weapon, 0

Errors
  • If an invalid weapon id is provided an error will be thrown.
Signature
native xmod_get_wpnname(wpnindex, name[], len);
Description

Retrieves the full weapon name of a weapon id.

Notes
  • For a list of default CS weapon ids see the CSW_* constants in

    amxconst.inc, this function also works on custom weapons.

  • For the default CS weapons this obviously returns true only for

    CSW_KNIFE.

Parameters
  • wpnindex Weapon id
  • name Buffer to copy weapon name to
  • len Maximmum buffer size
Returns

Number of cells written to buffer

Errors
  • If an invalid weapon id is provided an error will be thrown.
Signature
native xmod_get_wpnlogname(wpnindex, name[], len);
Description

Retrieves the weapon log name of a weapon id.

Notes
  • For a list of default CS weapon ids see the CSW_* constants in

    amxconst.inc, this function also works on custom weapons.

  • For the default CS weapons this obviously returns true only for

    CSW_KNIFE.

Parameters
  • wpnindex Weapon id
  • name Buffer to copy weapon log name to
  • len Maximmum buffer size
Returns

Number of cells written to buffer

Errors
  • If an invalid weapon id is provided an error will be thrown.
Signature
native xmod_get_maxweapons();
Description

Returns the maximum amount of weapons that the stats system supports.

Returns

Maximum number of weapons supported

Signature
native xmod_get_stats_size();
Description

Returns the number of stats tracked by the stats system.

Returns

Number of stats tracked

Назад
Верх