[SOLVED]Question about strings. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [SOLVED]Question about strings. (
/showthread.php?tid=71441)
[SOLVED]Question about strings. -
Klutty - 01.04.2009
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:
I want to make some when you join a DM area for example it says "%s joined bla bla bla"
But in the
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.
Re: Question about strings. -
Klutty - 01.04.2009
Anyone? Sorry for double post.
Re: Question about strings. -
Frank_Tesla - 01.04.2009
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
Re: Question about strings. -
Klutty - 01.04.2009
I have already used [128] ..
So what you say is that I can write 100,101,102 etc ?
Re: Question about strings. -
Frank_Tesla - 01.04.2009
Yessir, but you can use 128 over and over and over again.
What are you using this for?
Re: Question about strings. -
Klutty - 01.04.2009
Wow thanks!
I'm doing so if someone joins like a DM zone it says "*name* has joined /dm"