[HELP]Making checkpoint
#8

More easly way
pawn Код:
new BusCP[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    BusCP[playerid] = 9999;
}

new Float:BusStops[10][3] = {
{x,y,z),
{x,y,z),
{x,y,z),
{x,y,z),
{x,y,z),
{x,y,z),
{x,y,z),
{x,y,z),
{x,y,z),
{x,y,z)
};


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/startroute", cmdtext, true, 10) == 0)
    {
        if(BusCP[playerid] == 9999)
        {
            SetPlayerRaceCheckpoint(playerid,0,BusStop[0][0],BusStop[0][1],BusStop[0][2],BusStop[1][0],BusStop[1][1],BusStop[1][2],5.00);
            BusCP[playerid] = 0;
            return 1;
        }
        else
        {
            SendClientMessage(playerid,COLOR,"You are already on route!");
        }
    }
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    if(BusCP[playerid] < 9999)
    {
        BusCP[playerid]++;
        new b = BusCP[playerid];
        if(b == 9)
        {
            SendClientMessage(playerid,COLOR,"You end the route.");
        }
        else if(b <= 7)
        {
            SetPlayerRaceCheckpoint(playerid,0,BusStop[b][0],BusStop[b][1],BusStop[b][2],BusStop[b+1][0],BusStop[b+1][1],BusStop[b+1][2],5);
        }
        else
        {
            SetPlayerRaceCheckpoint(playerid,1,BusStop[b][0],BusStop[b][1],BusStop[b][2],BusStop[b+1][0],BusStop[b+1][1],BusStop[b+1][2],5);
        }
    }
    return 1;
}
with this you dont need on checkpoints else if else if, because Bus routes usual is about 10+ stops, so for each bus stop else if, is abit masive
Reply


Messages In This Thread
[HELP]Making checkpoint - by Thebest96 - 17.08.2010, 15:28
Re: [HELP]Making checkpoint - by Sascha - 17.08.2010, 16:37
Re: [HELP]Making checkpoint - by Thebest96 - 17.08.2010, 19:07
Re: [HELP]Making checkpoint - by Thebest96 - 17.08.2010, 21:01
Re: [HELP]Making checkpoint - by Steven82 - 17.08.2010, 22:33
Re: [HELP]Making checkpoint - by PotH3Ad - 18.08.2010, 01:09
Re: [HELP]Making checkpoint - by Thebest96 - 18.08.2010, 05:56
Re: [HELP]Making checkpoint - by ikey07 - 18.08.2010, 06:28
Re: [HELP]Making checkpoint - by Thebest96 - 18.08.2010, 08:14
Re: [HELP]Making checkpoint - by Thebest96 - 18.08.2010, 11:20

Forum Jump:


Users browsing this thread: 4 Guest(s)