SA-MP Forums Archive
[timerfix.plugin] cannot execute callback - 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: [timerfix.plugin] cannot execute callback (/showthread.php?tid=665838)



[timerfix.plugin] cannot execute callback - xRadical3 - 18.04.2019

My codes:
pawn Code:
OnGameModeInit:

SetTimer("SendRandomMessage", 3*60000, true);
RandomMessage_Order = 0;
//------------------------------------
Callback:

forward SendRandomMessage();
public SendRandomMessage()
{
    SendClientMessageToAll(0xFAAC58FF, RandomMessage_[RandomMessage_Order]);
    RandomMessage_Order++;
    if(RandomMessage_Order > sizeof(RandomMessage_))
    {
         RandomMessage_Order = 0;
    }
    return 1;
}
Problem:
pawn Code:
[14:35:55] [debug] Run time error 4: "Array index out of bounds"
[14:35:55] [debug]  Attempted to read/write array element at index 16 in array of size 16
[14:35:55] [debug] AMX backtrace:
[14:35:55] [debug] #0 0012af64 in public SendRandomMessage () in GameMode.amx
[14:35:55] [timerfix.plugin] cannot execute callback with name "SendRandomMessage"



Re: [timerfix.plugin] cannot execute callback - Pooh7 - 18.04.2019

pawn Code:
public SendRandomMessage()
{
    SendClientMessageToAll(0xFAAC58FF, RandomMessage_[RandomMessage_Order]);
    RandomMessage_Order++;
    if(RandomMessage_Order >= sizeof(RandomMessage_))
    { //                    ↑ equality check
         RandomMessage_Order = 0;
    }
    return 1;
}