Use "return new.." Possible?
#1

Hello,

I get error when I do it:
PHP код:
new 2;
if(
== 2)return new string[128]; format(string,sizeof(string),"x = %d",x),SendClientMessageToAll(-1,string); 
that's errors:
PHP код:
(2742) : error 029invalid expressionassumed zero
(2742) : error 017undefined symbol "str"
(2742) : warning 215expression has no effect
(2742) : error 001expected token";"but found "]"
(2742) : fatal error 107too many error messages on one line 
Line 2742:
PHP код:
if(== 2)return new string[128]; format(string,sizeof(string),"x = %d",x),SendClientMessageToAll(-1,string); 
I don't want to use that:
PHP код:
if(== 2)
{
        new 
string[128];
        
format(string,sizeof(string),"x = %d",x);
        return 
SendClientMessageToAll(-1,string);

There's a way to use it without errors?
Reply
#2

You need to put it in a compound statement, because if you stack it like this:
pawn Код:
if(something) (function); (function);
The compiler will just use it like this:
pawn Код:
if(something) (function);
(function);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)