Getting all characters one by one
#1

Just out of curiosity..
If I would want to make a command, lets say /riddle [riddle text].
Would it be possible to make it show each character one by one?

For example: /riddle car
And it will say something like "First character is: C"
then maybe make some timer and after couple of seconds it say "Second character is: A" and again after some seconds it say "Third character is: R".
Is that possible and if yes, how would I do it?
Reply
#2

Use timers/strings to your advantage. Separate the string, and set timers, etc.
Reply
#3

How do I seperate the string?
Please show an example
Reply
#4

There is a stock of "split" in wiki.

pawn Code:
// Author unknown. It was probably someone smart like [[User:DracoBlue|DracoBlue]] or [[User:Y_Less|Y_Less]].
stock split(const strsrc[], strdest[][], delimiter)
{
    new i, li;
    new aNum;
    new len;
    while(i <= strlen(strsrc))
    {
        if(strsrc[i] == delimiter || i == strlen(strsrc))
        {
            len = strmid(strdest[aNum], strsrc, li, i, 128);
            strdest[aNum][len] = 0;
            li = i+1;
            aNum++;
        }
        i++;
    }
    return 1;
}
check this out for usage:
https://sampwiki.blast.hk/wiki/Code_Snippets
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)