multiple functions in one "if" line
#1

Hello,

i was wondering if it would be possible to do something like this:
pawn Код:
if(User[playerid][USER_EXP] == 0) return User[playerid][USER_RANK] = 0 (PlayerTextDrawTextSize(playerid, expb[playerid], 222.761901, 0.000000)(UpdateTextDraw(playerid));
but how do i do this properly?
or must it be:
pawn Код:
if(User[playerid][USER_EXP] == 0)
{
    User[playerid][USER_RANK] = 0;
    PlayerTextDrawTextSize(playerid, expb[playerid], 222.761901, 0.000000);
    UpdateTextDraw(playerid); //i have this forwarded (it hides and shows the exp bar to update it)
    return 1;
}
The reason i am asking is because if the first way can be done it will be shorter code.
Reply
#2

pawn Код:
if(User[playerid][USER_EXP] == 0) return PlayerTextDrawTextSize(playerid,expb[playerid], 222.761901, 0.000000), UpdateTextDraw(playerid), User[playerid][USER_RANK] = 0;
Reply
#3

thanks man!
Reply
#4

Shorter code does not always equal better code. For the sake of clarity I'd still write the compound block instead of resorting to commas.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)