String not passing in SetTimer (seems illogical)
#1

This problem is really pissing me off, all the code looks perfect but it just doesn't work properly.

Basically if someone says a word in OnPlayerText, it sets a timer with a randomised phrase to be sent back to them:

pawn Код:
public Reply(playerid, text[])
{
    print(text); // this prints: "<null>"

    new h, m, s;
    gettime(h, m, s);
    msgaF(WHITE, "reply string: {FFFFFF}%s", text);
    printf("[%d:%d:%d] reply string: {FFFFFF}%s", h, m, s, text);
}
public OnPlayerText(playerid, text[])
{
    if(strfind(text, "word", true)!=-1)
    {
        new r = random(sizeof(ReplyArray));
        printf("random = %d, text to say = %s", r, ReplyArray[r]); // This prints the correct number and correct string
        SetTimerEx("TalkSteve", 3000, false, "ds", playerid, ReplyArray[r]); // This all seems perfect, am I missing something?
    }
Am I just overtired and missed something obvious?
Would appreciate replies thanks
Reply
#2

Basically sending string with SetTimerEx is bugged (since ever)

Just send the randomized number

And you call "TalkSteve" not "Reply"
Reply
#3

Oh right, that really sucks. I'll fix it with a global variable, because I use the function for more than just the array.

They really should fix that! lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)