Hey. When give entity weapons set pev_impulse 500.
In FM_Setmodel do check
client_print (id, print_chat, "SetModel impulse ==% d", pev (entity, pev_impulse));
if (pev (entity, pev_impulse) == 500)
but it did not pass because the pev_impulse == 0
why pev_impulse == 0 ?
PHP Code:
stock fm_give_item(id, const item[])
{
static ent;
ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item));
if (!pev_valid(ent)) return;
set_pev(ent, pev_impulse, 500);
static Float:originF[3];
pev(id, pev_origin, originF);
set_pev(ent, pev_origin, originF);
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
dllfunc(DLLFunc_Spawn, ent);
static save;
save = pev(ent, pev_solid);
dllfunc(DLLFunc_Touch, ent, id);
if (pev(ent, pev_solid) != save)
return;
engfunc(EngFunc_RemoveEntity, ent);
}
register_forward(FM_SetModel, "fwd_SetModel", 0);
public fwd_SetModel(entity, const model[])
{
static id;
id = pev(entity, pev_owner);
client_print(id, print_chat, "SetModel impulse == %d", pev(entity, pev_impulse));
if (pev(entity, pev_impulse) == 500)
{
//code
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}