[help] String size - 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: [help] String size (
/showthread.php?tid=113865)
[help] String size -
ғαιιοцт - 16.12.2009
Код:
ReactionTestString = "";
new random_set[71] = "AaBbCcDdEeFfGgHhiJjKkLMmNnOoPpQqRrSsTtUuVvWwXxYyZz12345678901234567890";
for(new i=0; i<RStringLength; i++)
{
ReactionTestString[i] = random_set[random(71)]; //this line
}
what size should it be in random() ?
the string is 70 characters long, so for the null char, I used 71 characters, is that correct?
and random() should be random(70) then? .. I don't really understand ><
Re: [help] String size -
woot - 16.12.2009
Just use
random_set[random(sizeof(random_set))];[/pawn]
Re: [help] String size -
ғαιιοцт - 16.12.2009
Quote:
Originally Posted by //exora
Just use
random_set[random(sizeof(random_set))];[/pawn]
|
but sizeof() will return 71..
and than if he uses character 71 that character doesn't exist, because there are only 70 chars in that string
Re: [help] String size - Zeex - 16.12.2009
random(n) returns numbers from 0 to n-1
Re: [help] String size -
ғαιιοцт - 16.12.2009
ooh yes like with numbers
random(20) is from 0 to 19
ok, thank you