Cstrike: cs_get/set_armoury_type - Add a param to get/set the number of weapons inside an armoury
This commit is contained in:
parent
81f9a23d16
commit
63a0910f5b
@ -915,7 +915,7 @@ static cell AMX_NATIVE_CALL cs_get_hostage_follow(AMX *amx, cell *params)
|
||||
void *pImprov = get_pdata<void*>(pHostage, m_improv);
|
||||
edict_t *pEntity = nullptr;
|
||||
|
||||
if (pImprov) // Specific to CS
|
||||
if (pImprov) // Specific to CZ
|
||||
{
|
||||
GET_OFFSET("CHostageImprov", m_behavior);
|
||||
GET_OFFSET("CHostageImprov", m_followState);
|
||||
@ -956,7 +956,7 @@ static cell AMX_NATIVE_CALL cs_set_hostage_follow(AMX *amx, cell *params)
|
||||
|
||||
void *pImprov = get_pdata<void*>(pHostage, m_improv);
|
||||
|
||||
if (pImprov) // Specific to CS
|
||||
if (pImprov) // Specific to CZ
|
||||
{
|
||||
GET_OFFSET("CHostageImprov", m_behavior);
|
||||
GET_OFFSET("CHostageImprov", m_followState);
|
||||
@ -1177,7 +1177,7 @@ static cell AMX_NATIVE_CALL cs_user_spawn(AMX *amx, cell *params)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// native cs_get_armoury_type(index);
|
||||
// native cs_get_armoury_type(index, &count = 1);
|
||||
static cell AMX_NATIVE_CALL cs_get_armoury_type(AMX *amx, cell *params)
|
||||
{
|
||||
GET_OFFSET("CArmoury", m_iItem);
|
||||
@ -1224,10 +1224,17 @@ static cell AMX_NATIVE_CALL cs_get_armoury_type(AMX *amx, cell *params)
|
||||
}
|
||||
}
|
||||
|
||||
if (*params / sizeof(cell) >= 2)
|
||||
{
|
||||
GET_OFFSET("CArmoury", m_iCount);
|
||||
|
||||
*MF_GetAmxAddr(amx, params[2]) = get_pdata<int>(pArmoury, m_iCount);
|
||||
}
|
||||
|
||||
return weapontype_out;
|
||||
}
|
||||
|
||||
// native cs_set_armoury_type(index, type);
|
||||
// native cs_set_armoury_type(index, type, count = -1);
|
||||
static cell AMX_NATIVE_CALL cs_set_armoury_type(AMX *amx, cell *params)
|
||||
{
|
||||
GET_OFFSET("CArmoury", m_iItem);
|
||||
@ -1276,6 +1283,29 @@ static cell AMX_NATIVE_CALL cs_set_armoury_type(AMX *amx, cell *params)
|
||||
|
||||
set_pdata<int>(pArmoury, m_iItem, weapontype);
|
||||
|
||||
if (*params / sizeof(cell) >= 3)
|
||||
{
|
||||
GET_OFFSET("CArmoury", m_iCount);
|
||||
GET_OFFSET("CArmoury", m_iInitialCount);
|
||||
|
||||
int count = params[3];
|
||||
|
||||
if (count >= 0)
|
||||
{
|
||||
if (!count)
|
||||
{
|
||||
pArmoury->v.effects |= EF_NODRAW;
|
||||
}
|
||||
else
|
||||
{
|
||||
pArmoury->v.effects &= ~EF_NODRAW;
|
||||
}
|
||||
|
||||
set_pdata<int>(pArmoury, m_iCount, count);
|
||||
set_pdata<int>(pArmoury, m_iInitialCount, count);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -811,12 +811,14 @@ native cs_user_spawn(player);
|
||||
* CSW_SG552, CSW_AK47, CSW_P90
|
||||
*
|
||||
* @param index Armoury entity index
|
||||
* @param count Optional variable to store in the number of times that an item can be retrieved
|
||||
* from the same entity before being hidden
|
||||
*
|
||||
* @return Weapon id
|
||||
* @error If a non-armoury entity is provided, an error will be
|
||||
* thrown.
|
||||
*/
|
||||
native cs_get_armoury_type(index);
|
||||
native cs_get_armoury_type(index, &count = 1);
|
||||
|
||||
/**
|
||||
* Sets the amoury entity type.
|
||||
@ -828,15 +830,19 @@ native cs_get_armoury_type(index);
|
||||
* CSW_TMP, CSW_G3SG1, CSW_VEST, CSW_VESTHELM, CSW_FLASHBANG,
|
||||
* CSW_SG552, CSW_AK47, CSW_P90
|
||||
* @note This does not update the entity model.
|
||||
* @note On restart, entity is always unhidden and the count is restored (this can not be below 1).
|
||||
*
|
||||
* @param index Armoury entity index
|
||||
* @param type Weapon id
|
||||
*
|
||||
* @param count Number of times that an item can be retrieved from
|
||||
* the same entity before being hidden
|
||||
* If zero, the entity is hidden
|
||||
* If below zero, nothing is set
|
||||
* @noreturn
|
||||
* @error If a non-armoury entity is provided, an error will be
|
||||
* thrown.
|
||||
*/
|
||||
native cs_set_armoury_type(index, type);
|
||||
native cs_set_armoury_type(index, type, count = -1);
|
||||
|
||||
/**
|
||||
* Returns the map zones the client is inside of as a bitflag value.
|
||||
|
Loading…
Reference in New Issue
Block a user