Files
reallife-gamemode/Server/Managers/TuningManager.cs
2018-10-22 21:42:33 +02:00

48 lines
1.3 KiB
C#

using GTANetworkAPI;
using reallife_gamemode.Server.Util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace reallife_gamemode.Server.Managers
{
class TuningManager : Script
{
private static List<ColShape> tuningGarages = new List<ColShape>();
public static void AddTuningGarage(Vector3 pos1, Vector3 pos2)
{
// DEBUG
NAPI.TextLabel.CreateTextLabel("Pos1", pos1, 100, 1, 0, new Color(255, 255, 255), true, 0);
NAPI.TextLabel.CreateTextLabel("Pos2", pos2, 100, 1, 0, new Color(255, 255, 255), true, 0);
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");
};
tuningGarages.Add(colShape);
}
[RemoteEvent("startPlayerTuning")]
public void StartPlayerTuning(Client player)
{
if (!player.IsInVehicle) return;
player.TriggerEvent("showTuningMenu");
}
}
}