SA-MP Forums Archive
I Need Help With Job - 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: I Need Help With Job (/showthread.php?tid=185434)



I Need Help With Job - Alex_Valde - 24.10.2010

Hi, I need help with this
pawn Код:
new newcar = GetPlayerVehicleID(playerid);
    if(Player[playerid][CollectingTrash] == 1)
    {
        if(IsPlayerInRangeOfPoint(playerid,7.0,2293.4841,-2112.2075,14.1040))
        {
            if(TrashMasterCar(newcar))
            {
                PlayerPlaySound(playerid,1139,0.0,0.0,0.0);
                SetPlayerCheckpoint(playerid, 2749.0476,-2435.7915,14.1904, 7.0);
                SendClientMessage(playerid, COLOR_GREY, " Collecting garbage.......");
                TogglePlayerControllable(playerid, 0);
                SetTimer("CollectingTimer",4000,false);
            }
        }
        else if(IsPlayerInRangeOfPoint(playerid,7.0,2749.0476,-2435.7915,14.1904))
        {
            if(TrashMasterCar(newcar))
            {
            PlayerPlaySound(playerid,1139,0.0,0.0,0.0);
            SetPlayerCheckpoint(playerid, 2362.9976,-2014.1448,14.1022, 7.0);
            SendClientMessage(playerid, COLOR_GREY, " Collecting garbage.......");
           .......................
This is TrashMasterCar
pawn Код:
public TrashMasterCar(vehicleid)
{
    if(vehicleid == 408)
    {
        return 1;
    }
    return 1;
}
And my problem is when I come to checkpoint I need to exit vehicle and then I need to come to CP...

I want to make that I can enter CP with car...
Any help?


Re: I Need Help With Job - Miguel - 24.10.2010

First off, this code is wrong:
pawn Код:
public TrashMasterCar(vehicleid)
{
    if(vehicleid == 408)
    {
        return 1;
    }
    return 1; // it will always return 1
}
It's meant to be:
pawn Код:
public TrashMasterCar(vehicleid)
{
    if(vehicleid == 408) return 1; // if vehicleid is 408 return 1 and exit the function
    return 0; // if not return 0 and exit the function
}
Second of all, use SetPlayerRaceCheckpoint and use the callback OnPlayerEnterRaceCheckpoint.