Example #1
0
    void DriveThisPedToTheMeetingArea(Ped ped)
    {
        if (CanWeUse(ped) && CanWeUse(GetLastVehicle(ped)))
        {
            AddToWaitingList(ped);
            Vector3 random = GetWaitingZone().Around(GetWaitingZoneRadius() * (RandomInt(3, 8) / 10.0f));

            Vector3 waitingzone = GetWaitingZone().Around(GetWaitingZoneRadius() * (RandomInt(4,10) / 10.0f));
            int how= 262199;
            if (ped.IsInRangeOf(GetWaitingZone(), 40f))
            {
                how = 4194365;
            }

            TaskSequence RaceSequence = new TaskSequence();
             Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD, 0, GetLastVehicle(ped), waitingzone.X, waitingzone.Y, waitingzone.Z, 10f, true, GetLastVehicle(ped).GetHashCode(), how, 5f, 0f);
            Function.Call(Hash.TASK_LEAVE_VEHICLE, 0, GetLastVehicle(ped), 0);
            Function.Call(Hash.TASK_FOLLOW_NAV_MESH_TO_COORD, 0, random.X, random.Y, random.Z, 1.0f, -1, 0.0f, 0, 0.0f);

            RaceSequence.Close();
            ped.Task.PerformSequence(RaceSequence);
            RaceSequence.Dispose();
        }
    }