SA-MP Forums Archive
My bus system in progress is not working. - 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: My bus system in progress is not working. (/showthread.php?tid=206271)



My bus system in progress is not working. - jameskmonger - 03.01.2011

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.


Re: My bus system in progress is not working. - jameskmonger - 03.01.2011

Bump, I really need help on this.


Re: My bus system in progress is not working. - hanzen - 03.01.2011

Quote:
Originally Posted by jameskmonger
Посмотреть сообщение
Bump, I really need help on this.
Why do you use IsPlayerInRangeOfPoint() when using checkpoints?


Re: My bus system in progress is not working. - jameskmonger - 03.01.2011

To check if they are in the checkpoint I want them to be in, otherwise they could be in any checkpoint.


Re: My bus system in progress is not working. - jameskmonger - 04.01.2011

Bump, I really need help with this.


Re: My bus system in progress is not working. - jameskmonger - 04.01.2011

Please? Why does no one help on these forums? I put time and effort into helping other people, so why can't I have the same returned to me?


Re: My bus system in progress is not working. - armyoftwo - 04.01.2011

Have you tried debugging? You might find some problems


Re: My bus system in progress is not working. - jameskmonger - 04.01.2011

Yes, everything seems to work it just doesn't send me a message when I enter a stop (type 1)


Re: My bus system in progress is not working. - jameskmonger - 05.01.2011

Bump.