GetArrayIndex - 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: GetArrayIndex (
/showthread.php?tid=643184)
GetArrayIndex -
Skream - 15.10.2017
any way to do it in pawn?
Re: GetArrayIndex -
Aliassassin123456 - 15.10.2017
What is your array?
It depends what do you need exactly, like if it's a vehicle model id array and you wanted to locate Infernus (Model ID: 411) index in the array, this is our array and this is how we're doing it:
PHP код:
new aModels[] = {400, 521, 532, 452, 411, 529, 521};
for(new i = 0; i < sizeof aModels; i++)
{
if(aModels[i] == 411)
{
// Now variable "i" is our index
printf("The index is: %i", i); // (It's 4, according to our aModels array)
break;
}
}
Re: GetArrayIndex -
Skream - 15.10.2017
Quote:
Originally Posted by Aliassassin123456
What is your array?
It depends what do you need exactly, like if it's a vehicle model id array and you wanted to locate Infernus (Model ID: 411) index in the array, this is our array and this is how we're doing it:
PHP код:
new aModels[] = {400, 521, 532, 452, 411, 529, 521};
for(new i = 0; i < sizeof aModels; i++)
{
if(aModels[i] == 411)
{
// Now variable "i" is our index
printf("The index is: %i", i); // (It's 4, according to our aModels array)
break;
}
}
|
thanks but I was asking for something like this
http://zone.ni.com/reference/en-XX/h...tarrayindex_m/