Problem. Loop through alphabet letters..
#1

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?
Reply
#2

What's the purpose?

You need to check actual characters? Most would use a switch/case for that.
Reply
#3

The server doesn't know alphabet, you have to teach it aka list the alphabet yourself.
Reply
#4

Yeah I still don't understand the point lol, which makes it harder to come up with something.

What are you trying achieve?
Reply
#5

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);
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)