Multiple 'if' statements problem
#2

You will maybe notice that the you already made something similar with the "/stunts" command
pawn Код:
//
    if(strcmp("/repair", cmdtext, true) == 0)
    {
        if(gTeam[playerid] == TEAM_STUNTS)
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                RepairVehicle(GetPlayerVehicleID(playerid));
                return SendClientMessage(playerid, COLOR_GREEN, "Your vehicle has been repaired!");
            }
        }
    }
or you use && (and)
pawn Код:
//
    if(
        (strcmp("/repair", cmdtext, true) == 0) &&
        (gTeam[playerid] == TEAM_STUNTS) &&
        (IsPlayerInAnyVehicle(playerid))
    ) {
        RepairVehicle(GetPlayerVehicleID(playerid));
        return SendClientMessage(playerid, COLOR_GREEN, "Your vehicle has been repaired!");
    }
Also read that Control Structures
Reply


Messages In This Thread
[SOLVED] Multiple 'if' statements problem - by thenachoman180 - 07.10.2012, 00:23
AW: Multiple 'if' statements problem - by Nero_3D - 07.10.2012, 00:31
Re: AW: Multiple 'if' statements problem - by thenachoman180 - 07.10.2012, 00:37
Re: Multiple 'if' statements problem - by thenachoman180 - 07.10.2012, 00:41
AW: Multiple 'if' statements problem - by Nero_3D - 07.10.2012, 01:02
Re: Multiple 'if' statements problem - by RedFusion - 07.10.2012, 01:03
Re: Multiple 'if' statements problem - by thenachoman180 - 07.10.2012, 01:05

Forum Jump:


Users browsing this thread: 1 Guest(s)