How to make this to return 2 things - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to make this to return 2 things (
/showthread.php?tid=486593)
How to make this to return 2 things -
barts - 09.01.2014
PHP код:
if (HP >= 100) return 0;
I want to return 0 and SetPlayerHealth(playerid, 100);
How to do it
Re: How to make this to return 2 things -
Cassely1704 - 09.01.2014
No?!
Код:
if (HP >= 100)
{
SetPlayerHealth(playerid, 100);
return 0;
}
Re: How to make this to return 2 things -
iZN - 09.01.2014
pawn Код:
if (HP >= 100) return SetPlayerHealth(playerid, 100), 0; // false (0)
Respuesta: How to make this to return 2 things -
Swedky - 09.01.2014
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);
Re: How to make this to return 2 things -
barts - 09.01.2014
No cos i want to return 0 and setplayerhp
Re: How to make this to return 2 things -
Hansrutger - 09.01.2014
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;
Re: How to make this to return 2 things -
erminpr0 - 09.01.2014
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) ?
Re: How to make this to return 2 things -
barts - 09.01.2014
thanks
Re: How to make this to return 2 things -
Hansrutger - 09.01.2014
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.