Quick question | +1 rep
#1

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 && ?
Reply
#2

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" );
Reply
#3

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.
Reply
#4

Either comma ",", or AND "&&" both ways work.
Reply
#5

Yep, just after the first "SendClientMessage", you gotta put the sign "&&"!
I'd prefer that way, it has got a better overview!
Reply
#6

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;
}
Reply
#7

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.
Reply
#8

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)