Merge branch 'feature/tuning-system' into develop
This commit is contained in:
54
Server/Managers/TuningManager.cs
Normal file
54
Server/Managers/TuningManager.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
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");
|
||||
}
|
||||
|
||||
[RemoteEvent("setVehicleMod")]
|
||||
public void SetVehicleMod(Client player, int slot, int index)
|
||||
{
|
||||
if (index == 0) index--;
|
||||
player.Vehicle.SetMod(slot, index - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user