Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

Commit

Permalink
v0.0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ejb1123 committed Dec 4, 2017
1 parent 68ef902 commit aa63fa9
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 17 deletions.
8 changes: 7 additions & 1 deletion docs/Forum post.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ The source code can be found on [GitHub](https://github.com/ejb1123/ELS-FiveM).

----------
### Change log
#### v0.0.4.1
- Fully implemented FullySync for siren data.
- Fixed issues with requesting for vehicles that where not being rendered.
- Rewrote Server in C#
- Other fixes.

#### v0.0.4.0
- Use the Q key to manually sync the siren.
- Passenger siren control
Expand Down Expand Up @@ -104,4 +110,4 @@ Is true when the return value is not -1

----------
### Downloads
[v0.0.4.0](https://github.com/ejb1123/ELS-FiveM/releases/)
[v0.0.4.1](https://github.com/ejb1123/ELS-FiveM/releases/)
1 change: 1 addition & 0 deletions libs/raven-csharp
Submodule raven-csharp added at b254eb
15 changes: 13 additions & 2 deletions server/ELS-Server/Class1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ public Class1()
{
Debug.WriteLine("Server Running");
EventHandlers["ELS:FullSync:Unicast"] += new Action(() => { });
EventHandlers["ELS:FullSync:Broadcast"] += new Action<System.Dynamic.ExpandoObject>((dataDic) =>
EventHandlers["ELS:FullSync:Broadcast"] += new Action<System.Dynamic.ExpandoObject,int>((dataDic,playerID) =>
{
var dd = (IDictionary<string,object> )dataDic;
Debug.WriteLine($"NetworkID {dd["NetworkID"]}");
_cachedData[(int)dd["NetworkID"]] = dd;
TriggerClientEvent("ELS:NewFullSyncData", dataDic);
BroadcastMessage(dataDic, playerID);
});
EventHandlers["ELS:FullSync:Request:All"] += new Action<int>((int source) =>
{
Expand All @@ -31,5 +31,16 @@ public Class1()
TriggerClientEvent(Players[(int.Parse((string)b[0]))], "ELS:FullSync:NewSpawnWithData", _cachedData);
}), false);
}
void BroadcastMessage(System.Dynamic.ExpandoObject dataDic, int SourcePlayerID)
{

foreach(var ply in Players)
{
if (ply.Handle != Players[SourcePlayerID].Handle)
{
TriggerClientEvent("ELS:NewFullSyncData", dataDic);
}
}
}
}
}
2 changes: 1 addition & 1 deletion server/ELS-Server/ELS-Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>..\..\src\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand Down
4 changes: 2 additions & 2 deletions server/ELS-Server/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.0.4.1")]
[assembly: AssemblyFileVersion("0.0.4.1")]
5 changes: 5 additions & 0 deletions server/ELS-Server/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net461" />
<package id="SharpRaven" version="2.2.0" targetFramework="net461" />
</packages>
4 changes: 3 additions & 1 deletion src/ELSVehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ public ELSVehicle(int handle, IDictionary<string, object> data) : base(handle)
else
{
//_vehicle.SetExistOnAllMachines(true);
CitizenFX.Core.Debug.WriteLine(CitizenFX.Core.Native.API.IsEntityAMissionEntity(_vehicle.Handle).ToString());
#if DEBUG
CitizenFX.Core.Debug.WriteLine(CitizenFX.Core.Native.API.IsEntityAMissionEntity(_vehicle.Handle).ToString());

CitizenFX.Core.Debug.WriteLine($"registering netid:{_vehicle.GetNetworkId()}\n" +
$"Does entity belong to this script:{CitizenFX.Core.Native.API.DoesEntityBelongToThisScript(_vehicle.Handle, false)}");

#endif
_siren = new Siren.Siren(_vehicle);
}
#if DEBUG
CitizenFX.Core.Debug.WriteLine($"created vehicle");
#endif
}
private async void ModelLoaded()
{
Expand Down
2 changes: 1 addition & 1 deletion src/FullSync/FullSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal static void RequestData(long NetworkID)

internal static void SendDataBroadcast(IDictionary dic)
{
BaseScript.TriggerServerEvent("ELS:FullSync:Broadcast",dic);
BaseScript.TriggerServerEvent("ELS:FullSync:Broadcast",dic,Game.Player.ServerId);
}
internal static void SendDataUnicast(IDictionary dic,int PlayerID)
{
Expand Down
5 changes: 4 additions & 1 deletion src/Manager/VehicleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ internal override void RunTick()
Game.PlayerPed.CurrentVehicle.SetExistOnAllMachines(true);
AddIfNotPresint(API.VehToNet(Game.PlayerPed.CurrentVehicle.Handle), vehicle: out _currentVehicle);
_currentVehicle?.RunTick();
#if DEBUG
if (Game.IsControlJustPressed(0, Control.Cover))
{
FullSync.FullSyncManager.SendDataBroadcast(
Expand All @@ -41,6 +42,7 @@ internal override void RunTick()
CitizenFX.Core.UI.Screen.ShowNotification("FullSync™ ran");
CitizenFX.Core.Debug.WriteLine("FullSync™ ran");
}
#endif
}
foreach (ELSVehicle veh in Entities)
{
Expand Down Expand Up @@ -105,7 +107,9 @@ private bool AddIfNotPresint(int NETID, [Optional] IDictionary<string, object> d
/// <param name="dataDic">data</param>
async internal void SetVehicleSyncData(IDictionary<string, object> dataDic)
{
#if DEBUG
CitizenFX.Core.Debug.WriteLine($"creating vehicle with NETID of {(int)dataDic["NetworkID"]} LOCALID of {CitizenFX.Core.Native.API.NetToVeh((int)dataDic["NetworkID"])}");
#endif
var bo = AddIfNotPresint((int)dataDic["NetworkID"]
, dataDic,out ELSVehicle veh1);
veh1.SetData(dataDic);
Expand All @@ -125,7 +129,6 @@ internal void SyncAllVehiclesOnFirstSpawn(System.Dynamic.ExpandoObject data)
{
int netID = int.Parse(struct1.Key);
var vehData = (IDictionary<string,object>)struct1.Value;
CitizenFX.Core.Debug.WriteLine($"{vehData["NetworkID"]}, {API.NetworkDoesEntityExistWithNetworkId(netID)}, {API.NetworkDoesNetworkIdExist(netID)}, {API.DoesEntityExist(API.NetworkGetEntityFromNetworkId(netID))}");
AddIfNotPresint((int)vehData["NetworkID"],
vehData,
out ELSVehicle veh
Expand Down
4 changes: 2 additions & 2 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.4.0")]
[assembly: AssemblyFileVersion("0.0.4.0")]
[assembly: AssemblyVersion("0.0.4.1")]
[assembly: AssemblyFileVersion("0.0.4.1")]
8 changes: 2 additions & 6 deletions src/Siren/Siren/Siren.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ public Siren(Vehicle vehicle,[Optional]IDictionary<string,object> data)

Function.Call(Hash.DISABLE_VEHICLE_IMPACT_EXPLOSION_ACTIVATION, _vehicle, true);
_vehicle.Model.Request();
#if DEBUG
CitizenFX.Core.Debug.WriteLine(_vehicle.DisplayName);
#endif
_vcf = VCF.ELSVehicle.Find(item => item.Item2.FileName == _vehicle.DisplayName).Item2;
//issue in above line
CitizenFX.Core.Debug.WriteLine("saa");

if (_vcf == null)
{
throw new Exception($"Their is no VCF file for this vehicle: {_vehicle.DisplayName}");
}
CitizenFX.Core.Debug.WriteLine("saa");

_tones = new Tones
{
Expand All @@ -49,13 +48,10 @@ public Siren(Vehicle vehicle,[Optional]IDictionary<string,object> data)
tone4 = new Tone(_vcf.SOUNDS.SrnTone4.AudioString, _vehicle, ToneType.SrnTon4),
panicAlarm = new Tone(_vcf.SOUNDS.PanicMde.AudioString, _vehicle, ToneType.SrnPnic)
};
CitizenFX.Core.Debug.WriteLine("saa");

dual_siren = false;
CitizenFX.Core.Debug.WriteLine("saa");

_mainSiren = new MainSiren(ref _tones);
CitizenFX.Core.Debug.WriteLine("saa");

if (data != null) SetData(data);
}
Expand Down

0 comments on commit aa63fa9

Please sign in to comment.