[HELP] MaX_PLAYERS and variable question.. -
DarrenReeder - 29.05.2010
*new question*
Okay, this is my question....
if new Variable; is a global variable...and new Variable[MAX_PLAYERS]; is a variable which has a slot for every playerid in the server (so Variable[0] for player id 0, Variable[1] for playerid 1 etc.) how do i make a string variable for every playerid in the server?
will i jsut use
new string[256][MAX_PLAYERS]; or somthing?
Re: noobie string/variable question.. -
(SF)Noobanatior - 29.05.2010
Quote:
Originally Posted by HighDarren (DarrenReeder)
I jsut want to make sure these are true..
- A String is a string of text stored inside a variable??
- A variable can hold a string of text or a numeric value...
- When you stream/print a variable the program converts the numberic value to a string and then puts it into the stream of text in the console....
|
1. true well can also be blank
2.a var can hold a string a integer or float depending on the var ie new str[64]; new Float:decimal; or new integer;
also a string can hold a interger too new str[10] = "1000"; strval(str) = 1000
3. i belive so the cosole reads each cell of a str and converts that to a char and prints that to the console
ie str[10] = 10cells and 1 char can be in each
if that helps
Re: noobie string/variable question.. -
DarrenReeder - 29.05.2010
mmhmm yeah... so to create a string you need to have
new string[258]; then it can be 258 characters long? true?
Re: noobie string/variable question.. -
(SF)Noobanatior - 29.05.2010
pawn Код:
sorry yes it can be upto 256 [0]-[255]
na doesnt have to be that long you can make it [256] and just print "hi" which is only 3 as there is allways a blank on the end
Re: noobie string/variable question.. -
DarrenReeder - 29.05.2010
nah i know..but the number is the [] is the max? and each letter is stored in each "slot"?
Re: noobie string/variable question.. -
(SF)Noobanatior - 29.05.2010
pawn Код:
correct str[10]="hello" [0] = h [1]= e [2] = l etc
and if you are passing strings to diff vars the need to be the same size
Re: noobie string/variable question.. -
Sergei - 29.05.2010
Quote:
Originally Posted by HighDarren (DarrenReeder)
nah i know..but the number is the [] is the max? and each letter is stored in each "slot"?
|
You can store 255 characters in 256 cells big array. Last cell will always be '\0'.
Re: noobie string/variable question.. -
(SF)Noobanatior - 29.05.2010
yeah but you got 0 as well so 0 -255 = 256
so 256 really with /0 in the last 1 but can only use 255
Re: noobie string/variable question.. -
Sergei - 29.05.2010
Quote:
Originally Posted by (SF)Noobanatior
yeah but you got 0 as well so 0 -255 = 256
so 257 really with /0 in the last 1 but can only use 256
|
Noobanatior, read your name and stop posting idiotic things.
Re: noobie string/variable question.. -
DarrenReeder - 29.05.2010
Quote:
Originally Posted by $ЂЯĢ
Quote:
Originally Posted by (SF)Noobanatior
yeah but you got 0 as well so 0 -255 = 256
so 257 really with /0 in the last 1 but can only use 256
|
Noobanatior, read your name and stop posting idiotic things.
|
Lol...
anyways..
Thanks everyone! i was just making sure i understand it all correctly...