mirror of
https://github.com/rehlds/reapi.git
synced 2024-12-29 08:05:36 +03:00
feat: add WI_SLOT for rg_get_weapon_info (#292)
This commit is contained in:
parent
55151847af
commit
f2ef526271
@ -134,7 +134,15 @@ enum WpnInfo
|
|||||||
* Get params: rg_get_weapon_info(const weapon_id, WI_NAME, const output[], maxlenght);
|
* Get params: rg_get_weapon_info(const weapon_id, WI_NAME, const output[], maxlenght);
|
||||||
* Set params: -
|
* Set params: -
|
||||||
*/
|
*/
|
||||||
WI_NAME
|
WI_NAME,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Description: -
|
||||||
|
* Return type: enum InventorySlotType
|
||||||
|
* Get params: rg_get_weapon_info(const weapon_id, WI_SLOT);
|
||||||
|
* Set params: rg_set_weapon_info(const weapon_id, WI_SLOT, const value);
|
||||||
|
*/
|
||||||
|
WI_SLOT,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -840,7 +840,15 @@ cell AMX_NATIVE_CALL rg_get_weapon_info(AMX *amx, cell *params)
|
|||||||
setAmxString(dest, info->entityName, length);
|
setAmxString(dest, info->entityName, length);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
case WI_SLOT:
|
||||||
|
{
|
||||||
|
auto pInfo = g_ReGameApi->GetWeaponSlot(weaponId);
|
||||||
|
if (pInfo) {
|
||||||
|
return pInfo->slot;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NONE_SLOT;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown type statement %i, params count %i", __FUNCTION__, info_type, PARAMS_COUNT);
|
AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown type statement %i, params count %i", __FUNCTION__, info_type, PARAMS_COUNT);
|
||||||
return -1;
|
return -1;
|
||||||
@ -896,6 +904,12 @@ cell AMX_NATIVE_CALL rg_set_weapon_info(AMX *amx, cell *params)
|
|||||||
case WI_NAME:
|
case WI_NAME:
|
||||||
AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: this change will have no effect, type statement %i", __FUNCTION__, info_type);
|
AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: this change will have no effect, type statement %i", __FUNCTION__, info_type);
|
||||||
return 0;
|
return 0;
|
||||||
|
case WI_SLOT:
|
||||||
|
{
|
||||||
|
auto pInfo = g_ReGameApi->GetWeaponSlot(weaponId);
|
||||||
|
pInfo->slot = static_cast<InventorySlotType>(*value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown type statement %i, params count %i", __FUNCTION__, info_type, PARAMS_COUNT);
|
AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown type statement %i, params count %i", __FUNCTION__, info_type, PARAMS_COUNT);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -18,6 +18,7 @@ enum WpnInfo
|
|||||||
WI_AMMO_TYPE,
|
WI_AMMO_TYPE,
|
||||||
WI_AMMO_NAME,
|
WI_AMMO_NAME,
|
||||||
WI_NAME,
|
WI_NAME,
|
||||||
|
WI_SLOT,
|
||||||
};
|
};
|
||||||
|
|
||||||
void RegisterNatives_Misc();
|
void RegisterNatives_Misc();
|
||||||
|
Loading…
Reference in New Issue
Block a user