How to remove hat on client disconnect?
My code:
PHP Code:
public forcehat(id, Char:sethat[])
{
new hat_text[65]
format(hat_text,63,"models/hats/%s.mdl",sethat)
new iEntity, iInfoTarget = engfunc( EngFunc_AllocString, "info_target" );
iEntity = engfunc( EngFunc_CreateNamedEntity, iInfoTarget );
if( pev_valid( iEntity ) )
{
engfunc( EngFunc_SetModel, iEntity, hat_text );
set_pev( iEntity, pev_movetype, MOVETYPE_FOLLOW );
set_pev( iEntity, pev_aiment, id );
set_pev( iEntity, pev_owner, id );
}
}