rehlds icon indicating copy to clipboard operation
rehlds copied to clipboard

Muzzleflash plugin bug.

Open krisztian2 opened this issue 2 years ago • 4 comments

Dear people! Game: Counter-Strike 1.6

I have a problem with an entity.

My problem is in if statement this entity is not equal with iEntity. But in official hlds engine this plugin is work. public plugin_init() { register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR); RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_ak47", "FEGYVER__PrimaryAttack_Post", 1); RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_m4a1", "FEGYVER__PrimaryAttack_Post", 1); RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_awp", "FEGYVER__PrimaryAttack_Post", 1); RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_deagle", "FEGYVER__PrimaryAttack_Post", 1);

register_forward(FM_AddToFullPack, "CPlayer__AddToFullPack_post", 1);

register_forward(FM_CheckVisibility, "CEntity__CheckVisibility");

g_iEntity = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target")); }

public CEntity__CheckVisibility(iEntity, pSet) { if (iEntity != g_iEntity){ //This statement is the problem. return FMRES_IGNORED; }

forward_return(FMV_CELL, 1);

return FMRES_SUPERCEDE;

}

krisztian2 avatar Dec 26 '21 22:12 krisztian2

I printed a debug message to server: iE: 60; iEnt: 60; g_iEntity: 33 iE: 61; iEnt: 61; g_iEntity: 33 iE: 64; iEnt: 64; g_iEntity: 33 iE: 65; iEnt: 65; g_iEntity: 33 iE: 66; iEnt: 66; g_iEntity: 33

krisztian2 avatar Dec 26 '21 22:12 krisztian2

@krisztian2 an entity without a model will not be sent to the client (cuz it's pointless) thus, your entity never come in these callbacks

https://github.com/dreamstalker/rehlds/blob/22a00eff892c9bee807773120818dc2337f632e8/rehlds/engine/sv_main.cpp#L4652-L4658

s1lentq avatar Dec 26 '21 23:12 s1lentq

new const sprite[][] = { {"sprites/Red/muzzleflash1.spr" } } In public CPlayer__AddToFullPack_post(esState, iE, iEnt, iHost, iHostFlags, iPlayer, pSet) I set a model for muzzle: engfunc(EngFunc_SetModel,g_iEntity,sprite[0]);

krisztian2 avatar Dec 27 '21 01:12 krisztian2

Or I Must set a rudimentary sprite for model?

krisztian2 avatar Dec 27 '21 01:12 krisztian2