SA-MP Forums Archive
Callback is failing to read after a timer. - 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: Callback is failing to read after a timer. (/showthread.php?tid=640953)



Callback is failing to read after a timer. - Meller - 09.09.2017

Title.

Код:
[debug] Run time error 10: "Native function failed"
[debug]  strins
[debug] AMX backtrace:
[debug] #0 00008728 in ?? (0, 18294628) from rp.amx
[debug] #1 000556f0 in public LoadLumberjack (0) from rp.amx
PHP код:
SetTimerEx("LoadLumberjack"2000false"i"playerid); 
PHP код:
        forward public LoadLumberjack(playerid);
        public 
LoadLumberjack(playerid) {
            if(
IsPlayerConnected(playerid)) {
                
TogglePlayerControllable(playeridtrue);
                
Character[playerid][cDeliverRoute] = 1;
                switch(
Character[playerid][cDeliverRoute]) {
                    case 
1: {
                        
SendClientHint(playerid"Drive to the Gas Station at Interstate 27 to deliver your packages.");
                        
SetPlayerCheckpoint(playerid, -1544.1644,-2740.0630,49.16005);
                        
Character[playerid][cCheckpoint] = CP_LUMBERJACK_CP1;
                    }
                }
            }
        } 
I do get unfreezed, but nothing else happens other than getting the crashdetector message.


Re: Callback is failing to read after a timer. - Misiur - 09.09.2017

pawn Код:
forward public LoadLumberjack(playerid);
Do not use "public" here, just "forward"


Re: Callback is failing to read after a timer. - Primes007 - 09.09.2017

PHP код:
forward LoadLumberjack(playerid); 



Re: Callback is failing to read after a timer. - Meller - 09.09.2017

Quote:
Originally Posted by Misiur
Посмотреть сообщение
pawn Код:
forward public LoadLumberjack(playerid);
Do not use "public" here, just "forward"
That's not the problem.
https://sampforum.blast.hk/showthread.php?tid=359953


Quote:
Originally Posted by Primes007
Посмотреть сообщение
PHP код:
forward LoadLumberjack(playerid); 
You literally just reposted what Misiur said, well done.


Re: Callback is failing to read after a timer. - Vince - 09.09.2017

Quote:
Originally Posted by Misiur
Посмотреть сообщение
pawn Код:
forward public LoadLumberjack(playerid);
Do not use "public" here, just "forward"
Not the issue. I do the same and it works fine. I've read somewhere that it's actually better to do it that way, but I'd need to look it up.

Show definition for SendClientHint.


Re: Callback is failing to read after a timer. - Meller - 09.09.2017

Quote:
Originally Posted by Vince
Посмотреть сообщение
Not the issue. I do the same and it works fine. I've read somewhere that it's actually better to do it that way, but I'd need to look it up.

Show definition for SendClientHint.
PHP код:
stock SendClientHint(playeridmessage[]) {
        new 
text[144];
        
format(text144" * %s"message);
        
SendClientMessage(playerid0xC1D4C5FFtext);
    } 



Re: Callback is failing to read after a timer. - OneDay - 09.09.2017

Where is strins?


Re: Callback is failing to read after a timer. - Paulice - 09.09.2017

Quote:
Originally Posted by Vince
Посмотреть сообщение
Not the issue. I do the same and it works fine. I've read somewhere that it's actually better to do it that way, but I'd need to look it up.

Show definition for SendClientHint.
Quote:
Originally Posted by Slice
Today I learned the proper way to forward public functions is this:
pawn Код:
forward public OnSomethingHappen(a, b, c);
I've always done it without "public". The only difference, it seems, is it enforces some extra restrictions (such as not being able to assign default values).
-----
Comment out SendClientHint and see if crashdetect still gives you that error. Again, start debugging!


Re: Callback is failing to read after a timer. - Meller - 09.09.2017

Seems to me like eh.. it was a magical client error? Don't know how to describe it, since after restarting the server, it worked fantastic.

Thanks anyways for y'all trying to help me out, appreciate it.