God damn maths. - 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: God damn maths. (
/showthread.php?tid=329951)
[ - FIXED - ] -
MP2 - 30.03.2012
-fixed -
Re: God damn maths. -
AndreT - 30.03.2012
If I understood you properly, you could have an array (with the size of MAX_VEHICLES) and you could store vehicle IDs like that...
pawn Код:
new flaggedVehicles,
vehicles[MAX_VEHICLES];
vehicles[flaggedVehicles] = AddStaticVehicle(...);
flaggedVehicles ++;
There are numerous ways to do it, even CSTL vectors or something perhaps more efficient, whatever, but it should carry on the idea properly.
So you just carry out a search in the array.
pawn Код:
vehicleid = 10;
for(new i = 0; i != sizeof(vehicles); i++)
{
if(vehicles[i] == vehicleid)
return i;
}
Is this what you're looking for or am I misunderstanding something?
Re: God damn maths. -
MP2 - 30.03.2012
I don't want to use arrays, because there's no need to, the IDs are constant. It's being really weird though, saying the first vehicle in the array is 540 then the last 478 ¬_¬
Re: God damn maths. -
AndreT - 30.03.2012
To be able to properly predict the IDs without having to use arrays, create them before anything else (also applies for filterscripts). Then it should be less complex, otherwise I suppose you're going to need arrays (but I'm not sure since I'm missing half of the point of this).
Re: God damn maths. -
MP2 - 30.03.2012
I don't have vehicles in filterscripts.