diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index 61e5bcf1..ee4cfe34 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -546,6 +546,46 @@ static cell AMX_NATIVE_CALL get_user_attacker(AMX *amx, cell *params) /* 2 param return (enemy ? pPlayer->index : 0); } +static cell AMX_NATIVE_CALL user_has_weapon(AMX *amx,cell *params) +{ + int index = params[1]; + if (index < 1 || index > gpGlobals->maxClients){ + amx_RaiseError(amx,AMX_ERR_NATIVE); + return 0; + } + CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); + edict_t *pEntity = pPlayer->pEdict; + if (params[3] == -1) + { + if ((pEntity->v.weapons & (1< 0) + { + return 1; + } + } + else + { + if ((pEntity->v.weapons & (1< 0) + { + if (params[3] == 0) + { + pEntity->v.weapons &= ~(1<v.weapons |= (1< + @@ -73,8 +73,14 @@ Culture="1033"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -444,21 +497,6 @@ - - - - - - - - - - @@ -536,6 +574,12 @@ + + + + @@ -578,12 +622,6 @@ - - - - diff --git a/plugins/include/amxmodx.inc b/plugins/include/amxmodx.inc index 06e38da4..8ff9a314 100755 --- a/plugins/include/amxmodx.inc +++ b/plugins/include/amxmodx.inc @@ -211,6 +211,10 @@ native get_user_index(const name[]); /* Returns ip. */ native get_user_ip(index,ip[],len, without_port = 0); +/* Returns if the player has the weapon or not in their pev->weapons field. + set "setweapon" to 0 to turn the bit off, set to 1 to turn it on. */ +native has_weapon(index,weapon,setweapon=-1); + /* Returns id of currently carried weapon. Gets also * ammount of ammo in clip and backpack. */ native get_user_weapon(index,&clip,&ammo);