Explain me.. ;] - 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: Explain me.. ;] (
/showthread.php?tid=87435)
Explain me.. ;] -
lakierka - 20.07.2009
Can you explain me what means that numbers? string[128]; string[256]; and others..;]
Re: Explain me.. ;] -
arnutisz - 20.07.2009
Search in wiki about strings. But for example:
"search" has 6 leters, so string will be: string[7];
Re: Explain me.. ;] -
lakierka - 20.07.2009
Can you tell me that link? Because I can't find it.
Re: Explain me.. ;] -
woot - 20.07.2009
When using
string[128]; - the variable has
128 cells (not sure) space for characters, that means you can input
upto 128 characters into that variable. (Alphabetic characters and numeric characters.)
When using
string; - the variable
can only be an integer, a number, that means it
cannot contain any type of characters.
Re: Explain me.. ;] -
lakierka - 20.07.2009
So it doesn't matter wich number I would write: 64, 128, 256 and others..?
Re: Explain me.. ;] -
Weirdosport - 20.07.2009
It all depends on the context. If it's a message you'll repeatedly send to a player, you may aswell stick with 128, because that is the output limit. There are very few places you'll need 256, but you're not bounded by binary numbers, so you could have 200 if you wanted. However, if you were just going to store a players name you would use MAX_PLAYER_NAME (Which I think is 24) as anything else would be a waste!
Re: Explain me.. ;] -
dice7 - 20.07.2009
And when using strings, always declare the number of cells for one more then the max number you will use: e.g. If you want to save a word with 99 characters, declare a string with 100 cells, because in the last cell there needs to be the "/0" character which basicly marks where the string ends, so the system will know how much to print out. Also, when getting characters out of strings, the cells always start with 0: e.g. if you declare chars[3];, you can only save characters in the cells char[0], char[1] and char[2]