Second and third checkpoint isnt showing up!
#4

Wouldn't it be much simpler if you used a single variable? If you simply save the checkpoint count in Sweeping[playerid], you can still check if it's not zero. You should also always try to avoid double code. If you were to change the reward, for example, you would've to change the lines one by one which isn't very practical. I optimized your script:

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    new pveh = GetPlayerVehicleID(playerid);

    // --------------------------------------------------------------------
    if(Sweeping[playerid])
    {
        DisablePlayerCheckpoint(playerid);
       
        if(!IsASweepingCar(pveh))
        {
            SendClientMessage(playerid, COLOR_GREY, "You are not in a sweeper.");
            Sweeping[playerid] = 0; //end
            return 1;
        }

        switch(Sweeping[playerid])
        {
            case 1: SetPlayerCheckpoint(playerid, 1987.5314,-2108.5859,13.1661, 5);
            case 2: SetPlayerCheckpoint(playerid, 2045.5214,-1935.0801,13.1432, 5);
            case 3: SetPlayerCheckpoint(playerid, 2083.7595,-1831.7170,13.2008, 5);
            case 4: Sweeping[playerid] = -1; // this will reset back to 0 by the ++ statement that follows; -1 + 1 = 0
           
            default: SendClientMessage(playerid, COLOR_GREY, "Script Error: Unknown checkpoint.");
        }
       
        Sweeping[playerid]++;
        GameTextForPlayer(playerid, "~g~+$50", 2000, 3);
        GivePlayerMoney(playerid, 50);
    }
    // --------------------------------------------------------------------
    return 1;
}
Reply


Messages In This Thread
Second and third checkpoint isnt showing up! - by KosmasRego - 27.06.2012, 08:51
Re: Second and third checkpoint isnt showing up! - by [MM]RoXoR[FS] - 27.06.2012, 10:02
Re: Second and third checkpoint isnt showing up! - by KosmasRego - 27.06.2012, 10:06
Re: Second and third checkpoint isnt showing up! - by Vince - 27.06.2012, 10:35
Re: Second and third checkpoint isnt showing up! - by KosmasRego - 27.06.2012, 11:26

Forum Jump:


Users browsing this thread: 3 Guest(s)