VEHICLE_CLASS* sq_tovehicle(SQVM* pVM, int idx) { CEntity* pEntity = sq_toentity(pVM, idx); if( pEntity && pEntity->GetType() == ENTITY_TYPE_VEHICLE ) return dynamic_cast< VEHICLE_CLASS* >( pEntity ); return NULL; }
CTimer* sq_totimer(SQVM* pVM, int idx) { CEntity* pEntity = sq_toentity(pVM, idx); if( pEntity && pEntity->GetType() == ENTITY_TYPE_TIMER ) return dynamic_cast< CTimer* >( pEntity ); return NULL; }
PLAYER_CLASS* sq_toplayer(SQVM* pVM, int idx) { CEntity* pEntity = sq_toentity(pVM, idx); if( pEntity && pEntity->GetType() == ENTITY_TYPE_PLAYER ) return dynamic_cast< PLAYER_CLASS* >( pEntity ); return NULL; }
CResource* sq_toresource(SQVM* pVM, int idx) { CEntity* pEntity = sq_toentity(pVM, idx); if( pEntity && pEntity->GetType() == ENTITY_TYPE_RESOURCE ) return dynamic_cast< CResource* >( pEntity ); return NULL; }
int CEntityNatives::Delete(SQVM* pVM) { CEntity* pEntity = sq_toentity(pVM, 2); if(pEntity) { switch( pEntity->GetType() ) { case ENTITY_TYPE_CUSTOM: delete pEntity; sq_pushbool(pVM,true); break; default: sq_pushbool(pVM,false); } } else sq_pushbool(pVM,false); return 1; }