checkpoint discussion
#1

so let me get this straight xD
if i make in ex onplayerspawn
SetPlayerCheckpoint its sets it right?
then i put onplayerentercheckpoint stuff
then if i add another checkpoint i make more code
so that means i have 2 checkpoints with 2 bits of codes
but now if a player enters the second checkpoint it will read the first checkpoint code
because checkpoints and defined like dialogs
so what can i do?
Reply
#2

You have to use arrays.

At top:
pawn Код:
new Checkpoint[MAX_PLAYERS];
pawn Код:
SetPlayerCheckPoint(stuff);
Checkpoint[playerid] = 1;
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(Checkpoint[playerid] == 1)
    {
        // stuff
        PlayerInfo[playerid][Checkpoint] = 0;
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
You have to use arrays.

At top:
pawn Код:
new Checkpoint[MAX_PLAYERS];
pawn Код:
SetPlayerCheckPoint(stuff);
Checkpoint[playerid] = 1;
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(Checkpoint[playerid] == 1)
    {
        // stuff
        PlayerInfo[playerid][Checkpoint] = 0;
    }
    return 1;
}
well isnt there another way without arrays or vars or enums?
Reply
#4

Yes, IsPlayerInRangeOfPoint(playerid,5,CPX,CPY,CPZ))

But array is simpler.
Reply
#5

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
Yes, IsPlayerInRangeOfPoint(playerid,5,CPX,CPY,CPZ))

But array is simpler.
yes thats the prob israngeofpoint but then it will read of the first bit of code of the first cp
Reply
#6

I do not understand you now. :P
Reply
#7

2d arrays.
pawn Код:
new Float:BurnFarmCpsA[5][3] =
{
    {-100.4371,-1018.9482,23.9117},//this is the one in SetPlayerRaceCheckpoint below
    {-451.9825,-841.6877,49.6414},
    {-889.0490,-1180.7946,105.1821},
    {-1049.2183,-1352.2665,129.8977},
    {-1102.5682,-995.7136,129.0935}
};
pawn Код:
SetPlayerRaceCheckpoint(playerid, 0, BurnFarmCpsA[0][0],BurnFarmCpsA[0][1],BurnFarmCpsA[0][2], BurnFarmCpsA[1][0], BurnFarmCpsA[1][1],BurnFarmCpsA[1][2], 10.0);//checkpoint inside the farm
You can also use it for IsPlayerInRangeOfPoint obviously.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)