Only gta5 v1.0.1290 or newer is supported!
This commit is contained in:
@ -16,6 +16,12 @@ namespace CoopClient.Entities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public EntitiesThread()
|
public EntitiesThread()
|
||||||
{
|
{
|
||||||
|
// Required for some synchronization!
|
||||||
|
if (Game.Version < GameVersion.v1_0_1290_1_Steam)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Tick += OnTick;
|
Tick += OnTick;
|
||||||
Interval = Util.GetGameMs<int>();
|
Interval = Util.GetGameMs<int>();
|
||||||
}
|
}
|
||||||
@ -27,13 +33,13 @@ namespace CoopClient.Entities
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<long, EntitiesNpc> localNpcs = null;
|
Dictionary<long, EntitiesNpc> localNPCs = null;
|
||||||
lock (Main.Npcs)
|
lock (Main.NPCs)
|
||||||
{
|
{
|
||||||
localNpcs = new Dictionary<long, EntitiesNpc>(Main.Npcs);
|
localNPCs = new Dictionary<long, EntitiesNpc>(Main.NPCs);
|
||||||
|
|
||||||
ulong tickCount = Util.GetTickCount64();
|
ulong tickCount = Util.GetTickCount64();
|
||||||
foreach (KeyValuePair<long, EntitiesNpc> npc in new Dictionary<long, EntitiesNpc>(localNpcs))
|
foreach (KeyValuePair<long, EntitiesNpc> npc in new Dictionary<long, EntitiesNpc>(localNPCs))
|
||||||
{
|
{
|
||||||
if ((tickCount - npc.Value.LastUpdateReceived) > 3000)
|
if ((tickCount - npc.Value.LastUpdateReceived) > 3000)
|
||||||
{
|
{
|
||||||
@ -50,13 +56,13 @@ namespace CoopClient.Entities
|
|||||||
npc.Value.MainVehicle.Delete();
|
npc.Value.MainVehicle.Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
localNpcs.Remove(npc.Key);
|
localNPCs.Remove(npc.Key);
|
||||||
Main.Npcs.Remove(npc.Key);
|
Main.NPCs.Remove(npc.Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (EntitiesNpc npc in localNpcs.Values)
|
foreach (EntitiesNpc npc in localNPCs.Values)
|
||||||
{
|
{
|
||||||
npc.DisplayLocally(null);
|
npc.DisplayLocally(null);
|
||||||
}
|
}
|
||||||
|
@ -31,32 +31,58 @@ namespace CoopClient
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Don't use it!
|
/// Don't use it!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Settings MainSettings = Util.ReadSettings();
|
public static Settings MainSettings = null;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Don't use it!
|
/// Don't use it!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Networking MainNetworking = new Networking();
|
public static Networking MainNetworking = null;
|
||||||
|
|
||||||
#if !NON_INTERACTIVE
|
#if !NON_INTERACTIVE
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Don't use it!
|
/// Don't use it!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static MenusMain MainMenu = new MenusMain();
|
public static MenusMain MainMenu = null;
|
||||||
#endif
|
#endif
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Don't use it!
|
/// Don't use it!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Chat MainChat = new Chat();
|
public static Chat MainChat = null;
|
||||||
|
|
||||||
internal static long LocalClientID = 0;
|
internal static long LocalClientID = 0;
|
||||||
internal static readonly Dictionary<long, EntitiesPlayer> Players = new Dictionary<long, EntitiesPlayer>();
|
internal static Dictionary<long, EntitiesPlayer> Players = null;
|
||||||
internal static readonly Dictionary<long, EntitiesNpc> Npcs = new Dictionary<long, EntitiesNpc>();
|
internal static Dictionary<long, EntitiesNpc> NPCs = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Don't use it!
|
/// Don't use it!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Main()
|
public Main()
|
||||||
{
|
{
|
||||||
|
// Required for some synchronization!
|
||||||
|
if (Game.Version < GameVersion.v1_0_1290_1_Steam)
|
||||||
|
{
|
||||||
|
Tick += (object sender, EventArgs e) =>
|
||||||
|
{
|
||||||
|
if (Game.IsLoading)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!GameLoaded)
|
||||||
|
{
|
||||||
|
GTA.UI.Notification.Show("~r~Please update your GTA5 to v1.0.1290 or newer!", true);
|
||||||
|
GameLoaded = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MainSettings = Util.ReadSettings();
|
||||||
|
MainNetworking = new Networking();
|
||||||
|
MainMenu = new MenusMain();
|
||||||
|
MainChat = new Chat();
|
||||||
|
Players = new Dictionary<long, EntitiesPlayer>();
|
||||||
|
NPCs = new Dictionary<long, EntitiesNpc>();
|
||||||
|
|
||||||
Function.Call((Hash)0x0888C3502DBBEEF5); // _LOAD_MP_DLC_MAPS
|
Function.Call((Hash)0x0888C3502DBBEEF5); // _LOAD_MP_DLC_MAPS
|
||||||
Function.Call((Hash)0x9BAE5AD2508DF078, true); // _ENABLE_MP_DLC_MAPS
|
Function.Call((Hash)0x9BAE5AD2508DF078, true); // _ENABLE_MP_DLC_MAPS
|
||||||
|
|
||||||
@ -217,13 +243,13 @@ namespace CoopClient
|
|||||||
}
|
}
|
||||||
Players.Clear();
|
Players.Clear();
|
||||||
|
|
||||||
foreach (KeyValuePair<long, EntitiesNpc> Npc in Npcs)
|
foreach (KeyValuePair<long, EntitiesNpc> Npc in NPCs)
|
||||||
{
|
{
|
||||||
Npc.Value.Character?.CurrentVehicle?.Delete();
|
Npc.Value.Character?.CurrentVehicle?.Delete();
|
||||||
Npc.Value.Character?.Kill();
|
Npc.Value.Character?.Kill();
|
||||||
Npc.Value.Character?.Delete();
|
Npc.Value.Character?.Delete();
|
||||||
}
|
}
|
||||||
Npcs.Clear();
|
NPCs.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
@ -563,11 +563,11 @@ namespace CoopClient
|
|||||||
#region -- NPC --
|
#region -- NPC --
|
||||||
private void FullSyncNpc(FullSyncNpcPacket packet)
|
private void FullSyncNpc(FullSyncNpcPacket packet)
|
||||||
{
|
{
|
||||||
lock (Main.Npcs)
|
lock (Main.NPCs)
|
||||||
{
|
{
|
||||||
if (Main.Npcs.ContainsKey(packet.ID))
|
if (Main.NPCs.ContainsKey(packet.ID))
|
||||||
{
|
{
|
||||||
EntitiesNpc npc = Main.Npcs[packet.ID];
|
EntitiesNpc npc = Main.NPCs[packet.ID];
|
||||||
|
|
||||||
npc.LastUpdateReceived = Util.GetTickCount64();
|
npc.LastUpdateReceived = Util.GetTickCount64();
|
||||||
|
|
||||||
@ -591,7 +591,7 @@ namespace CoopClient
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Main.Npcs.Add(packet.ID, new EntitiesNpc()
|
Main.NPCs.Add(packet.ID, new EntitiesNpc()
|
||||||
{
|
{
|
||||||
LastUpdateReceived = Util.GetTickCount64(),
|
LastUpdateReceived = Util.GetTickCount64(),
|
||||||
|
|
||||||
@ -619,11 +619,11 @@ namespace CoopClient
|
|||||||
|
|
||||||
private void FullSyncNpcVeh(FullSyncNpcVehPacket packet)
|
private void FullSyncNpcVeh(FullSyncNpcVehPacket packet)
|
||||||
{
|
{
|
||||||
lock (Main.Npcs)
|
lock (Main.NPCs)
|
||||||
{
|
{
|
||||||
if (Main.Npcs.ContainsKey(packet.ID))
|
if (Main.NPCs.ContainsKey(packet.ID))
|
||||||
{
|
{
|
||||||
EntitiesNpc npc = Main.Npcs[packet.ID];
|
EntitiesNpc npc = Main.NPCs[packet.ID];
|
||||||
|
|
||||||
npc.LastUpdateReceived = Util.GetTickCount64();
|
npc.LastUpdateReceived = Util.GetTickCount64();
|
||||||
|
|
||||||
@ -655,7 +655,7 @@ namespace CoopClient
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Main.Npcs.Add(packet.ID, new EntitiesNpc()
|
Main.NPCs.Add(packet.ID, new EntitiesNpc()
|
||||||
{
|
{
|
||||||
LastUpdateReceived = Util.GetTickCount64(),
|
LastUpdateReceived = Util.GetTickCount64(),
|
||||||
|
|
||||||
|
@ -22,6 +22,12 @@ namespace CoopClient
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public PlayerList()
|
public PlayerList()
|
||||||
{
|
{
|
||||||
|
// Required for some synchronization!
|
||||||
|
if (Game.Version < GameVersion.v1_0_1290_1_Steam)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
Tick += OnTick;
|
Tick += OnTick;
|
||||||
|
Reference in New Issue
Block a user