an array with strings.
#1

okay, heres what i want.

i have a array
Код:
new arr[15][128];
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..
Reply
#2

Why are you formatting something without a string?

I mean smth like this:
pawn Код:
format(str,128,"lalaa %s",
yourstringheir
pawn Код:
);
Reply
#3

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");
Reply
#4

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..
Reply
#5

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]);
Reply
#6

Thank you alex
* legodude gives a cookie to Alex!!
Reply
#7

Quote:
Originally Posted by legodude
Посмотреть сообщение
Thank you alex
* Alex_Valde gives a cookie to Alex!!
Anytime.
Reply
#8

pawn Код:
sizeof(arr[])
Use that to get the size of sub-array.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)