an array with strings. - 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: an array with strings. (
/showthread.php?tid=212658)
an array with strings. -
legodude - 17.01.2011
okay, heres what i want.
i have a array
so that means i have 15 strings with 128 string size.
but when i use a format on it:
Код:
format(str[3],sizeof(str[3]),"i want this to be in slot 3");
it gives me a few errors:
Код:
C:\Documents and Settings\Administrator\Mijn documenten\samp server\server\filterscripts\cctv.pwn(36) : error 001: expected token: "]", but found "-identifier-"
C:\Documents and Settings\Administrator\Mijn documenten\samp server\server\filterscripts\cctv.pwn(36) : warning 215: expression has no effect
C:\Documents and Settings\Administrator\Mijn documenten\samp server\server\filterscripts\cctv.pwn(36) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Administrator\Mijn documenten\samp server\server\filterscripts\cctv.pwn(36) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Mijn documenten\samp server\server\filterscripts\cctv.pwn(36) : fatal error 107: too many error messages on one line
help me please..
Re: an array with strings. -
WillyP - 17.01.2011
Why are you formatting something without a string?
I mean smth like this:
pawn Код:
format(str,128,"lalaa %s",
yourstringheir
Re: an array with strings. -
Toreno - 17.01.2011
I don't understand you clearly. However, if you need it to be slot 3 in your array.
Then...
It starts from 0;
pawn Код:
format(arr[2],sizeof(arr[2]),"i want this to be in slot 3");
Re: an array with strings. -
legodude - 17.01.2011
that doesnt matter. at all. i just want it to work without errors or warnigns...
if u looked at my post u could have nderstood that
and i am doing it with %s and so on. but didnt show them here. cuz that was no relevance at all to this problem..
Re: an array with strings. -
Alex_Valde - 17.01.2011
You don't need to sizeof it.
Try this:
pawn Код:
new arr[15][128];
format(arr[3],128,"i want this to be in slot 3");
printf("%s", arr[3]);
Re: an array with strings. -
legodude - 17.01.2011
Thank you alex
* legodude gives a cookie to Alex!!
Re: an array with strings. -
Alex_Valde - 17.01.2011
Quote:
Originally Posted by legodude
Thank you alex
* Alex_Valde gives a cookie to Alex!!
|
Anytime.
Re: an array with strings. -
Stylock - 17.01.2011
Use that to get the size of sub-array.