Added vehicle indicators
This commit is contained in:
@@ -1,28 +1,6 @@
|
||||
using GTANetworkAPI;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
//Disapproved by god himself
|
||||
|
||||
//Just use the API functions, you have nothing else to worry about
|
||||
|
||||
//Things to note
|
||||
//More things like vehicle mods will be added in the next version
|
||||
|
||||
/* API FUNCTIONS:
|
||||
public static void SetVehicleWindowState(Vehicle veh, WindowID window, WindowState state)
|
||||
public static WindowState GetVehicleWindowState(Vehicle veh, WindowID window)
|
||||
public static void SetVehicleWheelState(Vehicle veh, WheelID wheel, WheelState state)
|
||||
public static WheelState GetVehicleWheelState(Vehicle veh, WheelID wheel)
|
||||
public static void SetVehicleDirt(Vehicle veh, float dirt)
|
||||
public static float GetVehicleDirt(Vehicle veh)
|
||||
public static void SetDoorState(Vehicle veh, DoorID door, DoorState state)
|
||||
public static DoorState GetDoorState(Vehicle veh, DoorID door)
|
||||
public static void SetEngineState(Vehicle veh, bool status)
|
||||
public static bool GetEngineState(Vehicle veh)
|
||||
public static void SetLockStatus(Vehicle veh, bool status)
|
||||
public static bool GetLockState(Vehicle veh)
|
||||
*/
|
||||
|
||||
namespace ReallifeGamemode.Server.Util
|
||||
{
|
||||
//Enums for ease of use
|
||||
@@ -448,5 +426,72 @@ namespace ReallifeGamemode.Server.Util
|
||||
|
||||
NAPI.ClientEvent.TriggerClientEventInDimension(veh.Dimension, "VehStream_SetVehicleDoorStatus", veh.Handle, data.Door[0], data.Door[1], data.Door[2], data.Door[3], data.Door[4], data.Door[5], data.Door[6], data.Door[7]);
|
||||
}
|
||||
|
||||
// INDICATORS
|
||||
|
||||
[RemoteEvent("CLIENT:toggleLeftIndicator")]
|
||||
public void ToggleLeftIndicator(Client player)
|
||||
{
|
||||
if (!player.IsInVehicle || player.VehicleSeat != -1) return;
|
||||
Vehicle veh = player.Vehicle;
|
||||
|
||||
if (!(veh.GetData("indicatorData") is IndicatorData data)) data = new IndicatorData();
|
||||
|
||||
if (data.Left && data.Right)
|
||||
{
|
||||
data.Right = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
data.Left = !data.Left;
|
||||
}
|
||||
|
||||
veh.SetData("indicatorData", data);
|
||||
NAPI.ClientEvent.TriggerClientEventForAll("SERVER:setIndicatorStatus", veh.Handle.Value, data.Left, data.Right);
|
||||
}
|
||||
|
||||
[RemoteEvent("CLIENT:toggleRightIndicator")]
|
||||
public void ToggleRightIndicator(Client player)
|
||||
{
|
||||
if (!player.IsInVehicle || player.VehicleSeat != -1) return;
|
||||
Vehicle veh = player.Vehicle;
|
||||
|
||||
if (!(veh.GetData("indicatorData") is IndicatorData data)) data = new IndicatorData();
|
||||
|
||||
if (data.Left && data.Right)
|
||||
{
|
||||
data.Left = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
data.Right = !data.Right;
|
||||
}
|
||||
|
||||
veh.SetData("indicatorData", data);
|
||||
NAPI.ClientEvent.TriggerClientEventForAll("SERVER:setIndicatorStatus", veh.Handle.Value, data.Left, data.Right);
|
||||
}
|
||||
|
||||
[RemoteEvent("CLIENT:toggleWarningIndicator")]
|
||||
public void ToggleWarningIndicator(Client player)
|
||||
{
|
||||
if (!player.IsInVehicle || player.VehicleSeat != -1) return;
|
||||
Vehicle veh = player.Vehicle;
|
||||
|
||||
if (!(veh.GetData("indicatorData") is IndicatorData data)) data = new IndicatorData();
|
||||
|
||||
if (data.Right && data.Left)
|
||||
{
|
||||
data.Right = false;
|
||||
data.Left = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
data.Right = true;
|
||||
data.Left = true;
|
||||
}
|
||||
|
||||
veh.SetData("indicatorData", data);
|
||||
NAPI.ClientEvent.TriggerClientEventForAll("SERVER:setIndicatorStatus", veh.Handle.Value, data.Left, data.Right);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user