SA-MP Forums Archive
Checkpoint Spawning in other position. - 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)
+--- Thread: Checkpoint Spawning in other position. (/showthread.php?tid=345916)



Checkpoint Spawning in other position. - ricardo178 - 26.05.2012

Hey guys. Yesterday i had some help, and finaly fixed my checkpoint jobs, but now, the third one, after the first checkpoint, it sends me to other position, that have NOTHING to do with the checkpoint i setted, and isn't eigher any checkpoint from other job. It just spawns it far, near sea...

The code, and the job i am talking about is /startctruck.

There is /startsweep, /starttruck and /startctruck, this third one is the one with problem.

pawn Код:
new Float:BCP[][3] =
{
    {-2231.5911,-2456.8728,30.4688},
    {-2130.9924,-2532.9590,30.4688},
    {-1982.1638,-2538.2822,36.8082},
    {-2259.3906,-2561.3916,31.9347}
};

new Float:TCP[][3] =
{
    {-1565.1646,-2811.4785,46.6490},
    {-199.8498,-2335.5718,28.4854},
    {3.1706,-1467.3422,4.2829},
    {-56.6326,-1136.9395,1.0781}
};
new Float:CCP[][3] =
{
    {-2293.2480,-2159.6741,46.3356},
    {-2138.2842,-1929.1429,116.6622},
    {-2524.4478,-2073.0955,126.5760},
    {-2682.5190,-1232.4309,159.7265},
    {-2613.8018,-1209.8469,203.6694},
    {-2531.4373,-1299.4293,270.1808},
    {-2530.6130,-1477.1121,360.3184},
    {-2238.9761,-1527.4822,378.8865},
    {-2466.1038,-1804.1146,406.6344},
    {-2333.5103,-1816.7679,434.7335},
    {-2314.9614,-1646.3668,483.4079}
};

new sCP[MAX_PLAYERS];
new tCP[MAX_PLAYERS];
new cCP[MAX_PLAYERS];

CMD:startsweep(playerid, params[])
{
    if(PlayerInfo[playerid][Job] == 1)
    {
        new vehicleid;
        vehicleid = GetPlayerVehicleID(playerid);
        if(GetVehicleModel(vehicleid) == 574)
        {
            SetPlayerCheckpoint(playerid, -2051.4927,-2488.2144,30.1957, 5.0);
            sCP[playerid] = 0;
            tCP[playerid] = -1;
            cCP[playerid] = -1;
            SendClientMessage(playerid, COLOR_LIGHTRED, "You started your job. Follow the checkpoints.");
            return 1;
        }
        else return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not inside any sweeping vehicle.");
    }
    else return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not a sweeper.");
}
CMD:starttruck(playerid, params[])
{
    if(PlayerInfo[playerid][Job] == 2)
    {
        new vehicleid;
        vehicleid = GetPlayerVehicleID(playerid);
        if(GetVehicleModel(vehicleid) == 514)
        {
            if(IsTrailerAttachedToVehicle(vehicleid))
            {
                SetPlayerCheckpoint(playerid, -2051.4927,-2488.2144,30.1957, 5.0);
                tCP[playerid] = 0;
                sCP[playerid] = -1;
                cCP[playerid] = -1;
                SendClientMessage(playerid, COLOR_LIGHTRED, "You started your job. Follow the checkpoint.");
                return 1;
            }
            else return SendClientMessage(playerid, COLOR_LIGHTRED, "No trailler is attached.");
        }
        else return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not inside any Trucking vehicle.");
    }
    else return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not a trucker.");
}
CMD:startctruck(playerid, params[])
{
    if(PlayerInfo[playerid][Job] == 3)
    {
        new vehicleid;
        vehicleid = GetPlayerVehicleID(playerid);
        if(GetVehicleModel(vehicleid) == 413)
        {
            SetPlayerCheckpoint(playerid, -2330.7002,-2241.2073,19.4856, 5.0);
            cCP[playerid] = 0;
            tCP[playerid] = -1;
            sCP[playerid] = -1;
            SendClientMessage(playerid, COLOR_LIGHTRED, "You started your job. Follow the checkpoint.");
            return 1;
        }
        else return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not inside any Chiliad Trucking vehicle.");
    }
    else return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not a Chiliad trucker.");
}

public OnPlayerEnterCheckpoint(playerid)
{
    if(sCP[playerid] != -1)
    {
        GivePlayerMoney(playerid, 40);
        if(sCP[playerid] < (sizeof(BCP) - 1))
        {
            sCP[playerid]++;
            SetPlayerCheckpoint(playerid, BCP[sCP[playerid]][0], BCP[sCP[playerid]][1], BCP[sCP[playerid]][2], 5.0);
        }
        else
        {
            SendClientMessage(playerid, 0x999999AA, "Route finished");
            DisablePlayerCheckpoint(playerid);
            sCP[playerid] = -1;
        }
    }
    if(tCP[playerid] != -1)
    {
        GivePlayerMoney(playerid, 250);
        if(tCP[playerid] < (sizeof(TCP) - 1))
        {
            tCP[playerid]++;
            SetPlayerCheckpoint(playerid, TCP[tCP[playerid]][0], TCP[tCP[playerid]][1], TCP[tCP[playerid]][2], 5.0);
        }
        else
        {
            SendClientMessage(playerid, 0x999999AA, "Route finished");
            DisablePlayerCheckpoint(playerid);
            tCP[playerid] = -1;
        }
    }
    if(cCP[playerid] != -1)
    {
        GivePlayerMoney(playerid, 200);
        if(cCP[playerid] < (sizeof(CCP) - 1))
        {
            cCP[playerid]++;
            SetPlayerCheckpoint(playerid, TCP[cCP[playerid]][0], CCP[cCP[playerid]][1], CCP[cCP[playerid]][2], 5.0);
        }
        else
        {
            SendClientMessage(playerid, 0x999999AA, "Route finished");
            DisablePlayerCheckpoint(playerid);
            cCP[playerid] = -1;
        }
    }
}
Thanks.


Re: Checkpoint Spawning in other position. - Shubham - 26.05.2012

Change..
SetPlayerCheckpoint(playerid, TCP[cCP[playerid]][0], CCP[cCP[playerid]][1], CCP[cCP[playerid]][2], 5.0);

To..
SetPlayerCheckpoint(playerid, CCP[cCP[playerid]][0], CCP[cCP[playerid]][1], CCP[cCP[playerid]][2], 5.0);

Also.. new Float:CCP[][3]
To.. new Float:CCP[][11]


Re: Checkpoint Spawning in other position. - ricardo178 - 26.05.2012

Thank you.


Re: Checkpoint Spawning in other position. - Shubham - 26.05.2012

Did it work?


Re: Checkpoint Spawning in other position. - ricardo178 - 26.05.2012

Yeah.