Conditional expression - 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: Conditional expression (
/showthread.php?tid=411104)
Conditional expression -
Riddick94 - 27.01.2013
Is it possible to put that code into conditional expression?
pawn Код:
if(newhealth < oldhealth)
{
UpdateDynamic3DTextLabelText(Text3D:PlayerData[playerid][E_PLAYER_NICK], COLOR_LIGHTRED, string);
}
else if(newhealth > oldhealth)
{
UpdateDynamic3DTextLabelText(Text3D:PlayerData[playerid][E_PLAYER_NICK], COLOR_GREEN, string);
}
else
{
UpdateDynamic3DTextLabelText(Text3D:PlayerData[playerid][E_PLAYER_NICK], COLOR_NICK, string);
}
I think yes.. but it's gonna be a really long conditional..
Re: Conditional expression -
Scenario - 27.01.2013
I am fairly certain that it already is in a conditional expression; unless my programming vocabulary is off.
Re: Conditional expression -
Riddick94 - 27.01.2013
I meant:
@down,
That's the thing.. thanks anyway i will have to test it. I got confused while doing that one because it was a really long..
AW: Conditional expression -
Kwashiorkor - 27.01.2013
do you mean ternary operators?
pawn Код:
UpdateDynamic3DTextLabelText(Text3D:PlayerData[playerid][E_PLAYER_NICK],(newhealth<oldhealth)?(COLOR_LIGHTRED):((newhealth>oldhealth)?(COLOR_GREEN):(COLOR_NICK)), string);