Added cs_get_user_hasprim()
This commit is contained in:
parent
667b15787d
commit
5cbc863f33
|
@ -1308,6 +1308,24 @@ static cell AMX_NATIVE_CALL cs_set_weapon_ammo(AMX *amx, cell *params) // cs_set
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL cs_get_user_hasprimary(AMX *amx, cell *params) // cs_get_user_hasprimary(index); = 1 param
|
||||||
|
{
|
||||||
|
// Return 1 if user has a primary or shield (actually just return the value at the offset)
|
||||||
|
// params[1] = user index
|
||||||
|
|
||||||
|
// Check player
|
||||||
|
if (!MF_IsPlayerIngame(params[1]))
|
||||||
|
{
|
||||||
|
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make into edict pointer
|
||||||
|
edict_t *pPlayer = INDEXENT(params[1]);
|
||||||
|
|
||||||
|
return *((int *)pPlayer->pvPrivateData + OFFSET_PRIMARYWEAPON);
|
||||||
|
}
|
||||||
|
|
||||||
AMX_NATIVE_INFO cstrike_Exports[] = {
|
AMX_NATIVE_INFO cstrike_Exports[] = {
|
||||||
{"cs_set_user_money", cs_set_user_money},
|
{"cs_set_user_money", cs_set_user_money},
|
||||||
{"cs_get_user_money", cs_get_user_money},
|
{"cs_get_user_money", cs_get_user_money},
|
||||||
|
@ -1338,6 +1356,7 @@ AMX_NATIVE_INFO cstrike_Exports[] = {
|
||||||
{"cs_reset_user_model", cs_reset_user_model},
|
{"cs_reset_user_model", cs_reset_user_model},
|
||||||
{"cs_set_weapon_ammo", cs_set_weapon_ammo},
|
{"cs_set_weapon_ammo", cs_set_weapon_ammo},
|
||||||
{"cs_get_weapon_ammo", cs_get_weapon_ammo},
|
{"cs_get_weapon_ammo", cs_get_weapon_ammo},
|
||||||
|
{"cs_get_user_hasprim", cs_get_user_hasprimary},
|
||||||
//------------------- <-- max 19 characters!
|
//------------------- <-- max 19 characters!
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
// "player" entities
|
// "player" entities
|
||||||
#define OFFSET_TEAM 114 + EXTRAOFFSET // same as STEAM
|
#define OFFSET_TEAM 114 + EXTRAOFFSET // same as STEAM
|
||||||
#define OFFSET_CSMONEY 115 + EXTRAOFFSET // same as STEAM
|
#define OFFSET_CSMONEY 115 + EXTRAOFFSET // same as STEAM
|
||||||
|
//#define OFFSET_PRIMARYWEAPON 116 + EXTRAOFFSET // not confirmed (very likely it's the same though)
|
||||||
#define OFFSET_INTERNALMODEL 126 + EXTRAOFFSET // same as STEAM
|
#define OFFSET_INTERNALMODEL 126 + EXTRAOFFSET // same as STEAM
|
||||||
#define OFFSET_NVGOGGLES 129 + EXTRAOFFSET // same as STEAM
|
#define OFFSET_NVGOGGLES 129 + EXTRAOFFSET // same as STEAM
|
||||||
#define OFFSET_DEFUSE_PLANT 193 + EXTRAOFFSET // same as STEAM
|
#define OFFSET_DEFUSE_PLANT 193 + EXTRAOFFSET // same as STEAM
|
||||||
|
@ -88,6 +89,7 @@
|
||||||
// "player" entities
|
// "player" entities
|
||||||
#define OFFSET_TEAM 114 + EXTRAOFFSET
|
#define OFFSET_TEAM 114 + EXTRAOFFSET
|
||||||
#define OFFSET_CSMONEY 115 + EXTRAOFFSET
|
#define OFFSET_CSMONEY 115 + EXTRAOFFSET
|
||||||
|
#define OFFSET_PRIMARYWEAPON 116 + EXTRAOFFSET
|
||||||
#define OFFSET_INTERNALMODEL 126 + EXTRAOFFSET
|
#define OFFSET_INTERNALMODEL 126 + EXTRAOFFSET
|
||||||
#define OFFSET_NVGOGGLES 129 + EXTRAOFFSET
|
#define OFFSET_NVGOGGLES 129 + EXTRAOFFSET
|
||||||
#define OFFSET_DEFUSE_PLANT 193 + EXTRAOFFSET
|
#define OFFSET_DEFUSE_PLANT 193 + EXTRAOFFSET
|
||||||
|
|
|
@ -67,6 +67,10 @@ native cs_set_user_defuse(index, defusekit = 1, r = 0, g = 160, b = 0, icon[] =
|
||||||
*/
|
*/
|
||||||
native cs_get_user_buyzone(index);
|
native cs_get_user_buyzone(index);
|
||||||
|
|
||||||
|
/* Returns 1 when user has a primary weapon OR a shield in inventory, else 0.
|
||||||
|
*/
|
||||||
|
native cs_get_user_hasprim(index);
|
||||||
|
|
||||||
/* Get user model.
|
/* Get user model.
|
||||||
*/
|
*/
|
||||||
native cs_get_user_model(index, model[], len);
|
native cs_get_user_model(index, model[], len);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user