Help with bus job
#9

Something like this would do the trick.
It should start at the first index of the array and work it's way up until the end of the array, then start over from the first set of coordinates, so it keeps going.

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 431)
    {
        switch (BusDriver[playerid])
        {
            case 1:
            {
                SCM(playerid, -1, "Go to the next bus stop!");
            }
            case 2:
            {
                pInfo[playerid][Credits] ++;
                GivePlayerMoney(playerid, 500);
            }
            case 3, 4, 6, 7, 8, 9, 10, 11:
            {
                GivePlayerMoney(playerid, 500);
            }
            case 5:
            {
                pInfo[playerid][Credits] ++;
            }
        }

        // Increase the value of BusDriver every time you enter a checkpoint
        BusDriver[playerid] = BusDriver[playerid] + 1;
        // If the end of the array has been reached, set it back to 1 so you start over your bus-route
        if (BusDriver[playerid] == sizeof(BusCP))
            BusDriver[playerid] = 1;

        // Set the checkpoint based on which step in the route you are driving
        // Use "-1" because arrays don't start at 1, they start at 0, we need to substract 1 from the BusDriver variable
        SetPlayerCheckpoint(playerid, BusCP[BusDriver[playerid] - 1][0], BusCP[BusDriver[playerid] - 1][1], BusCP[BusDriver[playerid] - 1][2], 5);//busstop2
Reply


Messages In This Thread
Help with bus job - by LeXuZ - 27.11.2014, 18:12
Re: Help with bus job - by PowerPC603 - 27.11.2014, 19:20
Re: Help with bus job - by LeXuZ - 27.11.2014, 19:23
Re: Help with bus job - by PowerPC603 - 27.11.2014, 19:34
Re: Help with bus job - by LeXuZ - 27.11.2014, 19:35
Re: Help with bus job - by PowerPC603 - 27.11.2014, 19:38
Re: Help with bus job - by LeXuZ - 27.11.2014, 19:41
Re: Help with bus job - by LeXuZ - 27.11.2014, 19:45
Re: Help with bus job - by PowerPC603 - 27.11.2014, 20:27

Forum Jump:


Users browsing this thread: 2 Guest(s)