Hi,
How can I prevent using a
for() loop inside another
for() loop, lol.
This is my current code
PHP Code:
public OnNewRound( )
{
new Float:fOrigin[ 3 ], WeaponEntity;
for( new i=1; i < sizeof g_szWeapons; i++ )
{
if( SsGetOrigin( fOrigin ) )
{
if( g_szWeapons[ i ][ 0 ] != EOS )
{
new WeaponBoxEntity = OrpheuCall( HandleCreateNamedEntityFunc, IntClassNameString ) ;
if( ! pev_valid( WeaponBoxEntity ) )
{
continue;
}
engfunc( EngFunc_SetOrigin, WeaponBoxEntity, fOrigin );
ExecuteHam( Ham_Spawn, WeaponBoxEntity );
WeaponEntity = create_entity( g_szWeapons[ i ] );
if( ! pev_valid( WeaponEntity ) )
{
remove_entity( WeaponBoxEntity );
}
ExecuteHam( Ham_Spawn, WeaponEntity );
new WeaponID = cs_get_weapon_id( WeaponEntity );
OrpheuCall( HandlePackWeaponFunc, WeaponBoxEntity, WeaponEntity );
if( WeaponBoxModels[ WeaponID ][ 0 ] != EOS )
{
engfunc( EngFunc_SetModel, WeaponBoxEntity, WeaponBoxModels[ WeaponID ] );
}
set_pdata_int( WeaponBoxEntity, m_pfnThink, CWeaponBoxKill_Address, 0 );
}
}
}
return PLUGIN_CONTINUE;
}
Here's the simpler version of the code:
PHP Code:
public OnNewRound( )
{
new Float:fOrigin[ 3 ], WeaponEntity;
for( new i=1; i < sizeof g_szWeapons; i++ )
{
if( SsGetOrigin( fOrigin ) )
{
// weapon is created here
}
}
}
return PLUGIN_CONTINUE;
}
Now I need to add this inside that code
PHP Code:
new iArraySize = ArraySize( g_aWeaponData );
for( new i; i < iArraySize; i++ )
{
ArrayGetArray( g_aWeaponData, i, g_iWeapons );
}
So I can retrieve the data from my array.
Thanks!!
__________________