Dynamic checkpoints
#1

pawn Код:
if(vmcheckpoints[playerid][0] == 1)
            {
                DestroyDynamicRaceCP(checkpointid);
                SetPlayerCheckpoint(playerid,-2019.8148,-145.6181,35.3203, 6);
                CreateDynamicRaceCP(0,-2019.8148,-145.6181,35.3203,-2021.3827,-137.9689,35.3015, 3, 0, 0, playerid, 200.0);//1
                vmcheckpoints[playerid][0] = 0;
                vmcheckpoints[playerid][1] = 1;
                GameTextForPlayer(playerid, "(1/31)", 3000, 3);
                return 1;

            }
            if(vmcheckpoints[playerid][1] == 1)
            {
                DestroyDynamicRaceCP(checkpointid);
                SetPlayerCheckpoint(playerid,-2021.3827,-137.9689,35.3015, 6);
                CreateDynamicRaceCP(0,-2021.3827,-137.9689,35.3015,-2022.2931,-172.4966,35.3203, 3, 0, 0, playerid, 200.0);//1
                vmcheckpoints[playerid][1] = 0;
                vmcheckpoints[playerid][2] = 1;
                GameTextForPlayer(playerid, "(2/31)", 3000, 3);
                return 1;

            }
            if(vmcheckpoints[playerid][2] == 1)
            {
                DestroyDynamicRaceCP(checkpointid);
                SetPlayerCheckpoint(playerid,-2022.2931,-172.4966,35.3203, 6);
                CreateDynamicRaceCP(0,-2022.2931,-172.4966,35.3203,-2015.1947,-166.8497,35.3203, 3, 0, 0, playerid, 200.0);//1
                vmcheckpoints[playerid][2] = 0;
                vmcheckpoints[playerid][3] = 1;
                GameTextForPlayer(playerid, "(3/31)", 3000, 3);
                return 1;

            }
I want to make so that if player enters one checkpoint he gets another in another place, but this code is not working, becouse when i enter first checkpoint it takes 4 or 3 checkpoints at the same, so when i take first checkpoint i get (1/30), (2/30),(3/30). Any suggestions?
Reply
#2

pawn Код:
if(vmcheckpoints[playerid] == 0)
{
    DestroyDynamicRaceCP(checkpointid);
    SetPlayerCheckpoint(playerid,-2019.8148,-145.6181,35.3203, 6);
    CreateDynamicRaceCP(0,-2019.8148,-145.6181,35.3203,-2021.3827,-137.9689,35.3015, 3, 0, 0, playerid, 200.0);//1
    vmcheckpoints[playerid]++;
    GameTextForPlayer(playerid, "(1/31)", 3000, 3);
    return 1;

}
if(vmcheckpoints[playerid] == 1)
{
    DestroyDynamicRaceCP(checkpointid);
    SetPlayerCheckpoint(playerid,-2021.3827,-137.9689,35.3015, 6);
    CreateDynamicRaceCP(0,-2021.3827,-137.9689,35.3015,-2022.2931,-172.4966,35.3203, 3, 0, 0, playerid, 200.0);//1
    vmcheckpoints[playerid]++;
    GameTextForPlayer(playerid, "(2/31)", 3000, 3);
    return 1;

}
if(vmcheckpoints[playerid] == 2)
{
    DestroyDynamicRaceCP(checkpointid);
    SetPlayerCheckpoint(playerid,-2022.2931,-172.4966,35.3203, 6);
    CreateDynamicRaceCP(0,-2022.2931,-172.4966,35.3203,-2015.1947,-166.8497,35.3203, 3, 0, 0, playerid, 200.0);//1
    vmcheckpoints[playerid]++;
    GameTextForPlayer(playerid, "(3/31)", 3000, 3);
    return 1;

}
and make vmcheckpoints 1D.

also,you can make it much "pro":
pawn Код:
new const Float:checkpoints[][]=
{
{-2019.8148,-145.6181,35.320},
{-2021.3827,-137.9689,35.3015},
{-2022.2931,-172.4966,35.3203}
}
if(vmcheckpoints[playerid] >= 0)
{
    DestroyDynamicRaceCP(checkpointid);
    if(vmcheckpoints[playerid]!=sizeof(checkpoints))
    {
        SetPlayerCheckpoint(playerid,checkpoints[ vmcheckpoints[playerid] ][0],checkpoints[ vmcheckpoints[playerid] ][1],checkpoints[ vmcheckpoints[playerid] ][2] , 6);
        CreateDynamicRaceCP(0,checkpoints[ vmcheckpoints[playerid] ][0],checkpoints[ vmcheckpoints[playerid] ][1],checkpoints[ vmcheckpoints[playerid] ][2]
        ,checkpoints[ vmcheckpoints[playerid]+1][0],checkpoints[ vmcheckpoints[playerid]+1][1],checkpoints[ vmcheckpoints[playerid]+1][2], 3, 0, 0, playerid, 200.0);//1
        vmcheckpoints[playerid]++;
        new string[30];format(string,30,"(%d/%d)",vmcheckpoints[playerid],sizeof(checkpoints));
        GameTextForPlayer(playerid, string, 3000, 3);
    }
    return 1;

}
Reply
#3

I used "Pro" script but it happens again and i also noticed that it happens only on first checkpoint.
Reply
#4

fixed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)