Array sizes etc. etc. - 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: Array sizes etc. etc. (
/showthread.php?tid=371125)
Array sizes etc. etc. -
milanosie - 22.08.2012
Alright, I want my array variable being set to the variable "plate"
Like this
pawn Код:
//inside the array:
VehPlate[22],
//In the thing command/dialog
new plate[20];
new num = RandomEx(100000,999999999);
format(plate, 20, "%d", num);
Vinfo[v][VehPlate] = plate;
;
I might be stupid or it might me a stupid mistake (Had an all-nighter, not really awake) but what is going wrong?
Код:
error 047: array sizes do not match, or destination array is too small
Danke
Re: Array sizes etc. etc. - HuSs3n - 22.08.2012
pawn Код:
format(Vinfo[v][VehPlate],22,"%s",plate);
Re: Array sizes etc. etc. -
milanosie - 22.08.2012
Ow wow, Im being stupid -.-
thanks anyway
No more allnighters for me when Im planning on scripting the next day -.-
Re: Array sizes etc. etc. -
Universal - 22.08.2012
Actually I cant find a logic explanation why you are creating a new array plate and after formatting it, assign it to vInfo enum. Wouldnt this be more simple and easier?
pawn Код:
format(Vinfo[v][VehPlate], sizeof Vinfo[v][VehPlate], "%d", RandomEx(100000,999999999));
Re: Array sizes etc. etc. -
FireCat - 22.08.2012
Quote:
Originally Posted by Universal
Actually I cant find a logic explanation why you are creating a new array plate and after formatting it, assign it to vInfo enum. Wouldnt this be more simple and easier?
pawn Код:
format(Vinfo[v][VehPlate], sizeof Vinfo[v][VehPlate], "%d", RandomEx(100000,999999999));
|
That will give an error, you cabra
Re: Array sizes etc. etc. - HuSs3n - 22.08.2012
Quote:
Originally Posted by Universal
Actually I cant find a logic explanation why you are creating a new array plate and after formatting it, assign it to vInfo enum. Wouldnt this be more simple and easier?
pawn Код:
format(Vinfo[v][VehPlate], sizeof Vinfo[v][VehPlate], "%d", RandomEx(100000,999999999));
|
he uses it in a command , so he must make a new variable (to split ,sscanf etc...) and then store it in Vinfo[v][VehPlate]