Files
reallife-gamemode/Server/Managers/TuningManager.cs
2018-11-14 19:00:31 +01:00

50 lines
1.4 KiB
C#

using GTANetworkAPI;
using System.Collections.Generic;
namespace reallife_gamemode.Server.Managers
{
class TuningManager : Script
{
private static List<ColShape> tuningGarages = new List<ColShape>();
/// <summary>
/// Fügt eine Tuning-Garage zum Spiel hinzu
/// </summary>
/// <param name="pos">Die Position der Garage</param>
public static void AddTuningGarage(Vector3 pos)
{
ColShape colShape = NAPI.ColShape.CreateSphereColShape(pos, 10, 0);
colShape.OnEntityEnterColShape += (cs, c) =>
{
if(c.IsInVehicle)
{
c.TriggerEvent("showTuningInfo", c.GetData("duty"));
}
};
colShape.OnEntityExitColShape += (cs, c) =>
{
c.TriggerEvent("hideTuningInfo", true);
};
tuningGarages.Add(colShape);
}
[RemoteEvent("startPlayerTuning")]
public void StartPlayerTuning(Client player)
{
if (!player.IsInVehicle) return;
player.TriggerEvent("showTuningMenu");
}
[RemoteEvent("setVehicleMod")]
public void SetVehicleMod(Client player, int slot, int index)
{
if (index == 0) index--;
player.Vehicle.SetMod(slot, index - 1);
}
}
}