SA-MP Forums Archive
How can I make a user error appear in the compiler? (#error) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How can I make a user error appear in the compiler? (#error) (/showthread.php?tid=87696)



How can I make a user error appear in the compiler? (#error) - ғαιιοцт - 21.07.2009

in pawn-lang.pdf I read that #error is used for displaying user errors when compiling.

I tried to use this in one of my plugins, but I seem to need some help with this:

Code:
stock F_SetMenuTitleBoxColor(menuid, color)
{
	if(MenuInfo[menuid][UsedMenu] == true)
	{
		TextDrawBoxColor(MenuInfo[menuid][T_Title], color);
		return 1;
	}
	else
	{
		#error menuid doesn't exist.
		return 0;
	}
}
this is how I tried to use it, but the error just always appears.
can anyone please give me an example of how I can do this? thanks in advance.


Re: How can I make a user error appear in the compiler? (#error) - James_Alex - 21.07.2009

ask JeNkStAX or Y_Less for this
they are really excellente with the plugins


Re: How can I make a user error appear in the compiler? (#error) - ғαιιοцт - 21.07.2009

well I'm waiting for people like them to reply here


Re: How can I make a user error appear in the compiler? (#error) - yezizhu - 22.07.2009

Like #define, it will parse before compilng.
It should use with #if #elseif
Use printf to instead.


Re: How can I make a user error appear in the compiler? (#error) - ғαιιοцт - 22.07.2009

Quote:
Originally Posted by yezizhu
Like #define, it will parse before compilng.
It should use with #if #elseif
Use printf to instead.
I tried using #else and #if before, but I can't get this working
And no, I need #error, not print


Re: How can I make a user error appear in the compiler? (#error) - yezizhu - 22.07.2009

I cann't expression well by my poor english.
Function is run-time compiling, defintion is compiling before run-time, so defintion does't recognize function's logcal(if else, etc)
This may contain in pawn-lang.pdf.

F*ck my poor english up/ : (


Re: How can I make a user error appear in the compiler? (#error) - ғαιιοцт - 22.07.2009

It Does recognise if and else if you use #if and #else.
but I don't know how to use them for what I want to do..


Re: How can I make a user error appear in the compiler? (#error) - yezizhu - 22.07.2009

It works something like
Code:
#define USE_MENU (true)
stock use_menu(){
  #if USE_MENU
  {
  }
  #else
    #error menu doesn't use
  #endif
  return USE_MENU
}



Re: How can I make a user error appear in the compiler? (#error) - ғαιιοцт - 22.07.2009

well I tried that, but I always get the error, even when the function Is used correctly.


Re: How can I make a user error appear in the compiler? (#error) - yezizhu - 22.07.2009

Look ysi/core/ysi_bit.own
It has an usage about #error

Sorry, I a'nt able to explain more.