Beispiel #1
0
        public async Task <Ped> CreatePedOnSeat(VehicleSeat seat, Model model, RelationshipGroup type)
        {
            if (seat <= VehicleSeat.None)
            {
                return(null);
            }

            if (!IsSeatFree(seat))
            {
                return(null);
            }

            await model.LoadToMemoryNow();

            Pointer pedPtr = typeof(int);

            if (seat == VehicleSeat.Driver)
            {
                Function.Call(Natives.CREATE_CHAR_INSIDE_CAR, m_handle, (int)type, model.Hash, pedPtr);
            }
            else
            {
                Function.Call(Natives.CREATE_CHAR_AS_PASSENGER, m_handle, (int)type, model.Hash, (int)seat, pedPtr);
            }

            model.AllowDisposeFromMemory();

            if ((int)pedPtr == 0)
            {
                return(null);
            }

            return(ObjectCache <Ped> .Get((int)pedPtr));
        }
Beispiel #2
0
        public static async Task <Ped> CreatePed(Model model, Vector3 position, RelationshipGroup type)
        {
            if (!model.IsPed)
            {
                return(null);
            }

            if (!await model.LoadToMemoryNow())
            {
                return(null);
            }

            Pointer pedPtr = typeof(int);

            Function.Call(Natives.CREATE_CHAR, (int)type, model.Hash, position.X, position.Y, position.Z, pedPtr, true);
            model.AllowDisposeFromMemory();

            if ((int)pedPtr == 0)
            {
                return(null);
            }

            return(ObjectCache <Ped> .Get((int)pedPtr));
        }
Beispiel #3
0
 public static void SetGroupRelationShip(RelationshipGroup group, Relationship level, RelationshipGroup targetGroup)
 {
     Function.Call(Natives.ALLOW_GANG_RELATIONSHIPS_TO_BE_CHANGED_BY_NEXT_COMMAND, true);
     Function.Call(Natives.SET_RELATIONSHIP, (int)level, (int)group, (int)targetGroup);
 }