116 lines
4.5 KiB
C#
116 lines
4.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using GrandTheftMultiplayer.Server;
|
|
using GrandTheftMultiplayer.Shared;
|
|
using GrandTheftMultiplayer.Server.API;
|
|
using GrandTheftMultiplayer.Shared.Math;
|
|
using GrandTheftMultiplayer.Server.Elements;
|
|
using GrandTheftMultiplayer.Server.Constant;
|
|
using GrandTheftMultiplayer.Server.Managers;
|
|
|
|
namespace Roleplay.RAPI
|
|
{
|
|
class Marker : Script
|
|
{
|
|
|
|
public Marker()
|
|
{
|
|
API.onResourceStop += onMarkerDelete;
|
|
API.delay(1000 * 5, true, () => { announcemarkers(); });
|
|
}
|
|
|
|
public static List<TextLabel> textes = new List<TextLabel>();
|
|
public static List<ColShape> cols = new List<ColShape>();
|
|
|
|
|
|
private void onMarkerDelete()
|
|
{
|
|
List<NetHandle> Marker = API.getAllMarkers();
|
|
|
|
for (var i = 0; i <= Marker.Count - 1; i++)
|
|
{
|
|
API.deleteEntity(Marker[i]);
|
|
}
|
|
|
|
List<NetHandle> Peds = API.getAllPeds();
|
|
for (var i = 0; i <= Peds.Count - 1; i++)
|
|
{
|
|
API.deleteEntity(Peds[i]);
|
|
}
|
|
|
|
List<NetHandle> Blips = API.getAllBlips();
|
|
|
|
for (var i = 0; i <= Blips.Count - 1; i++)
|
|
{
|
|
API.deleteEntity(Blips[i]);
|
|
}
|
|
|
|
List<NetHandle> Cars = API.getAllVehicles();
|
|
|
|
for (var i = 0; i <= Cars.Count - 1; i++)
|
|
{
|
|
API.deleteEntity(Cars[i]);
|
|
}
|
|
|
|
|
|
|
|
for (var i = 0; i <= textes.Count -1; i++)
|
|
{
|
|
textes[i].text = "";
|
|
textes[i].delete();
|
|
}
|
|
|
|
|
|
for (var i = 0; i <= cols.Count -1; i++)
|
|
{
|
|
API.deleteColShape(cols[i]);
|
|
}
|
|
}
|
|
public static int markers = 0;
|
|
|
|
public static void createMarker(int markerType, Vector3 pos, int scale, int r, int g, int b, string coldata, int dimension = 0, int alpha = 185, string text = "", int rotation = 0)
|
|
{
|
|
API.shared.createMarker(markerType, pos, new Vector3(0, 0, 0), new Vector3(0, 0, rotation), new Vector3(scale, scale, scale), alpha, r, g, b, dimension);
|
|
ColShape col = API.shared.createCylinderColShape(pos, scale, 3);
|
|
col.setData(coldata, true);
|
|
col.dimension = dimension;
|
|
textes.Add(API.shared.createTextLabel(text, pos.Add(new Vector3(0, 0, 1.5)), 50, 1,true,dimension));
|
|
markers = markers + 1;
|
|
cols.Add(col);
|
|
}
|
|
|
|
public static GrandTheftMultiplayer.Server.Elements.Marker createMarkerWithReturnType(int markerType, Vector3 pos, int scale, int r, int g, int b, string coldata, int dimension = 0, int alpha = 185, string text = "", int rotation = 0)
|
|
{
|
|
GrandTheftMultiplayer.Server.Elements.Marker marker = API.shared.createMarker(markerType, pos, new Vector3(0, 0, 0), new Vector3(0, 0, rotation), new Vector3(scale, scale, scale), alpha, r, g, b, dimension);
|
|
ColShape col = API.shared.createCylinderColShape(pos, scale, 3);
|
|
col.setData(coldata, true);
|
|
col.setData("marker",marker);
|
|
marker.setData("colshape",col);
|
|
textes.Add(API.shared.createTextLabel(text, pos.Add(new Vector3(0, 0, 1.5)), 50, 1));
|
|
markers = markers + 1;
|
|
return marker;
|
|
}
|
|
|
|
public void announcemarkers()
|
|
{
|
|
API.consoleOutput("RoleplayAPI loaded " + markers + " Markers!");
|
|
API.consoleOutput("Memory loaded Markers: " + API.getAllMarkers().Count);
|
|
}
|
|
|
|
public static void createClientMarker(Client player,int markerType, Vector3 pos, int scale, int r, int g, int b, string coldata, int dimension = 0, int alpha = 185, string text = "", int rotation = 0)
|
|
{
|
|
int clientdimesion = API.shared.getEntityData(player, "ID");
|
|
GrandTheftMultiplayer.Server.Elements.Marker marker = API.shared.createMarker(markerType, pos, new Vector3(0, 0, 0), new Vector3(0, 0, rotation), new Vector3(scale, scale, scale), alpha, r, g, b, dimension);
|
|
marker.dimension = clientdimesion;
|
|
ColShape col = API.shared.createCylinderColShape(pos, scale, 3);
|
|
col.dimension = clientdimesion;
|
|
col.setData(coldata, true);
|
|
textes.Add(API.shared.createTextLabel(text, pos.Add(new Vector3(0, 0, 1.5)), 50, 1));
|
|
}
|
|
|
|
|
|
}
|
|
}
|