2D Array (1st playerid, 2nd string)
#1

iok.. what i need is this
Код:
new pText[MAX_PLAYERS][256];
Two-dimensional array string
Код:
new twodimensionalarraystring[ROWS][COLUMNS][256]; //for a string with a max length of 255, excluding NULL byte
I want use it like this, but how i do it correctly
Код:
format(pText[playerid],sizeof(pText[playerid]),"TEST: %s(%d): %s",pName(playerid),playerid,params);
SendClientMessageToAll(COLOR_WHITE, pText[playerid]);
CORRECT:
Код:
format( pText[playerid], sizeof(pText[]), "TEST: %s(%d): %s", pName(playerid), playerid, params);
Reply
#2

try this:
pawn Код:
format( pText[playerid], sizeof(pText[])-1, "TEST: %s(%d): %s", pName(playerid), playerid, params);
Reply
#3

Nope. But thx for try
Reply
#4

Change
pawn Код:
sizeof(pText[playerid])
to
pawn Код:
128
And also change
pawn Код:
new pText[MAX_PLAYERS][256];
to
pawn Код:
new pText[MAX_PLAYERS][128];
Reply
#5

I don't really remember how I did it but you could try (don't know if it works, but worth a shot right?) format(pText[playerid][0],sizeof(pText[playerid][0], "TEST: %s(%d): %s", pName(playerid), playerid, params);

larzi: will that get rid of the warnings/errors? (post had been made, so yea I figured, why not post it)
Reply
#6

It got rid of warnings when I tried atleast, so yeah...
And I also tried only sizeof(pText) but that wouldn't work out (I think).
But 128 (which is the maxsize of pText) gives no warnings/errors
Reply
#7

Quote:
Originally Posted by pen_†ĥęGun
pawn Код:
format( pText[playerid], sizeof(pText[])-1, "TEST: %s(%d): %s", pName(playerid), playerid, params);
Quote:

Nope. But thx for try

Are you sure?

pawn Код:
main()
{
  new pText[MAX_PLAYERS][256];
  format( pText[0], sizeof(pText[])-1, "TEST: %s(%d): %s", "Spiderman", 0, "params");
  print(pText[0]);
}
Just tested, works perfekt.
Reply
#8

please use 128 not 256 for cell size
Reply
#9

Quote:
Originally Posted by lrZ^ aka LarzI
please use 128 not 256 for cell size
there is no reason, not to use that (256)
i even use more then 256, if i "realy need" so much.
So you dont know, how and for what 'TMasters.tk' using it for..
Reply
#10

but strings can't be bigger than 128 cells so why bother defining the vars with more?
their inactive and useless
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)