SA-MP Forums Archive
Problem array - 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: Problem array (/showthread.php?tid=509380)



Problem array - Noliax8 - 26.04.2014

Hello all,

I want to do something, it's possible to lister a array with a number and not pPass, pLevel, pAdmin, etc...

PHP Code:

enum e_02
{
        
id,
        
valeur,
        
www,
        
xxx,
        
yyy
};
new 
tab[e_02];
tab[id] = 5;
tab[valeur] = 4;
tab[www] = -6;
       
for(new 
isizeof(tab); i++) printf("tab[%i] = %d"itab[i]); // problem with tab[i] 
Thanks


AW: Problem array - Nero_3D - 26.04.2014

Well you could create a tagless array or you add the type before normal variables

pawn Code:
new tab[_: e_02]; // disables strings in enums
// or (not and)
for(new i; i < sizeof(tab); i++) printf("tab[%i] = %d", i, tab[e_02: i]);



Re : Problem array - Noliax8 - 26.04.2014

Thanks,

And now, exist a functions to know if is a integer, a float, or a string ?

Jonas


AW: Problem array - Nero_3D - 26.04.2014

Well no, there is only the operator tagof()
But strings have no tag like a int and therefore you can't tell the difference

Also using tagof with an array and a variable index it will return the type of the array