Last id - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Last id (
/showthread.php?tid=128793)
Last id -
kLx - 19.02.2010
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.
Re: Last id -
woot - 19.02.2010
sizeof ?
Re: Last id -
kLx - 19.02.2010
Код:
new Frakcijos[ ][frakcijos];
I'm calculating the size on compile, so this does not fit.
Re: Last id -
BlackFoX - 19.02.2010
Re: Last id -
kLx - 19.02.2010
Quote:
|
Originally Posted by BlackFoX_UD_
|
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.
Re: Last id -
BlackFoX - 19.02.2010
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
Re: Last id -
kLx - 20.02.2010
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?