Gangwar-System base Structure
This commit is contained in:
@@ -2986,6 +2986,39 @@ namespace ReallifeGamemode.Server.Commands
|
||||
player.SendChatMessage("~m~Benutzung:~s~ /business [price] [Option]");
|
||||
}
|
||||
|
||||
[Command("createturf", "~m~Benutzung:~s~ /createturf [radius]")]
|
||||
public void CmdAdmCreateTurf(Client player, float option)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
player.TriggerEvent("ADMIN:CreateTurf", JsonConvert.SerializeObject(option));
|
||||
}
|
||||
|
||||
[Command("setturf", "~m~Benutzung:~s~ /setturf (Name)")]
|
||||
public void CmdAdmSetTurf(Client player, string name)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
player.TriggerEvent("ADMIN:SetTurf", name);
|
||||
}
|
||||
|
||||
[Command("cancleturf", "~m~Benutzung:~s~ /cancleturf")]
|
||||
public void CmdAdmCancleTurf(Client player)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
Gangwar.Gangwar.loadClient(player);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ALevel1338
|
||||
|
||||
@@ -9,7 +9,7 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace ReallifeGamemode.Server.Gangwar
|
||||
{
|
||||
public class Gangwar
|
||||
public class Gangwar : Script
|
||||
{
|
||||
public static Turf[] _loadedTurfs;
|
||||
private static List<Turfs> turfs;
|
||||
@@ -40,5 +40,33 @@ namespace ReallifeGamemode.Server.Gangwar
|
||||
return _loadedTurfs;
|
||||
}
|
||||
|
||||
|
||||
[RemoteEvent("SERVER:SetTurf")]
|
||||
public void RmtEvent_SetTurf(Client client, string jsonX, string jsonY, string jsonRot, string jsonRange, string Name)
|
||||
{
|
||||
float pX = JsonConvert.DeserializeObject<float>(jsonX);
|
||||
float pY = (float)JsonConvert.DeserializeObject<float>(jsonY);
|
||||
float Rot = (float)JsonConvert.DeserializeObject<float>(jsonRot);
|
||||
float Range = (float)JsonConvert.DeserializeObject<float>(jsonRange);
|
||||
|
||||
var newTurf = new Turfs
|
||||
{
|
||||
Name = Name,
|
||||
X = pX,
|
||||
Y = pY,
|
||||
Rotation = client.Heading,
|
||||
Range = Range,
|
||||
Owner = "Neutral",
|
||||
Color = 0
|
||||
};
|
||||
using(var dbContext = new DatabaseContext())
|
||||
{
|
||||
dbContext.Turfs.Add(newTurf);
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
loadTurfs();
|
||||
NAPI.ClientEvent.TriggerClientEventForAll("GangAreas:Create", JsonConvert.SerializeObject(turfs.ToArray()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user