public static void ChangePedestrianModel(PedModel ped, int newModelId) { if (-1 == newModelId) { newModelId = Ped.RandomPedId; } // Retry with another random model if this one doesn't work try { ped.Load(newModelId); } catch (System.NullReferenceException ex) { Debug.LogException(ex); ChangePedestrianModel(ped, -1); } }
/// <summary> /// Create a new ped /// </summary> public Ped(PedModel model, Vector3 position, float rotation = 0.0f, bool synced = true) : this(MtaServer.CreatePed((int)model, position.X, position.Y, position.Z, rotation, synced)) { }
/// <summary> /// Create a new ped /// </summary> public Ped(PedModel model, Vector3 position, float rotation = 0.0f) : this(MtaClient.CreatePed((int)model, position.X, position.Y, position.Z, rotation)) { }
/// <summary> /// Spawn the player at a certain position /// </summary> public void Spawn(Vector3 position, PedModel skin, int rotation = 0, int interior = 0, int dimension = 0, Team team = null) { MtaServer.SpawnPlayer(element, position.X, position.Y, position.Z, rotation, (int)skin, interior, dimension, team == null ? null : team.MTAElement); }