I Need Help With Job
#1

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?
Reply
#2

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)