[SOLVED]Question about strings.
#1

I have this in OnPlayerConnect:
pawn Код:
new string[256];
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string, sizeof(string), "~%s has joined the Sweet Life~",playername);
    SendClientMessageToAll(COLOR_LIGHTBLUE,string);
The question is about this:
pawn Код:
new string[256];
I want to make some when you join a DM area for example it says "%s joined bla bla bla"

But in the
pawn Код:
new string[256];
the numbers, (256) can you write like 1 2 3 etc or is it any certain numbers that only them can be used? If I have 1 [256] and 1 [128] can I use the same numbers in another string or..?

Thanks,

Klutty.
Reply
#2

Anyone? Sorry for double post.
Reply
#3

You're defining how many cells are in the string. Read what ****** has posted about this.

Most of the time just use 128, unless you're sending data to a userfile.

new string[128];


Also, if you are formatting something very short you can save memory by snipping it down to 20 - 40.

string[MAX_PLAYER_NAME] is string[20] if you've defined MAX_PLAYER_NAME as 20
Reply
#4

I have already used [128] ..

So what you say is that I can write 100,101,102 etc ?
Reply
#5

Yessir, but you can use 128 over and over and over again.


What are you using this for?
Reply
#6

Wow thanks!

I'm doing so if someone joins like a DM zone it says "*name* has joined /dm"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)