Array size - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Array size (
/showthread.php?tid=621018)
Array size -
NeXoR - 05.11.2016
I don't really know how to explain myself, I will try the best
I want to run a loop after all vehicles are created
If vehicle model == Rustler vehicle model (the shooting old plane)
Then it will add the vehicleid to an array containing the vehicleid & if the rustler has shot or not
Should I use an Iterator or a Variable for it, and if I need a variable, how exactly should I create it
New Rustlers[MAX_VEHICLES] or is there a shorter way ?
Re: Array size -
SickAttack - 05.11.2016
Actually depends on how you do it. I'd go with an array and a variable used as a "count".
Re: Array size -
NeXoR - 05.11.2016
Quote:
Originally Posted by SickAttack
Actually depends on how you do it. I'd go with an array and a variable used as a "count".
|
Something like this ?
PHP код:
LoadVehicles();
foreach(new i : Vehicle) if(GetVehicleModel(i) == 476) Rustlers[i] = 1;
(Rustlers[MAX_VEHICLES])
If so then how can I mark the vehicle as shot after shooting a missile ?
Re: Array size -
SyS - 06.11.2016
Quote:
Originally Posted by NeXoR
Something like this ?
PHP код:
LoadVehicles();
foreach(new i : Vehicle) if(GetVehicleModel(i) == 476) Rustlers[i] = 1;
(Rustlers[MAX_VEHICLES])
If so then how can I mark the vehicle as shot after shooting a missile ?
|
index mismatching is a problem over their.
you can do something like this
Код:
new j;
foreach(new i : Vehicle)
{
if(GetVehicleModel(i) == 476 && j != sizeof(Rustlers) )
{
Rustlers[j] = /*Process it*/;
j++;
}
}