Checkpoint problem, need help.
#1

hi there the problem is when I take the work of the bus driver, choose the route and after a drive through all the checkpoints and at the last, nothing happens, he just burn and all.
Please help solve the problem, the code is posted below.
sorry if my english is bad, im russian...

pawn Код:
new Float:Route1[16][3] = {//Los Santos
{1140.4226,-1715.1140,13.8583},
{1545.5533,-1595.5841,13.5158},
{1816.3058,-1673.4960,13.5945},
{1816.4094,-1902.9757,13.6415},
{1956.9583,-2136.6414,13.5948},
{2244.6982,-2215.9529,13.4329},
{2429.8440,-1254.6299,23.9636},
{1673.4246,-1158.2622,23.7896},
{1666.9512,-1163.4913,23.8068},
{2399.8291,-1259.7415,23.9649},
{2236.7375,-2199.7715,13.4591},
{1965.6260,-2148.2788,13.5927},
{1823.9556,-1895.7554,13.4872},
{1822.3669,-1667.7328,13.5161},
{1526.7728,-1653.6466,13.5161},
{1235.4631,-1830.3445,13.5351}
};
//////////////////////////////// WHEN CHOISE ROUTE //////////////////////////////////////////
if(listitem == 0)
{
SetPVarInt(playerid, "bus_way1", 1);
SetPlayerCheckpoint(playerid, Route1[0][0], Route1[0][1], Route1[0][2], 3.0);
}
//////////////////////////////// WHEN CHOISE ROUTE //////////////////////////////////////////

public OnPlayerEnterCheckpoint(playerid)
{
    if(GetPVarInt(playerid, "bus_way1"))
    {
        if(!GetPVarInt(playerid, "bus_way1")) return;
        new check = GetPVarInt(playerid, "bus_way1");
        check++;
        if(check >= sizeof Route1)
        {
            if(!GetPVarInt(playerid, "bus_way1"))
            {
                DeletePVar(playerid, "bus_way1");
                SendClientMessage(playerid, 0x00FF00FF, "Job is done!");
                DisablePlayerCheckpoint(playerid);
            }
        }
        else
        {
            TogglePlayerControllable(playerid, 0);
            SetTimerEx("busroutestoptimer", 10000, false, "i", playerid);
            ProxDetector(50.0, playerid, "Bus will go in 10 seconds!",0x00FF00FF,0x00FF00FF,0x00FF00FF,0x00FF00FF,0x00FF00FF);
            GivePlayerMoney(playerid,25);
            SetPlayerCheckpoint(playerid, Route1[check][0], Route1[check][1], Route1[check][2], 3.0);
            SetPVarInt(playerid, "bus_way1", check);
        }
    }
}

forward busroutestoptimer(playerid);
public busroutestoptimer(playerid)
{
    TogglePlayerControllable(playerid, 1);
}
Reply
#2

What do you mean by "he just burn and all" ?
Reply
#3

You have add before
SetPlayerCheckpoint(playerid, Route1[check][0], Route1[check][1], Route1[check][2], 3.0);
line:
DisablePlayerCheckpoint(playerid);
that because other ways the checkpoint not change
I think that should help you.
Reply
#4

Quote:
Originally Posted by =WoR=G4M3Ov3r
Посмотреть сообщение
What do you mean by "he just burn and all" ?
when i enter on checkpoint it not disable and do nothing
Reply
#5

Volune have you try my code?
Reply
#6

Quote:
Originally Posted by whitedragon
Посмотреть сообщение
Volune have you try my code?
yes, but not helped
Reply
#7

anyone ?
Reply
#8

bump
Reply
#9

Bump.
Reply
#10

Your code contains a lot of unnecesarry checks, but my guess is that if you change this:
pawn Код:
if(check >= sizeof Route1)
to
pawn Код:
if(check >= sizeof(Route1)-1)
then it might work.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)