Fix player position not correctly set
This commit is contained in:
parent
8ee188cf19
commit
0b2ec1d626
@ -209,7 +209,7 @@ namespace RageCoop.Server
|
|||||||
/// Trigger a CustomEvent for this client
|
/// Trigger a CustomEvent for this client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="hash">An unique identifier of the event, you can use <see cref="CustomEvents.Hash(string)"/> to get it from a string</param>
|
/// <param name="hash">An unique identifier of the event, you can use <see cref="CustomEvents.Hash(string)"/> to get it from a string</param>
|
||||||
/// <param name="args"></param>
|
/// <param name="args">Arguments</param>
|
||||||
public void SendCustomEvent(int hash,List<object> args)
|
public void SendCustomEvent(int hash,List<object> args)
|
||||||
{
|
{
|
||||||
if (!IsReady)
|
if (!IsReady)
|
||||||
@ -234,6 +234,11 @@ namespace RageCoop.Server
|
|||||||
Server.Logger?.Error(ex);
|
Server.Logger?.Error(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Trigger a CustomEvent for this client
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hash">An unique identifier of the event, you can use <see cref="CustomEvents.Hash(string)"/> to get it from a string</param>
|
||||||
|
/// <param name="args">Arguments</param>
|
||||||
public void SendCustomEvent(int hash,params object[] args)
|
public void SendCustomEvent(int hash,params object[] args)
|
||||||
{
|
{
|
||||||
if (!IsReady)
|
if (!IsReady)
|
||||||
|
@ -599,16 +599,18 @@ namespace RageCoop.Server
|
|||||||
// Add the player to Players
|
// Add the player to Players
|
||||||
lock (Clients)
|
lock (Clients)
|
||||||
{
|
{
|
||||||
|
var player = new ServerPed
|
||||||
|
{
|
||||||
|
ID= packet.PedID,
|
||||||
|
};
|
||||||
|
Entities.Add(player);
|
||||||
Clients.Add(connection.RemoteUniqueIdentifier,
|
Clients.Add(connection.RemoteUniqueIdentifier,
|
||||||
tmpClient = new Client(this)
|
tmpClient = new Client(this)
|
||||||
{
|
{
|
||||||
NetID = connection.RemoteUniqueIdentifier,
|
NetID = connection.RemoteUniqueIdentifier,
|
||||||
Connection=connection,
|
Connection=connection,
|
||||||
Username=packet.Username,
|
Username=packet.Username,
|
||||||
Player = new()
|
Player = player
|
||||||
{
|
|
||||||
ID= packet.PedID,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);;
|
);;
|
||||||
}
|
}
|
||||||
|
@ -224,5 +224,17 @@ namespace RageCoop.Server
|
|||||||
// Server.Logger?.Trace($"Removing ped:{id}");
|
// Server.Logger?.Trace($"Removing ped:{id}");
|
||||||
if (Peds.ContainsKey(id)) { Peds.Remove(id); }
|
if (Peds.ContainsKey(id)) { Peds.Remove(id); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void Add(ServerPed ped)
|
||||||
|
{
|
||||||
|
if (Peds.ContainsKey(ped.ID))
|
||||||
|
{
|
||||||
|
Peds[ped.ID]=ped;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Peds.Add(ped.ID, ped);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// NPC data won't be sent to a player if their distance is greater than this value. -1 for unlimited.
|
/// NPC data won't be sent to a player if their distance is greater than this value. -1 for unlimited.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float NpcStreamingDistance { get; set; } = 500;
|
public float NpcStreamingDistance { get; set; } = 500 ;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Player's data won't be sent to another player if their distance is greater than this value. -1 for unlimited.
|
/// Player's data won't be sent to another player if their distance is greater than this value. -1 for unlimited.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user