Last id
#1

Heyyyyy
So, I need to get the last number of and enum.
For example, I have this:
FractionCars enum.
And I need to find out, how many entrys it has.
Reply
#2

sizeof ?
Reply
#3

Код:
new Frakcijos[ ][frakcijos];
I'm calculating the size on compile, so this does not fit.
Reply
#4

Код:
sizeof(Frakcijos)
Reply
#5

Quote:
Originally Posted by BlackFoX_UD_
Код:
sizeof(Frakcijos)
If I do this, I get this error:
Код:
C:\Documents and Settings\Simas\Desktop\SA-MP\erp_kuriama\gamemodes\erp.pwn(1739) : warning 224: indeterminate array size in "sizeof" expression (symbol "")
Because the size is not assigned yet.
Reply
#6

yea cause the Array need some Values

Код:
new Frakcijos[ ][frakcijos] = {
{...} // Values for Datatypes in your Enum 
}
then you can use sizeof for it, if you have a defined Index use the Maximal Index
Reply
#7

Yellow
Ok, I decided to set the size by myself, so now its set to 140.
Код:
			for(new v = 1; v < sizeof(FTransportas); v++) id++;
			pKuriama[ playerid ] = id+1;
			printf("%d",pKuriama[ playerid ]);
It prints 140 id, so how can I get the id of last used (where values is not equal to 0) id?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)