21.09.2011, 19:01
I wasn't sure if I have to put INVALID_VEHICLE_ID in a MAX_VEHICLES loop :\ . It's not like
?
0 ... 1999 are valid vehicle ID's, but we are not sure if respective vehicle has been created, GetVehiclePos would be good:
pawn Code:
if( 0 != INVALID_VEHICLE_ID )
{
DestroyVehicle( 0 );
}
if( 1 != INVALID_VEHICLE_ID )
{
DestroyVehicle( 1 );
}
// etc
if( 1999 != INVALID_VEHICLE_ID )
{
DestroyVehicle( 1999 );
}
0 ... 1999 are valid vehicle ID's, but we are not sure if respective vehicle has been created, GetVehiclePos would be good:
Code:
if( strcmp( cmdtext, "/deleteallcars", true ) == 0 ) { new Float:X, Float:Y, Float:Z; for( new veh; veh < MAX_VEHICLES; veh ++ ) { GetVehiclePos( veh, X, Y, Z ); if( X == 0.00 && Y == 0.00 && Z == 00 ) continue; DestroyVehicle( veh ); } return 1; }