Added strip_user_weapons (thx to SidLuke)

This commit is contained in:
Johnny Bergström 2004-06-21 09:16:14 +00:00
parent 1af005a047
commit ab03ce077e
2 changed files with 54 additions and 0 deletions

View File

@ -784,6 +784,56 @@ static cell AMX_NATIVE_CALL set_user_footsteps(AMX *amx, cell *params) // set_us
return 1;
}
// SidLuke
static cell AMX_NATIVE_CALL strip_user_weapons(AMX *amx, cell *params) { // index
if (!MF_IsPlayerIngame(params[1]))
{
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
return 0;
}
edict_t* pPlayer = INDEXENT(params[1]);
string_t item = MAKE_STRING("trigger_once");
edict_t *pent = CREATE_NAMED_ENTITY( item );
if ( FNullEnt( pent ) ){
return 0;
}
KeyValueData pkvd;
pkvd.szClassName = (char *)STRING(pent->v.classname);
pkvd.szKeyName = "target"; // type
pkvd.szValue = "stripper";
pkvd.fHandled = false;
MDLL_KeyValue(pent, &pkvd);
MDLL_Spawn(pent);
item = MAKE_STRING("player_weaponstrip");
edict_t *pent2 = CREATE_NAMED_ENTITY( item );
if ( FNullEnt( pent2 ) ) {
return 0;
}
pkvd.szClassName = (char *)STRING(pent->v.classname);
pkvd.szKeyName = "targetname"; // type
pkvd.szValue = "stripper";
pkvd.fHandled = false;
MDLL_KeyValue(pent2, &pkvd);
MDLL_Spawn(pent2);
pent->v.origin = pPlayer->v.origin;
MDLL_Touch(pent, pPlayer);
REMOVE_ENTITY(pent);
REMOVE_ENTITY(pent2);
return 1;
}
AMX_NATIVE_INFO fun_Exports[] = {
{"get_client_listen", get_client_listening},
{"set_client_listen", set_client_listening},
@ -805,6 +855,7 @@ AMX_NATIVE_INFO fun_Exports[] = {
{"set_user_noclip", set_user_noclip},
{"get_user_noclip", get_user_noclip},
{"set_user_footsteps", set_user_footsteps},
{"strip_user_weapons", strip_user_weapons},
/////////////////// <--- 19 chars max in current small version
{NULL, NULL}
};

View File

@ -79,3 +79,6 @@ native get_user_noclip(index);
/* Gives player silent footsteps.
* if set = 0 it will return footsteps to normal */
native set_user_footsteps(id, set = 1);
/* Strips all weapons from user. */
native strip_user_weapons(index);