#emit
#4

Quote:
Originally Posted by Kwarde
View Post
A non-emit alternative:

Code:
stock bool:FALSE = false;
new scmExStr[144];
#define SendClientMessageEx(%0,%1,%2,%3) do{format(scmExStr,144,%2,%3);SendClientMessage(%0,%1,scmExStr);}while(FALSE)
Note that this (obviously) will not work this way:
Code:
if (!statement)
    return SendClientMessageEx...
As it's a macro/define, this would be translated to "return do{format...".
Also if you just use parameters playerid, color, message it this ..Ex function would fail as it wouldn't be recognised by the pre-processor.
Also you may have noticed the "stock bool:FALSE = false". The do statement must run once (hence the while(false)). Using "false" you'd get an error (empty statement I believe, indu---something--- code). By defining stock FALSE you still use the same statement except the compiler doesn't recognise it as an empty statement. So in short, just a way to make the compiler happy)

Even though it doesn't matter that much with systems these days, this is better for runtime speeds. Just go with whatever you desire, this is just what I prefer.
This is a very creative approach, I wouldn't have thought of using a macro for this. +rep
Reply


Messages In This Thread
#emit - by Salint - 24.01.2020, 15:51
Re: #emit - by Markski - 24.01.2020, 20:52
Re: #emit - by Kwarde - 24.01.2020, 21:25
Re: #emit - by Markski - 24.01.2020, 22:36
Re: #emit - by Salint - 25.01.2020, 04:35
Re: #emit - by Calisthenics - 25.01.2020, 07:56

Forum Jump:


Users browsing this thread: 1 Guest(s)