I'm out of ideas why this occur.
MDLL_Spawn is working all the time, but when it comes to MDLL_Touch, then it crash whenever it feels to/randomly (with "HLDS has stopped responding"). It can be the 1st time, it can be the 5th time and so on..
Code:
void GiveEntity
( char* name, edict_t* player, int count
)
{
string_t str = ALLOC_STRING
( name
);
for( int i =
0; i < count; ++i
)
{
edict_t *ent;
ent = CREATE_NAMED_ENTITY
( str
);
if( !FNullEnt
( ent
) )
{
UTIL_SetOrigin
( &ent->v, player->v.
origin );
ent->v.
spawnflags |= SF_NORESPAWN;
(*g_engfuncs.
pfnServerPrint)("Spawn\n");
MDLL_Spawn
( ent
);
(*g_engfuncs.
pfnServerPrint)("Done, moving on to Touch\n");
MDLL_Touch( ent, player );
(*g_engfuncs.
pfnServerPrint)("Touch done\n");
}
}
}