SA-MP Forums Archive
[HELP] If there are 2 if - 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: [HELP] If there are 2 if (/showthread.php?tid=354600)



[HELP] If there are 2 if - V4at - 27.06.2012

I have if(GetPlayerSkin(playerid) == 125) and if(GetPlayerColor(playerid) == COLOR_RED) How to do "else" them? If there is one "if" that i can do, but if there is two "if" I do not know.


Re: [HELP] If there are 2 if - Skaizo - 27.06.2012

do you mean this?
if((GetPlayerSkin(playerid) == 125) && GetPlayerColor(playerid) == COLOR_RED)


Re: [HELP] If there are 2 if - newbienoob - 27.06.2012

This?
pawn Код:
if(GetPlayerSkin(playerid) == 125)
{
     //do something here
}
else
{
     //do something here
     return 1;
}
if(GetPlayerColor(playerid) == COLOR_RED)
{
    //do something here
}
else
{
   //do something here
     return 1;
}
Or this?
pawn Код:
if(GetPlayerSkin(playerid) == 125 && GetPlayerColor(playerid) == COLOR_RED)
{
     //do something here
}
else
{
      // do something here
        return 1;
}



Re: [HELP] If there are 2 if - [MM]RoXoR[FS] - 27.06.2012

Do you mean
pawn Код:
if(GetPlayerSkin(playerid) == 125 && GetPlayerColor(playerid) == COLOR_RED)
or
pawn Код:
if(GetPlayerSkin(playerid) == 125 )
{
//..code
}
else if( GetPlayerColor(playerid) == COLOR_RED)



Re : [HELP] If there are 2 if - V4at - 27.06.2012

Probably will be

Код:
if(GetPlayerSkin(playerid) == 125 && GetPlayerColor(playerid) == COLOR_RED)



Re: [HELP] If there are 2 if - SKAzini - 27.06.2012

pawn Код:
if(GetPlayerSkin(playerid) == 125 && GetPlayerColor(playerid) == COLOR_RED)
{
//do something
return 1;
}
Would make it so if the player has ID 125 as skin AND their GetPlayerColor is RED, do this and that.


Re: [HELP] If there are 2 if - Randy More - 27.06.2012

It's dependable, if you want to have else for both together, it should be like that:

pawn Код:
if(GetPlayerSkin(playerid) == 125 && GetPlayerColor(playerid) == COLOR_RED)
{
    // Your code if the player does have them both.
    return 1;
}
else
{
    // Your code if the player doesn't have one of them.
    return 1;
}

// ------------------------------------------------------------- //

if(GetPlayerSkin(playerid) == 125)
{
    // Your code if the player does have the skin.
    return 1;
}
else
{
    // If not.
    return 1;
}

if(GetPlayerColor(playerid) == COLOR_RED)
{
    // Your code if the player does have color.
    return 1;
}
else
{
    // If not.
    return 1;
}