SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 21/07/2009, 09:15 PM   #1
ғαιιοцт
High-roller
 
ғαιιοцт's Avatar
 
Join Date: Feb 2008
Posts: 1,428
Reputation: 188
Default How can I make a user error appear in the compiler? (#error)

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.
ғαιιοцт is offline  
Old 21/07/2009, 09:22 PM   #2
James_Alex
Gangsta
 
Join Date: Dec 2008
Posts: 570
Reputation: 0
Default Re: How can I make a user error appear in the compiler? (#error)

ask JeNkStAX or ****** for this
they are really excellente with the plugins
James_Alex is offline  
Old 21/07/2009, 09:23 PM   #3
ғαιιοцт
High-roller
 
ғαιιοцт's Avatar
 
Join Date: Feb 2008
Posts: 1,428
Reputation: 188
Default Re: How can I make a user error appear in the compiler? (#error)

well I'm waiting for people like them to reply here
ғαιιοцт is offline  
Old 22/07/2009, 06:47 AM   #4
yezizhu
Gangsta
 
yezizhu's Avatar
 
Join Date: Nov 2007
Location: Shenzhen,China
Posts: 641
Reputation: 2
Default Re: How can I make a user error appear in the compiler? (#error)

Like #define, it will parse before compilng.
It should use with #if #elseif
Use printf to instead.
yezizhu is offline  
Old 22/07/2009, 07:21 AM   #5
ғαιιοцт
High-roller
 
ғαιιοцт's Avatar
 
Join Date: Feb 2008
Posts: 1,428
Reputation: 188
Default Re: How can I make a user error appear in the compiler? (#error)

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
ғαιιοцт is offline  
Old 22/07/2009, 08:12 AM   #6
yezizhu
Gangsta
 
yezizhu's Avatar
 
Join Date: Nov 2007
Location: Shenzhen,China
Posts: 641
Reputation: 2
Default Re: How can I make a user error appear in the compiler? (#error)

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/ : (
yezizhu is offline  
Old 22/07/2009, 08:48 AM   #7
ғαιιοцт
High-roller
 
ғαιιοцт's Avatar
 
Join Date: Feb 2008
Posts: 1,428
Reputation: 188
Default Re: How can I make a user error appear in the compiler? (#error)

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..
ғαιιοцт is offline  
Old 22/07/2009, 09:35 AM   #8
yezizhu
Gangsta
 
yezizhu's Avatar
 
Join Date: Nov 2007
Location: Shenzhen,China
Posts: 641
Reputation: 2
Default Re: How can I make a user error appear in the compiler? (#error)

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
}
yezizhu is offline  
Old 22/07/2009, 09:37 AM   #9
ғαιιοцт
High-roller
 
ғαιιοцт's Avatar
 
Join Date: Feb 2008
Posts: 1,428
Reputation: 188
Default Re: How can I make a user error appear in the compiler? (#error)

well I tried that, but I always get the error, even when the function Is used correctly.
ғαιιοцт is offline  
Old 22/07/2009, 09:57 AM   #10
yezizhu
Gangsta
 
yezizhu's Avatar
 
Join Date: Nov 2007
Location: Shenzhen,China
Posts: 641
Reputation: 2
Default Re: How can I make a user error appear in the compiler? (#error)

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

Sorry, I a'nt able to explain more.
yezizhu is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
COMPILER ERROR pimpscritper Help Archive 2 03/11/2009 10:18 PM
fatal error 111: user error: Unkown cell size indra Help Archive 4 11/08/2009 11:27 AM
Compiler Error emrelevent Help Archive 12 05/07/2009 04:42 PM
Compiler Error [nl]daplayer Help Archive 6 31/05/2009 10:36 AM
Compiler Error homerliew Help Archive 1 11/04/2009 02:10 PM


All times are GMT. The time now is 01:59 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.