rehlds / ReAPI

AMXModX module providing APIs for ReHLDS, ReGameDLL, and Metamod plugins (e.g., ReUnion, ReVoice).
GNU General Public License v3.0
160 stars 105 forks source link

[Request] Call function just like in Hamsandwich (ExecuteHam/ExecuteHamB). #9

Open lespaul64 opened 8 years ago

lespaul64 commented 8 years ago

I see this module is awesome with useful functions, but where is the function that similar too ExecuteHam/ExecuteHamB?

In Hamsandwich module:

/**
 * Executes the virtual function on the entity.
 * Look at the Ham enum for parameter lists.
 *
 * @param function      The function to call.
 * @param id            The id of the entity to execute it on.
 */
native ExecuteHam(Ham:function, this, any:...);

/**
 * Executes the virtual function on the entity, this will trigger all hooks on that function.
 * Be very careful about recursion!
 * Look at the Ham enum for parameter lists.
 *
 * @param function      The function to call.
 * @param id            The id of the entity to execute it on.
 */
native ExecuteHamB(Ham:function, this, any:...);
theAsmodai commented 8 years ago

What functions do you need? We maked a set of useful rg_* natives for most things. They replace direct usage of the ExecuteHam(B) functions.

lespaul64 commented 8 years ago

Sad.. I thought we can completely replace ham module. At least make it for Ham_CS_RoundRespawn, Ham_TakeDamage and Ham_CS_Player_ResetMaxSpeed. I'm curious why dont you make that ExacuteHam similar native. It was useful by the way. Also it would be great if we can hook fire_bullet and fire_bullet3 too.

theAsmodai commented 8 years ago

It's not easy to implement and mostly will be unused. The FireBullets functions has a many arguments and will be quite slow. I think they can be replaced by another functions.

souvikdas95 commented 8 years ago

Ham_think, Ham_Weapon_RetireWeapon, Ham_Item_Kill, Ham_RemovePlayerItem, Ham_AddPlayerItem, Ham_Item_AttachToPlayer, Ham_Spawn

Skumek commented 8 years ago

I also like the idea of ExecuteHamB function:)

We could add ammo like ham. ExecuteReHook(RG_CBasePlayer_GiveAmmo, i_Client, i_Amount, sz_Name, i_MaxCarry)

Ham Suggestions: Ham_Weapon_PrimaryAttack, Ham_Weapon_SecondaryAttack, Ham_Item_Deploy, Ham_Item_AddToPlayer, Ham_Weapon_Reload, Ham_Weapon_WeaponIdle, Ham_Think, Ham_Touch.

But it would be nice with these too:

FM_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2), // RG_PlaybackEvent FM_SetModel(i_Ent, sz_Model[]), // RG_SetModel FM_PrecacheEvent(i_Type, const sz_Name[]), // RG_PrecacheEvent Event_RoundNew(), // RG_RoundNew Event_RoundStart(), // RG_RoundStart Event_StatusValue(i_Client), // RG_StatusValue

ivanmaxlogiudice commented 8 years ago

You can add Ham_CS_Player_ResetMaxSpeed and Ham_Item_Deploy?

ish12321 commented 7 years ago

Ham_Item_Deploy?

ddelbasto commented 3 years ago

Is there any progress with this request?

I'm trying to make a fake smoke and I need to call RG_ThrowSmokeGrenade. This can be done with okapi.

new m_usCreateSmoke = get_pdata_int(gEntity, m_usEvent) new Entity = okapi_call(CGrenade_ShootSmokeGrenade, pev(gEntity, pev_owner), gOrigin, Float:{0.0, 0.0, 0.0}, 0, m_usCreateSmoke)

But, it would be nice if reapi could do such calls.

cheers

afwn90cj93201nixr2e1re commented 3 years ago

Not that easy as you guys think. To implement it correctly with preserving current behavior we need think deeper than the direct solution.

RauliTop commented 3 years ago

@gladiuskzcl Use this: https://dev-cs.ru/threads/222/page-7#post-74228