@@ -186,15 +186,21 @@ public IVehicle CreateVehicle(uint model, Position pos, Rotation rotation)
186186 var ptr = MockEntities . GetNextPtr ( ) ;
187187 vehiclePool . Create ( ptr , MockEntities . Id , out var vehicle ) ;
188188 vehicle . Position = pos ;
189- //TODO: apis missing for more properties from create
190- MockEntities . Insert ( vehicle ) ;
189+ if ( vehicle is MockVehicle mockVehicle )
190+ {
191+ mockVehicle . Position = pos ;
192+ mockVehicle . Rotation = rotation ;
193+ mockVehicle . Model = model ;
194+ }
195+ Alt . Module . OnCreateVehicle ( ptr , MockEntities . Id ) ;
191196 return vehicle ;
192197 }
193198
194199 public IntPtr CreateVehicleEntity ( out ushort id , uint model , Position pos , Rotation rotation )
195200 {
196201 var ptr = MockEntities . GetNextPtr ( ) ;
197202 id = MockEntities . Id ;
203+ Alt . Module . OnCreateVehicle ( ptr , id ) ;
198204 return ptr ;
199205 }
200206
@@ -211,8 +217,7 @@ public ICheckpoint CreateCheckpoint(IPlayer player, byte type, Position pos, flo
211217 mockCheckpoint . Height = height ;
212218 mockCheckpoint . Color = color ;
213219 }
214-
215- MockEntities . Insert ( checkpoint ) ;
220+ Alt . Module . OnCreateCheckpoint ( ptr ) ;
216221 return checkpoint ;
217222 }
218223
@@ -225,8 +230,7 @@ public IBlip CreateBlip(IPlayer player, byte type, Position pos)
225230 mockBlip . Position = pos ;
226231 mockBlip . BlipType = type ;
227232 }
228-
229- MockEntities . Insert ( blip ) ;
233+ Alt . Module . OnCreateBlip ( ptr ) ;
230234 return blip ;
231235 }
232236
@@ -240,8 +244,7 @@ public IBlip CreateBlip(IPlayer player, byte type, IEntity entityAttach)
240244 mockBlip . IsAttached = true ;
241245 mockBlip . AttachedTo = entityAttach ;
242246 }
243-
244- MockEntities . Insert ( blip ) ;
247+ Alt . Module . OnCreateBlip ( ptr ) ;
245248 return blip ;
246249 }
247250
@@ -254,8 +257,7 @@ public IVoiceChannel CreateVoiceChannel(bool spatial, float maxDistance)
254257 mockVoiceChannel . IsSpatial = spatial ;
255258 mockVoiceChannel . MaxDistance = maxDistance ;
256259 }
257-
258- MockEntities . Insert ( voiceChannel ) ;
260+ Alt . Module . OnCreateVoiceChannel ( ptr ) ;
259261 return voiceChannel ;
260262 }
261263
@@ -272,25 +274,22 @@ public void RemoveEntity(IEntity entity)
272274 public void RemoveBlip ( IBlip blip )
273275 {
274276 Alt . Module . OnRemoveBlip ( blip . NativePointer ) ;
275- MockEntities . Entities . Remove ( blip . NativePointer ) ;
276277 }
277278
278279 public void RemoveCheckpoint ( ICheckpoint checkpoint )
279280 {
280- Alt . Module . OnRemoveCheckpoint ( checkpoint . NativePointer ) ;
281- MockEntities . Entities . Remove ( checkpoint . NativePointer ) ;
281+ Alt . Module . OnRemoveCheckpoint ( checkpoint . NativePointer ) ;
282282 }
283283
284284 public void RemoveVehicle ( IVehicle vehicle )
285285 {
286+ Alt . Module . OnVehicleRemove ( vehicle . NativePointer ) ;
286287 Alt . Module . OnRemoveVehicle ( vehicle . NativePointer ) ;
287- MockEntities . Entities . Remove ( vehicle . NativePointer ) ;
288288 }
289289
290290 public void RemoveVoiceChannel ( IVoiceChannel channel )
291291 {
292292 Alt . Module . OnRemoveVoiceChannel ( channel . NativePointer ) ;
293- MockEntities . Entities . Remove ( channel . NativePointer ) ;
294293 }
295294
296295 public ServerNativeResource GetResource ( string name )
0 commit comments