Need some help with if, else if or else
#5

You can do it this way or the way you had it...basically what it does is check if their score is less than or equal to 5, if it is we send them a message, if not we continue

pawn Код:
case DIALOG_SNIPER:
{
    if( response )
    {
        if(GetPlayerScore(playerid) <= 5)
        {
            ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Select your Class 3/4", "{00CC33}Assault \n{00CC33}Sniper \n{00CC33}Medic \n{00CC33}Flame Thrower \n{00CC33}Pilot \n{00CC33}Engineer \n{00CC33}Spy \n{00CC33}Scout ", "Continue", "Back");
            echo(playerid,COLOR_DARKRED,"You must have atleast Rank 2 to be a Sniper!");
        }
        else
        {
            gPlayerClass[playerid] = SNIPER_CLASS;
            GivePlayerWeapon(playerid, 4, 1);//knife
            GivePlayerWeapon(playerid, 22, 15);//9mm
            GivePlayerWeapon(playerid, 25, 25);//shotgun
            GivePlayerWeapon(playerid, 44, 1);//night vision goggles
            GivePlayerWeapon(playerid, 41, 43);//spraycan
            SetPlayerHealth(playerid, 75);
        }
    }
    else return ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Select your Class 3/4", "{00CC33}Assault \n{00CC33}Sniper \n{00CC33}Medic \n{00CC33}Flame Thrower \n{00CC33}Pilot \n{00CC33}Engineer \n{00CC33}Spy \n{00CC33}Scout ", "Continue", "Back");
    return 1;
}
If you notice, we force them right back into the previous dialog (well, what you put if they don't respond) and then we send them a client message. If that isn't true, we'll then set their class.
Reply


Messages In This Thread
Need some help with if, else if or else - by MSI - 31.01.2012, 13:30
Re: Need some help with if, else if or else - by milanosie - 31.01.2012, 13:36
Re: Need some help with if, else if or else - by Jochemd - 31.01.2012, 13:37
Re: Need some help with if, else if or else - by MSI - 31.01.2012, 13:38
Re: Need some help with if, else if or else - by [ABK]Antonio - 31.01.2012, 13:43

Forum Jump:


Users browsing this thread: 1 Guest(s)