OnPlayerEnterCheckpoint... Just takes as 1 checkpoint
#1

Hey, I got this:

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(Trash1)
    {
      Trash2 = SetPlayerCheckpoint(playerid,242.6356,-89.5200,1.5781,3);
      SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
    }
    if(Trash2)
    {
      Trash3 = SetPlayerCheckpoint(playerid,273.9276,-62.1197,1.5781,3);
      SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
    }
    if(Trash3)
    {
      Trash4 = SetPlayerCheckpoint(playerid,290.1207,-61.3583,1.5830,3);
      SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
    }
    if(Trash4)
    {
      Trash5 = SetPlayerCheckpoint(playerid,322.7198,-88.9753,1.5771,3);
      SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
    }
  if(Trash5)
    {
      Trash6 = SetPlayerCheckpoint(playerid,322.5689,-124.2119,1.6048,3);
      SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
    }
    if(Trash6)
    {
      Trash7 = SetPlayerCheckpoint(playerid,754.1161,-540.2138,16.3459,3);
      SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
    }
    if(Trash7)
    {
      Trash8 = SetPlayerCheckpoint(playerid,768.1290,-540.5839,16.3748,3);
      SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
    }
  if(Trash8)
    {
      Trash9 = SetPlayerCheckpoint(playerid,749.3525,-520.6990,16.3359,3);
      SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
    }
  if(Trash9)
    {
      Trash10 = SetPlayerCheckpoint(playerid,766.8730,-520.2621,16.3359,3);
      SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
    }
    if(Trash10)
    {
      Trash11 = SetPlayerCheckpoint(playerid,789.7007,-519.8392,16.3620,3);
      SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
    }
  if(Trash11)
    {
      Trash12 = SetPlayerCheckpoint(playerid,822.1182,-520.1325,16.3359,3);
      SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
    }
    if(Trash12)
    {
      Trash13 = SetPlayerCheckpoint(playerid,731.9541,-585.7091,16.3578,3);
      SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
    }
  if(Trash13)
    {
      Trash14 = SetPlayerCheckpoint(playerid,665.1755,-622.8512,16.3359,3);
      SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
    }
    if(Trash14)
    {
      Trash15 = SetPlayerCheckpoint(playerid,668.1423,-623.2781,16.3359,3);
      SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
    }
  if(Trash15)
    {
      Trash16 = SetPlayerCheckpoint(playerid,657.8483,-648.5065,16.3359,3);
      SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
    }
    if(Trash16)
    {
      Trash17 = SetPlayerCheckpoint(playerid,35.1380,-284.3482,2.1188,7);
        GotAll[playerid] = 1;
      SendClientMessage(playerid,COLOR_YELLOW,"Good, you got all. Now go back to the industries and drop it off");
    }
    if(Trash17)
    {
        GotAll[playerid] = 0;
      SendClientMessage(playerid,COLOR_YELLOW,"Nice, you got them all. You got $7000 for doing it.");
      GivePlayerMoney(playerid,7000);
      DisablePlayerCheckpoint(playerid);
    }
    return 1;
}

When i enter the first checkpoint... It sends 16
Код:
SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
And then the last one... How to put like a ID on the checkpoint?
Reply
#2

I think its
pawn Код:
new Trash1 = SetPlayerCheckpoint(...,...,...,...);
Reply
#3

What different would that be to:

pawn Код:
new Trash1;

Trash1 = SetPlayerCheckpoint(playerid,X,Y,Z,Float:size);
Reply
#4

Quote:
Originally Posted by IntrozeN
What different would that be to:

pawn Код:
new Trash1;

Trash1 = SetPlayerCheckpoint(playerid,X,Y,Z,Float:size);
No difference, Just that yours takes up more lines lol
Reply
#5

zomg... That wont solve the problem...
Reply
#6

pawn Код:
//Top of script.
new InMission[MAX_PLAYERS];

//OnPlayerConnect
InMission[playerid] = 0;

//In the mission start command
InMission[playerid] = 1;

//OnPlayerEnterCheckpoint
public OnPlayerEnterCheckpoint(playerid)
{
    if(InMission[playerid] == 1)
    {
      SetPlayerCheckpoint(playerid,242.6356,-89.5200,1.5781,3);
      SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
      InMission[playerid]++;
    }
    if(InMission[playerid] == 2)
    {
      SetPlayerCheckpoint(playerid,273.9276,-62.1197,1.5781,3);
      SendClientMessage(playerid,COLOR_YELLOW,"Good, now pickup next");
      InMission[playerid]++;
    }
    //and so on.....
  return 1;
}

//When they finish
InMission[playerid]=0;
Just an example but im sure you get what i mean.

Reply
#7

SetPlayerCheckpoint does not return an ID.
Workaround - using a streamer.
Reply
#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
#9

Quote:
Originally Posted by CrαcK
SetPlayerCheckpoint does not return an ID.
Workaround - using a streamer.
Then you can be surprised
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)