11-08-2011, 12:47 PM
Weird this code should work right ?
Still it crashes the client when i kill a cow.
Code:
void cCow::KilledBy( cEntity* a_Killer )
{
//1 to 3 raw beef.
int rRawBeef = rand() % 1 + 3;
if (rRawBeef != 0) {
cPickup* pRawBeef = new cPickup( (int)(m_Pos->x*32), (int)(m_Pos->y*32), (int)(m_Pos->z*32), cItem( E_ITEM_RAW_BEEF, rRawBeef ) );
pRawBeef->Initialize( GetWorld() );
}
//0 to 2 leather.
int rLeather = rand() % 3;
if (rLeather != 0) {
cPickup* pLeather = new cPickup( (int)(m_Pos->x*32), (int)(m_Pos->y*32), (int)(m_Pos->z*32), cItem( E_ITEM_LEATHER, rLeather ) );
pLeather->Initialize( GetWorld() );
}
cMonster::KilledBy( a_Killer );
}