Bus System Malfunctioning
#1

I'm making a bus system, but for some reason the routes (check points that show you which way to go) are working, but the stops are not.

I will post all code related to my bus system:

pawn Код:
enum BusDetails {
    Float: CheckX,
    Float: CheckY,
    Float: CheckZ,
    Type //1 = stop, 0 = route
}
new busDetails[51][BusDetails];
new busStep[MAX_PLAYERS];
pawn Код:
public OnGameModeInit()
{
    busDetails[1][CheckX] = -2296.3999;
    busDetails[1][CheckY] = 2371.6006;
    busDetails[1][CheckZ] = 5.5731;
    busDetails[1][Type] = 0;

    busDetails[2][CheckX] = -2372.3784;
    busDetails[2][CheckY] = 2422.6028;
    busDetails[2][CheckZ] = 8.3968;
    busDetails[2][Type] = 0;

    busDetails[3][CheckX] = -2488.5;
    busDetails[3][CheckY] = 2432.1;
    busDetails[3][CheckZ] = 25.4;
    busDetails[3][Type] = 1;
pawn Код:
command(busroute, playerid, params[])
{
    #pragma unused params
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 437) // 437 is the coach model
    {
        if(Jobs[Player[playerid][Job]][JobType] == 8) {
            SendClientMessage(playerid, WHITE, "You have started the bus route.");
            SendClientMessage(playerid, WHITE, "The small checkpoints are the route, the large checkpoints are stops.");
            SetPlayerCheckpoint(playerid, busDetails[1][CheckX],busDetails[1][CheckY],busDetails[1][CheckZ], 2);
            SetPVarInt(playerid, "BusRoute", 1);
            busStep[playerid] = 1;
        }
    }
}
pawn Код:
public UnfreezePlayer(playerid)
{
    TogglePlayerControllable(playerid, 1);
}

public OnPlayerEnterCheckpoint(playerid)
{
    if(GetPVarInt(playerid, "BusRoute") == 1) {
        if(IsPlayerInRangeOfPoint(playerid, 5.0, busDetails[busStep[playerid]][CheckX], busDetails[busStep[playerid]][CheckY], busDetails[busStep[playerid]][CheckZ])) {
            if(busDetails[busStep[playerid]][Type] == 1) {
                SetVehicleVelocity(GetPlayerVehicleID(playerid), 0.0, 0.0, 0.0);
                TogglePlayerControllable(playerid, 0);
                SetTimerEx("UnfreezePlayer", 5000, false, "i", playerid);
                SendClientMessage(playerid, WHITE, "Wait for the customers to get on...");
            }
            if(busDetails[busStep[playerid] + 1][Type] == 0) {
                SetPlayerCheckpoint(playerid, busDetails[busStep[playerid] + 1][CheckX], busDetails[busStep[playerid] + 1][CheckY], busDetails[busStep[playerid] + 1][CheckZ], 2.0);
            } else {
                SetPlayerCheckpoint(playerid, busDetails[busStep[playerid] + 1][CheckX], busDetails[busStep[playerid] + 1][CheckY], busDetails[busStep[playerid] + 1][CheckZ], 10.0);
                SendClientMessage(playerid, WHITE, "The next checkpoint is a stop, make sure you let the customers on!");
            }
            busStep[playerid]++;
        }
    }

Now, I enter a route checkpoint and the next one is created, but I enter a stop checkpoint and NOTHING happens.
Reply
#2

You need to use a checkpoint streamer I guess
Reply
#3

Why do I need to use a checkpoint streamer? I don't want to set the checkpoint if they're close or anything, I just want it to set the checkpoint when they enter another one.
Reply
#4

I added these in OnGameModeInit, and it still doesn't work:
pawn Код:
busDetails[4][CheckX] = -2554.2192;
    busDetails[4][CheckY] = 2386.4;
    busDetails[4][CheckZ] = 13.9;
    busDetails[4][Type] = 0;
   
    busDetails[5][CheckX] = -2564.5386;
    busDetails[5][CheckY] = 2308.2456;
    busDetails[5][CheckZ] = 4.9710;
    busDetails[5][Type] = 0;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)