OnPlayerEnterCheckpoint... Just takes as 1 checkpoint
#8

use a variable for checkpoints (lets call it gPlayerCheckpointStatus - this name is often used in standart modes)
pawn Код:
new gPlayerCheckpointStatus[MAX_PLAYERS];
pawn Код:
enum
{
    CP_None,
    CP_Trash
}
pawn Код:
new Float:TrashCords[][4] =
{
    {242.6356,-89.5200,1.5781,3.0},
    {273.9276,-62.1197,1.5781,3.0},
    {290.1207,-61.3583,1.5830,3.0},
    {322.7198,-88.9753,1.5771,3.0},
    {322.5689,-124.2119,1.6048,3.0},
    {754.1161,-540.2138,16.3459,3.0},
    {768.1290,-540.5839,16.3748,3.0},
    {749.3525,-520.6990,16.3359,3.0},
    {766.8730,-520.2621,16.3359,3.0},
    {789.7007,-519.8392,16.3620,3.0},
    {822.1182,-520.1325,16.3359,3.0},
    {731.9541,-585.7091,16.3578,3.0},
    {665.1755,-622.8512,16.3359,3.0},
    {668.1423,-623.2781,16.3359,3.0},
    {657.8483,-648.5065,16.3359,3.0},
    {35.1380,-284.3482,2.1188,7.0}
}, PlayerTrashCounter[MAX_PLAYERS];
pawn Код:
#define SetPlayerCheckpointEx(%0,%1,%2) gPlayerCheckpointStatus[%1] = %0, SetPlayerCheckpoint(%1, %2)
//just to make it easier to use
pawn Код:
//Where you set the first checkpoint - command - spawn - or so
SetPlayerCheckpointEx(CP_Trash, playerid, TrashCords[0][0], TrashCords[0][1], TrashCords[0][2], TrashCords[0][3]);
//sets a checkpoint with the first cordinates - 242.6356,-89.5200,1.5781,3.0
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    switch(gPlayerCheckpointStatus[playerid])
    {
        case CP_Trash:
        {
            DisablePlayerCheckpoint(playerid);
            if(++PlayerTrashCounter[playerid] == sizeof TrashCords)
            {
                SendClientMessage(playerid,COLOR_YELLOW,"Nice, you got them all. You got $7000 for doing it.");
                GivePlayerMoney(playerid, 7000);
                PlayerTrashCounter[playerid] = 0;
                return true;   
            }
            else if(PlayerTrashCounter[playerid] == sizeof TrashCords - 1)
                SendClientMessage(playerid,COLOR_YELLOW,"Good, you got all. Now go back to the industries and drop it off");
            else    SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
            SetPlayerCheckpoint(playerid,
                            TrashCords[PlayerTrashCounter[playerid]][0],
                            TrashCords[PlayerTrashCounter[playerid]][1],
                            TrashCords[PlayerTrashCounter[playerid]][2],
                            TrashCords[PlayerTrashCounter[playerid]][3]);
        }
        default: DisablePlayerCheckpoint(playerid);
    }
    return 1;
}
Not tested - not use this with a streamer - that wont work

Quote:
Originally Posted by CrαcK
SetPlayerCheckpoint does not return an ID.
Workaround - using a streamer.
right SetPlayerCheckpoint only returns if the player is connected or not
But he dont need a streamer for that
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)