[HELP] If there are 2 if
#1

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.
Reply
#2

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

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;
}
Reply
#4

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)
Reply
#5

Probably will be

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

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.
Reply
#7

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)