Skip to content

Commit

Permalink
Added native CWAPI_IsCustomWeapon
Browse files Browse the repository at this point in the history
  • Loading branch information
ArKaNeMaN committed Apr 8, 2020
1 parent 3081bcf commit fd5dcfa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CustomWeaponsAPI.sma
Expand Up @@ -93,6 +93,7 @@ public plugin_natives(){
register_native("CWAPI_FindWeapon", "Native_FindWeapon");
register_native("CWAPI_GetAbilityWeaponsList", "Native_GetAbilityWeaponsList");
register_native("CWAPI_GetWeaponIdFromEnt", "Native_GetWeaponIdFromEnt");
register_native("CWAPI_IsCustomWeapon", "Native_IsCustomWeapon");
}

public Native_GiveWeapon(){
Expand Down Expand Up @@ -243,6 +244,12 @@ public Native_GetWeaponIdFromEnt(){
return GetWeapId(ItemId);
}

public bool:Native_IsCustomWeapon(){
enum {Arg_WeaponId = 1}
static WeaponId; WeaponId = get_param(Arg_WeaponId);
return IsCustomWeapon(WeaponId);
}

CallWeaponEvent(const WeaponId, const CWAPI_WeaponEvents:Event, const ItemId, const any:...){
static Data[CWAPI_WeaponData]; ArrayGetArray(CustomWeapons, WeaponId, Data);
if(Data[CWAPI_WD_CustomHandlers][Event] == Invalid_Array)
Expand Down
9 changes: 9 additions & 0 deletions include/cwapi.inc
Expand Up @@ -213,6 +213,15 @@ native Array:CWAPI_GetAbilityWeaponsList(const AbilityName[]);
*/
native CWAPI_GetWeaponIdFromEnt(const ItemId);

/**
* Проверяет кастомное ли оружие по его индексу
*
* @param WeaponId Индекс оружия
*
* @return true если кастомное оружие с таким индексом существует, иначе false.
*/
native bool:CWAPI_IsCustomWeapon(const WeaponId);

/**
* Вызывается после загрузки всех пушек из конфига
*
Expand Down

0 comments on commit fd5dcfa

Please sign in to comment.