[HELP] MaX_PLAYERS and variable question..
#1

*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?
Reply
#2

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
Reply
#3

mmhmm yeah... so to create a string you need to have

new string[258]; then it can be 258 characters long? true?
Reply
#4

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

nah i know..but the number is the [] is the max? and each letter is stored in each "slot"?
Reply
#6

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

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'.
Reply
#8

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
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)