05.10.2015, 20:41
(
Последний раз редактировалось MP2; 06.10.2015 в 09:58.
)
I have a very strange issue.
In my code, I have a public function. Below that public function, I have a normal function. Both these are at the end of my script. In another public callback (a SA-MP one) way higher, I call the non-public function I mentioned. It executes, but the return value doesn't get returned to the higher function.
If I remove the custom public function, however, it works. It also works if I swap the placement around, and put the function declaration before the public declaration.
What on earth could cause this? It is possible that there is a limit as to the number of public functions? Could y_hooks be causing the issue perhaps?
Any help appreciated. Thanks.
EDIT: Okay, I've found (sort of) the source of the problem. It's '#pragma dynamic'. If I remove it, everything works fine. My script uses a lot of memory though. What should I set pragma dynamic to? Should I look in to the 'amxlimit' and 'amxram' pragma directives also? If I just remove #pragma dynamic everything in my script breaks.
EDIT #2: Been playing around with the 'dynamic', 'amxlimit' and 'amxram' pragma directives with no luck. If I have pragma dynamic, the function return values get fucked up, and if I remove pragma dynamic, everying else in my script gets fucked (no pickups at places, textdraws not appearing etc.). What the hell do I do?!
EDIT #3: Attempt to clarify..
My code is like this:
In my code, I have a public function. Below that public function, I have a normal function. Both these are at the end of my script. In another public callback (a SA-MP one) way higher, I call the non-public function I mentioned. It executes, but the return value doesn't get returned to the higher function.
If I remove the custom public function, however, it works. It also works if I swap the placement around, and put the function declaration before the public declaration.
What on earth could cause this? It is possible that there is a limit as to the number of public functions? Could y_hooks be causing the issue perhaps?
Any help appreciated. Thanks.
EDIT: Okay, I've found (sort of) the source of the problem. It's '#pragma dynamic'. If I remove it, everything works fine. My script uses a lot of memory though. What should I set pragma dynamic to? Should I look in to the 'amxlimit' and 'amxram' pragma directives also? If I just remove #pragma dynamic everything in my script breaks.
EDIT #2: Been playing around with the 'dynamic', 'amxlimit' and 'amxram' pragma directives with no luck. If I have pragma dynamic, the function return values get fucked up, and if I remove pragma dynamic, everying else in my script gets fucked (no pickups at places, textdraws not appearing etc.). What the hell do I do?!
EDIT #3: Attempt to clarify..
My code is like this:
pawn Код:
public OnPlayerSpawn(playerid)
{
print("calling testfunc().."); // Gets called
printf("ret: %i", testfunc()); // Doesn't get called
// Nor does the rest of the callback - it hasn't returned here? has it returned to some other callback somehow?
return 1;
}
public SomeTimerFunc()
{
// Gets called fine on a timer
return 1;
}
testfunc()
{
print("testfunc()"); // prints fine
return 1;
}