s1lentq / reapi

AMX Mod X module, using API regamedll & rehlds
GNU General Public License v3.0
161 stars 103 forks source link

[Request] Set entity rendering native. #34

Closed lespaul64 closed 7 years ago

lespaul64 commented 7 years ago

This function is used on most servers, it would be good if it include in reapi too.

From engine module: https://github.com/alliedmodders/amxmodx/blob/master/modules/engine/entity.cpp#L1531

theAsmodai commented 7 years ago

You can use set_entvar for work with rendering.

lespaul64 commented 7 years ago

@theAsmodai That would need to call amxx native set_entvar 4x.

with this, we can call 1 amxx native only:

static cell AMX_NATIVE_CALL set_ent_rendering(AMX *amx, cell *params) // set_ent_rendering(index, fx = kRenderFxNone, r = 0, g = 0, b = 0, render = kRenderNormal, amount = 0); = 7 arguments
{
    // params[1] = index
    // params[2] = fx
    // params[3] = r
    // params[4] = g
    // params[5] = b
    // params[6] = render
    // params[7] = amount

    CHECK_ENTITY_SIMPLE(params[1]);

    edict_t *pEntity = TypeConversion.id_to_edict(params[1]);

    pEntity->v.renderfx = params[2];
    pEntity->v.rendercolor = Vector(float(params[3]), float(params[4]), float(params[5]));
    pEntity->v.rendermode = params[6];
    pEntity->v.renderamt = float(params[7]);

    return 1;
}

It's okay if don't want add in reApi, but not all server use engine module.

theAsmodai commented 7 years ago

I think it's a rarely used native.

lespaul64 commented 7 years ago

Well it's okay then. I have to create a stock for this.