[HELP] SetPlayerCheckpoint
#1

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;
}
Reply
#2

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)
Reply
#3

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...)
Reply
#4

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...
Reply
#5

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.
Reply
#6

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
}
Reply
#7

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;
}
Reply
#8

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

Thx
.
.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)