Quick question | +1 rep -
NewbBeginner - 27.02.2012
Hei
Is this:
Код:
if( !IsAtPoint( playerid ) )
{
SendClientMessage( playerid, COLOR_WHITE, "Se");
SendClientMessage( playerid, -1, "Sa" );
}
Same as this:
Код:
if( !IsAtPoint( playerid ) ) return SendClientMessage(playerid, -1, "Something");
I just want to send 2 line SendCLientMessage but not sure if im right
So what I want is tat if their not in that point, then it will return and send 2 line sendclientmessage.
-------------------
And one more
Код:
if(AccInfo[playerid][pBizzKey] == 31 && AccInfo[playerid][pBizzKey] == 30)
Am I right, that if someone has bizzkey 31, then He can use this cmd or when somebody has bizkey 30 then he can use this cmd ?
Or there is suposed to be || not && ?
Re: Quick question | +1 rep -
Konstantinos - 27.02.2012
Yes it is
pawn Код:
if( !IsAtPoint( playerid ) )
{
SendClientMessage( playerid, COLOR_WHITE, "Se");
SendClientMessage( playerid, -1, "Sa" );
return 1;
}
pawn Код:
if( !IsAtPoint( playerid ) ) return SendClientMessage( playerid, COLOR_WHITE, "Se") && SendClientMessage( playerid, -1, "Sa" );
Re: Quick question | +1 rep -
2KY - 27.02.2012
Alternatively you could use a comma in between SendClientMessage lines.
pawn Код:
if( !IsAtPoint( playerid ) ) return SendClientMessage( playerid, COLOR_WHITE, "Se"), SendClientMessage( playerid, -1, "Sa" );
pawn Код:
if(AccInfo[playerid][pBizzKey] == 31 || AccInfo[playerid][pBizzKey] == 30)
//Literally meaning if their AccInfo for "BizzKey" is 31 OR 30.
Re: Quick question | +1 rep -
Konstantinos - 27.02.2012
Either comma "
,", or AND "
&&" both ways work.
Re: Quick question | +1 rep -
Twisted_Insane - 27.02.2012
Yep, just after the first "SendClientMessage", you gotta put the sign "&&"!
I'd prefer that way, it has got a better overview!
Re: Quick question | +1 rep -
Gh05t_ - 27.02.2012
Quote:
Originally Posted by Dwane
pawn Код:
if( !IsAtPoint( playerid ) ) return SendClientMessage( playerid, COLOR_WHITE, "Se") && SendClientMessage( playerid, -1, "Sa" );
|
This is redundant.
pawn Код:
if( !IsAtPoint( playerid ) )
{
SendClientMessage( playerid, COLOR_WHITE, "Se");
SendClientMessage( playerid, -1, "Sa" );
return 1;
}
Re: Quick question | +1 rep -
Konstantinos - 27.02.2012
Quote:
Originally Posted by Gh05t_
This is redundant.
pawn Код:
if( !IsAtPoint( playerid ) ) { SendClientMessage( playerid, COLOR_WHITE, "Se"); SendClientMessage( playerid, -1, "Sa" ); return 1; }
|
Did you read all the posts before you post something. He asked if first way is same as the 2nd.
Even if it's redundant as you said, it saves lines. I have some code with this way SendClientMessage && ShowPlayerDialog and both work fine. Better to got them on one line, instead of 5 lines.
Re: Quick question | +1 rep -
Gh05t_ - 27.02.2012
Quote:
Originally Posted by Dwane
Did you read all the posts before you post something. He asked if first way is same as the 2nd.
Even if it's redundant as you said, it saves lines. I have some code with this way SendClientMessage && ShowPlayerDialog and both work fine. Better to got them on one line, instead of 5 lines.
|
It DOESN'T matter about the amount of lines, it's the redundancy of how the code operates. It'd most likely be best to execute each statement individually rather that method.