Problem. Loop through alphabet letters.. - 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)
+--- Thread: Problem. Loop through alphabet letters.. (
/showthread.php?tid=288821)
Problem. Loop through alphabet letters.. -
LetsOWN[PL] - 09.10.2011
Hello guys, I am wondering, how to make a script, which will loop through alphabet.
Any ideas?
I did this:
pawn Код:
public OnFilterScriptInit()
{
new Literka[2];
Literka = "A";
for(new i = 10; i != 0; i--)
{
printf(Literka);
Literka++;
}
}
but it doesnt works..
Any ideas?
Re: Problem. Loop through alphabet letters.. -
GrimR - 09.10.2011
What's the purpose?
You need to check actual characters? Most would use a switch/case for that.
Re: Problem. Loop through alphabet letters.. -
Karlip - 09.10.2011
The server doesn't know alphabet, you have to teach it aka list the alphabet yourself.
Re: Problem. Loop through alphabet letters.. -
GrimR - 09.10.2011
Yeah I still don't understand the point lol, which makes it harder to come up with something.
What are you trying achieve?
Re: Problem. Loop through alphabet letters.. -
Vince - 09.10.2011
If you want to increment the letters through their respective ASCII code (see this list:
http://www.asciitable.com/ ), you need to use an integer value and wrap the character in single quotes.
pawn Код:
public OnFilterScriptInit()
{
new Literka = 'A';
for( ; Literka != 'Z'; Literka++)
{
printf("Char: %c - Decimal: %d", Literka, Literka);
}
}