View Single Post
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 08-20-2021 , 19:00   Re: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
Reply With Quote #51

Quote:
Originally Posted by Dragokas View Post
MAGNAT2645, interesting ability, but IMHO, useless sample =) Can't find where it could be useful. The same can be written by manual string enquoting.
As i said, it's not that useful. You can use it in a macro to join text (and put it without quotes).
Code:
#define ERROR(%0) PrintToServer( "ERROR: " ... #%0 )

int a = 5;
int b = 0;
int c;
if ( b == 0 ) ERROR(Division by zero!);
else          c = a / b;
But, it's better to use quotes for better readability
Code:
#define ERROR(%0) PrintToServer( "ERROR: " ... %0 )
if ( b == 0 ) ERROR( "Division by zero!" );
__________________

Last edited by MAGNAT2645; 08-20-2021 at 19:01.
MAGNAT2645 is offline