10.10.2009, 00:15
Right I'm with you now.
Well this is simple enough just do something like so:
So if 'model' is 541 (Bullet model) then it will check the array at index 141 to see if it is flagged true or false then react accordingly, model is the param from your command or whatever.
You could use the creation as a custom function with a return:
I haven't checked this dude, just writing it out from my head so it could have typos or little bugs which I'm not aware of but in theory it will work no problems I think (hope hehe) and now we don't require loops or whatever unless we want to do a global set for the 'gDisabledVehicle' array.
Well this is simple enough just do something like so:
pawn Код:
//global
new
gDisabledVehicle[ 211 ] = { true, ... }; //all are enabled and 211 is the total model count - 400 to 611
//create a vehicle
if ( ( model - 400 ) > -1 && ( model - 400 ) < 212 )
{
if ( !gDisabledVehicle[ ( model - 400 ) ] ) CreateVehicle( model, coords etc........ );
}
//enable a vehicle
gDisabledVehicle[ ( model - 400 ) ] = true;
//disable a vehicle
gDisabledVehicle[ ( model - 400 ) ] = false;
You could use the creation as a custom function with a return:
pawn Код:
CreateEnabledVehicle( model, ...... )
{
if ( ( model - 400 ) > -1 && ( model - 400 ) < 212 ) //OOB protection so we don't go outside the array bounds and crash the script
{
if ( !gDisabledVehicle[ ( model - 400 ) ] )
{
CreateVehicle( model, coords etc........ ); //it wasn't disabled so create it
return true; //return a success
}
}
return false; //return a failure, the vehicle was disabled or the index was invalid after subtracting 400 from it (we passed say 717 so the index was 317)
}