SA-MP Forums Archive
[HELP] SetPlayerCheckpoint - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] SetPlayerCheckpoint (/showthread.php?tid=212279)



[HELP] SetPlayerCheckpoint - Larsey123IsMe - 16.01.2011

The chackpoint 2 dont appear, only checkpoint 1 apperar

And how to remove the RED DOT on map? there the checkpoint is?


pawn Код:
#include <a_samp>

new TestCP1, TestCP2;

public OnPlayerSpawn(playerid)
{
    TestCP1 = SetPlayerCheckpoint(playerid, 2239.7747, 2430.8074, 3.2734, 3.0);
    TestCP2 = SetPlayerCheckpoint(playerid, 2243.4456, 2490.6458, 3.2734, 3.0);
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    if(TestCP1)
    {
        SendClientMessage(playerid, 0xFF0000FF, "You have entered CheckPoint 1");
        return 1;
    }
   
    if(TestCP2)
    {
        SendClientMessage(playerid, 0xFF0000FF, "You have entered CheckPoint 2");
        return 1;
    }
    return 1;
}



Respuesta: [HELP] SetPlayerCheckpoint - [M]xFire - 16.01.2011

You only can 1 race checkpoint per player(think) i don't know how to remove the red point in mini-map (sorry for my bad english)


Re: Respuesta: [HELP] SetPlayerCheckpoint - Larsey123IsMe - 16.01.2011

Quote:
Originally Posted by [M]xFire
Посмотреть сообщение
You only can 1 race checkpoint per player(think) i don't know how to remove the red point in mini-map (sorry for my bad english)
oh, thats dumb xD 1 checkpoint per player..

Isent it other functions for Checkpoints? like:

CreateObject(playerid, >THE RED CHECKPOINT<, x, y, z.. ect...)


Re: [HELP] SetPlayerCheckpoint - BlackWolf120 - 16.01.2011

hi,
try it with a case system (more efficient)

pawn Код:
//OnTopOfScript
new CheckPoint[MAX_PLAYERS];

enum //Just add checkpoints here
{
cp1,
cp2
}

public OnPlayerEnterCheckpoint(playerid)
{
switch(CheckPoint[playerid])
{

case cp1:
{
//stuff for cp1
}
case cp2:
{
//stuff for cp2 here
}

}
return 1;
}
regards...


Respuesta: [HELP] SetPlayerCheckpoint - [M]xFire - 16.01.2011

please read: https://sampwiki.blast.hk/wiki/Function:SetPlayerCheckpoint
Код:
Important Note: You can only show one checkpoint at a time. If you need more, create the checkpoints only when the player is near.



Re: [HELP] SetPlayerCheckpoint - Larsey123IsMe - 16.01.2011

Quote:
Originally Posted by BlackWolf120
Посмотреть сообщение
hi,
try it with a case system (more efficient)

pawn Код:
//OnTopOfScript
new CheckPoint[MAX_PLAYERS];

enum //Just add checkpoints here
{
cp1,
cp2
}

public OnPlayerEnterCheckpoint(playerid)
{
switch(CheckPoint[playerid])
{

case cp1:
{
//stuff for cp1
}
case cp2:
{
//stuff for cp2 here
}

}
return 1;
}
regards...
enum...
how it works? xD

Give me an example?
pawn Код:
enum //Just add checkpoints here
{
cp1,
cp2
}



Re: [HELP] SetPlayerCheckpoint - Joe Staff - 16.01.2011

Better to use #define for checkpoint IDs, unless you're working on a more dynamic system

pawn Код:
#define CP_NONE 0
#define CP_STORE 1
#define CP_AMMUNATION 2
new CheckPoint[MAX_PLAYERS];
forward UpdateCheckPoint();
public OnGameModeInit()
{
    SetTimer("UpdateCheckPoint",1000,1);
    return 1;
}
public UpdateCheckPoint()
{
    for(new playerid;playerid<MAX_PLAYERS;playerid++)
    {
        if(IsPlayerInRangeOfPoint(playerid,5.0,X,Y,Z))CheckPoint[playerid]=CP_STORE;
        else if(IsPlayerInRangeOfPoint(playerid,5.0,X,Y,Z))CheckPoint[playerid]=CP_AMMUNATION;
        else CheckPoint[playerid]=CP_NONE;
    }
}

public OnPlayerEnterCheckPoint(playerid)
{
    switch(CheckPoint[playerid])
    {
        case CP_NONE: return 1; //Do nothing
        case CP_STORE:
        {
            //Do stuff
        }
        case CP_AMMUNATION:
        {
            //Do stuff
        }
    }
    return 1;
}



Re: [HELP] SetPlayerCheckpoint - Marricio - 16.01.2011

https://sampforum.blast.hk/showthread.php?tid=118599


Re: [HELP] SetPlayerCheckpoint - Larsey123IsMe - 17.01.2011

Thx
.
.