2
0
mirror of https://github.com/rehlds/reapi.git synced 2025-01-16 00:28:17 +03:00

Add native engset_view

This commit is contained in:
s1lent 2017-09-21 23:26:51 +07:00
parent 61fe805a29
commit bc3b1afb60
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
2 changed files with 34 additions and 1 deletions

View File

@ -166,6 +166,16 @@ native bool:FClassnameIs(const entityIndex, const className[]);
*/
native WeaponIdType:GetGrenadeType(const entityIndex);
/*
* Sets the view mode on a client.
* This allows pfnSetView able to hooks.
*
* @param index Client index
* @param viewEntity Entity index
*
*/
native engset_view(const index, const const viewEntity);
/*
* Check if the entity is valid.
*

View File

@ -66,10 +66,33 @@ cell AMX_NATIVE_CALL amx_GetGrenadeType(AMX *amx, cell *params)
return (pGrenade->m_usEvent == usCreateExplosion) ? WEAPON_HEGRENADE : WEAPON_SMOKEGRENADE;
}
/*
* Sets the view mode on a client.
* This allows pfnSetView able to hooks.
*
* @param index Client index
* @param viewEntity Entity index
*
* native engset_view(const index, const const viewEntity);
*/
cell AMX_NATIVE_CALL amx_engset_view(AMX *amx, cell *params)
{
enum args_e { arg_count, arg_index, arg_entity };
CHECK_ISPLAYER(arg_index);
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
CHECK_CONNECTED(pPlayer, arg_index);
g_pengfuncsTable->pfnSetView(pPlayer->edict(), edictByIndexAmx(params[arg_entity]));
return TRUE;
}
AMX_NATIVE_INFO Natives_Common[] =
{
{ "FClassnameIs", amx_FClassnameIs },
{ "GetGrenadeType", amx_GetGrenadeType },
{ "engset_view", amx_engset_view },
{ nullptr, nullptr }
};