46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using GTANetworkAPI;
|
|
using System.Collections.Generic;
|
|
|
|
namespace reallife_gamemode.Server.Managers
|
|
{
|
|
class TuningManager : Script
|
|
{
|
|
private static List<ColShape> tuningGarages = new List<ColShape>();
|
|
|
|
public static void AddTuningGarage(Vector3 pos1, Vector3 pos2)
|
|
{
|
|
ColShape colShape = NAPI.ColShape.CreateSphereColShape(pos1, 10, 0);
|
|
|
|
colShape.OnEntityEnterColShape += (cs, c) =>
|
|
{
|
|
if(c.IsInVehicle)
|
|
{
|
|
c.TriggerEvent("showTuningInfo");
|
|
}
|
|
};
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|