[Tutorial] Known Runtime/Compiler PAWN Bugs
#2

12)
  • Code
    Code:
    #if defined FILTERSCRIPT
    	public OnFilterScriptInit()
    	{
    	   	new idx = funcidx("OnPlayerCommandPerformed");
    	   	if(idx == -1)
    	   	{
    			#emit LOAD.S.alt  idx
    	   	}
    	}
    #else
    	public OnGameModeInit()
    	{
    		new idx = funcidx("OnPlayerCommandPerformed");
    	   	if(idx != -1)
    	   	{
    			#emit LOAD.S.alt  idx
    	   	}
    	}
    #endif
  • Problem

    You get this error "error 017: undefined symbol "idx" though there is no error.

    If you are using a gamemode (it will give rise to an error in OnFilterscriptInit), then the compiler gives that error for the line "#emit LOAD.S.alt idx" which is inside OnFilterScriptInit.The compiler isn't supposed to check OnFilterScriptInit because #if defined FILTERSCRIPT will fail.The compiler ignores the "new idx" because the #if failed but it doesn't ignore "#emit LOAD.S.alt idx".

    The generalized version of this bug is that #emit code when placed inside #if is always added irrespective of the falsity of the condition given to #if.

  • Solution:

    The solution here is to make idx a global variable and change your inline assembly so that it will work with global variable.
Reply


Messages In This Thread
Known Runtime/Compiler PAWN Bugs - by Ada32 - 14.04.2015, 21:49
Re: Known Runtime/Compiler PAWN Bugs - by Yashas - 17.06.2015, 18:00
Re: Known Runtime/Compiler PAWN Bugs - by Yashas - 12.07.2015, 12:14

Forum Jump:


Users browsing this thread: 2 Guest(s)