Quote:
Originally Posted by Smilex_Gamer
Yes, within "pfnSetModel_Post" change that and within "HandleUpdateOwnerTask" you need to add that little piece of code before anything in order to check if the entity is valid, preventing errors from appearing when it uses an invalid entity.
P.S: That piece of code I'm talking about is this one:
Code:
if(!pev_valid(this)) return FMRES_IGNORED;
|
Got it.
HTML Code:
public pfnSetModel_Post(this, const szModel[])
{
if (!g_bTakeAwayBomb)
return;
if (!FClassnameIs(this, "weaponbox"))
return;
new pItem = GetWeaponBoxItem(this);
if (pItem == -1)
return;
if (cs_get_weapon_id(pItem) != CSW_C4)
return;
new iColor[3], pOwner;
pOwner = pev(this, pev_owner);
if (pOwner != g_pGuard && pOwner != g_pPrisoner)
return;
engfunc(EngFunc_SetSize, this, Float:{ -5.22, -2.94, 0.0 }, Float:{ 5.22, 2.94, 6.85 });
//set_pev(this, pev_takedamage, DAMAGE_YES);
set_pev(this, pev_takedamage, DAMAGE_NO);
set_pev(this, pev_solid, SOLID_BBOX);
set_pev(this, pev_iuser4, pOwner);
switch (get_user_team(pOwner))
{
case 1:
iColor = { 200, 0, 0 };
case 2:
iColor = { 0, 0, 200 };
}
set_rendering(this, kRenderFxGlowShell, iColor[0], iColor[1], iColor[2], kRenderNormal, 25);
set_task(0.1, "HandleUpdateOwnerTask", this);
}
public HandleUpdateOwnerTask(this)
{
if(!pev_valid(this)) return FMRES_IGNORED;
set_pev(this, pev_owner, 0);
}
EDIT: Thanks you, finally It doesn't go away that it touches the wall or I'm standing on it