Checkpoints messing up, displaying to wrong people, randomly.
#1

This issue has been killing me for ages.

I can't understand why. I'm killing the checkpoints at all the correct times.

pawn Код:
for(new c = 0; c < 7; c++)
    {
        DestroyDynamicCP(DrivingCheck[playerid][c]);
        DrivingCheck[playerid][c] = -1;
    }
    for(new x = 0; x < 8; x++)
    {
        DestroyDynamicRaceCP(SweepCheck[playerid][x]);
        SweepCheck[playerid][x] = -1;
    }
    for(new y = 0; y < 3; y++)
    {
        DestroyDynamicCP(TruckCheck[playerid][y]);
        TruckCheck[playerid][y] = -1;
    }
    for(new z = 0; z < 3; z++)
    {
        DestroyDynamicCP(TrashCheck[playerid][z]);
        TrashCheck[playerid][z] = -1;
    }
    for(new a = 0; a < 2; a++)
    {
        DestroyDynamicCP(PizzaCheck[playerid][a]);
        PizzaCheck[playerid][a] = -1;
    }
When the player disconnects ^

pawn Код:
else if(checkpointid == PizzaCheck[playerid][1])
    {
        format(string, sizeof(string), "Pizza Delivery Job: "COL_WHITE"Well done! You have earned a total of "COL_GREEN"$%s on this job.", AddCommas(PizzaTips[playerid]));
        SendClientMessage(playerid, COLOUR_REALRED, string);
        DestroyDynamicCP(PizzaCheck[playerid][1]);
        RemovePlayerMapIcon(playerid, 0);
        PlayerMoney[playerid] += PizzaTips[playerid];
        GivePlayerMoney(playerid, PizzaTips[playerid]);
        SetVehicleToRespawn(PizzaBikeID[playerid]);
        PizzaCooldown[playerid] = 5;
        PizzaJob[playerid] = 0;
        PizzaBikeID[playerid] = -1;
        PizzaAmount[playerid] = 0;
        PizzaTips[playerid] = 0;
        RemovePlayerFromVehicle(playerid);
        new skin = GetPlayerSkinEx(playerid);
        SetPlayerSkin(playerid, skin);
        MySQL_SetInteger(PlayerSQLID[playerid], "PizzaCooldown" , 5, "accounts");
        for(new x = 0; x < 2; x++)
        {
            DestroyDynamicCP(PizzaCheck[playerid][x]);
            PizzaCheck[playerid][x] = -1;
        }
    }
    else if(checkpointid == PizzaCheck[playerid][0])
    {
        new tip, maxhouse;
        if(PizzaJob[playerid] == 1)
        {
            if(!IsPlayerAttachedObjectSlotUsed(playerid, 0))return SendClientMessage(playerid, COLOUR_GREY, "Use /getpizza at your delivery bike before entering the checkpoint.");
            RemovePlayerAttachedObject(playerid, 0);
            SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
            if(PizzaAmount[playerid] < 4)
            {
                PizzaAmount[playerid] ++;
            }
            new chance = RandomEx(1, 10000);
            if(chance < 10000)
            {
                tip = RandomEx(1, 45);
                format(string, sizeof(string), "PIZZA DELIVERED: "COL_WHITE"You received a tip of "COL_GREEN"$%d "COL_WHITE"for delivering this pizza.", tip);
                SendClientMessage(playerid, COLOUR_REALRED, string);
            }
            if(chance == 10000)
            {
                format(string, sizeof(string), "PIZZA DELIVERED: "COL_WHITE"You received an "COL_ORANGE"INCREDIBLE "COL_WHITE"tip of "COL_GREEN"$10,000.");
                tip = 10000;
                SendClientMessage(playerid, COLOUR_REALRED, string);
            }
            PizzaTips[playerid] += tip;
            ServerStartMoney += tip;
            if(PizzaAmount[playerid] == 4)
            {
                RemovePlayerMapIcon(playerid, 0);
                format(string, sizeof(string), "Pizza Delivery Job: "COL_WHITE"Please return the bike to the Pizza Stack to collect your payment.");
                SendClientMessage(playerid, COLOUR_REALRED, string);
                PizzaCheck[playerid][1] = CreateDynamicCP(VehSpawnX[PizzaBikeID[playerid]], VehSpawnY[PizzaBikeID[playerid]], VehSpawnZ[PizzaBikeID[playerid]], 2, 0, 0, playerid, 100.0);
                DestroyDynamicCP(PizzaCheck[playerid][0]);
                SetPlayerMapIcon(playerid, 0, VehSpawnX[PizzaBikeID[playerid]], VehSpawnY[PizzaBikeID[playerid]], VehSpawnZ[PizzaBikeID[playerid]], 0, COLOUR_RED, MAPICON_LOCAL);
            }
            else
            {
                for(new x = 1; x < MAX_HOUSES; x++)
                {
                    if(HouseEntX[x] != 0)
                    {
                        maxhouse++;
                    }
                }
                new house = RandomEx(1, maxhouse);
                RemovePlayerMapIcon(playerid, 0);
                if(HouseEntVW[house] > 0)
                {
                    for(new a = 1; a < MAX_APARTS; a++)
                    {
                        if(HouseVW[house] == ApartVW[a])
                        {
                            format(string, sizeof(string), "Pizza Order Address: "COL_ORANGE"%s, "COL_WHITE"please proceed to the checkpoint on your map to deliver the pizza.", ApartName[a]);
                            SendClientMessage(playerid, COLOUR_WHITE, string);
                            PizzaCheck[playerid][0] = CreateDynamicCP(ApartEntX[a], ApartEntY[a], ApartEntZ[a], 2, 0, 0, playerid, 100.0);
                            SetPlayerMapIcon(playerid, 0, ApartEntX[a], ApartEntY[a], ApartEntZ[a], 0, COLOUR_RED, MAPICON_LOCAL);
                        }
                    }
                }
                else
                {
                    format(string, sizeof(string), "Pizza Order Address: "COL_ORANGE"%s, "COL_WHITE"please proceed to the checkpoint on your map to deliver the pizza.", HouseName[house]);
                    SendClientMessage(playerid, COLOUR_WHITE, string);
                    PizzaCheck[playerid][0] = CreateDynamicCP(HouseEntX[house], HouseEntY[house], HouseEntZ[house], 2, 0, 0, playerid, 100.0);
                    DestroyDynamicCP(PizzaCheck[playerid][0]);
                    SetPlayerMapIcon(playerid, 0, HouseEntX[house], HouseEntY[house], HouseEntZ[house], 0, COLOUR_RED, MAPICON_LOCAL);

                }
            }
        }
    }
Example job where I'm using the checkpoints.

These aren't the only ones that display randomly, all checkpoints seem to do it.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)