SA-MP Forums Archive
numberplate messing with 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: numberplate messing with array (/showthread.php?tid=533878)



numberplate messing with array - Porgand - 26.08.2014

Hi there

I have a little concern about the car number plate system.
Code:
Код:
new Letters[26][] =
{
    "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
};
new string[10];
format( string, sizeof( string ), "%s%s%s %d%d%d", Letters[random(sizeof(Letters))], Letters[random(sizeof(Letters))], Letters[random(sizeof(Letters))], random(10), random(10), random(10) );
		CarInfo[CarID][cRegistration] = string;
Error: error 047: array sizes do not match, or destination array is too small
and error line: CarInfo[CarID][cRegistration] = string;


Re: numberplate messing with array - Aerotactics - 26.08.2014

Quote:

Letters[26]

remove the extra brackets


Re: numberplate messing with array - Porgand - 26.08.2014

And now errors:
error 018: initialization data exceeds declared size
Код:
new Letters[26] =
{
    "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
};
error 047: array sizes do not match, or destination array is too small
Код:
CarInfo[CarID][cRegistration] = string;



Re: numberplate messing with array - Porgand - 26.08.2014

Yeah, the other error are gone but...
error 047: array sizes do not match, or destination array is too small
and line are still same.
Код:
CarInfo[CarID][cRegistration] = string;



Re: numberplate messing with array - Porgand - 26.08.2014

Код:
format( string, sizeof( string ), "%s%s%s %d%d%d", Letters[random(sizeof(Letters))], Letters[random(sizeof(Letters))], Letters[random(sizeof(Letters))], random(10), random(10), random(10) );
CarInfo[CarID][cRegistration] = string;
Mean that?


Re: numberplate messing with array - Porgand - 26.08.2014

Yeah, now is alright.
I change the format little bit and done.