How to make this to return 2 things
#1

PHP код:
if (HP >= 100) return 0
I want to return 0 and SetPlayerHealth(playerid, 100);
How to do it
Reply
#2

No?!

Код:
if (HP >= 100) 
{
SetPlayerHealth(playerid, 100);
return 0; 
}
Reply
#3

pawn Код:
if (HP >= 100) return SetPlayerHealth(playerid, 100), 0; // false (0)
Reply
#4

The return is not necessary. It might do it so it would be of the same way (I believe that better):

pawn Код:
if(HP >= 100) return SetPlayerHealth(playerid, 100);
Reply
#5

No cos i want to return 0 and setplayerhp
Reply
#6

Quote:
Originally Posted by iZN
Посмотреть сообщение
pawn Код:
if (HP >= 100) return SetPlayerHealth(playerid, 100), 0; // false (0)
Like this guy said. Just add a "coma" (,) after each sentence you would write in brackets ( { } ).

More examples:
Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You're not an admin."), SendClientMessage(playerid, -1, "Coz you're a noob."), SendClientMessage(playerid, -1, "And you did probably not apply for it!!!");

if(a <= 10) return a = 5, b = 6;

if(b == 25925) return a = 52, false;
Reply
#7

Quote:
Originally Posted by iZN
Посмотреть сообщение
pawn Код:
if (HP >= 100) return SetPlayerHealth(playerid, 100), 0; // false (0)
I think when you use

return first,second,third;

It will return only last one (third) ?
Reply
#8

thanks
Reply
#9

Quote:
Originally Posted by erminpr0
Посмотреть сообщение
I think when you use

return first,second,third;

It will return only last one (third) ?
No everything on the line will be returned. At least of what I know from other languages.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)