113 lines
3.7 KiB
C#
113 lines
3.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using GTANetworkAPI;
|
|
using reallife_gamemode.Server.Extensions;
|
|
using reallife_gamemode.Server.Services;
|
|
using reallife_gamemode.Server.Util;
|
|
|
|
namespace reallife_gamemode.Server.Commands
|
|
{
|
|
public class Admin : Script
|
|
{
|
|
/**
|
|
* @overview Life of German Reallife - Admin Commands (Admin.cs)
|
|
* @author VegaZ, hydrant
|
|
* @copyright (c) 2008 - 2018 Life of German
|
|
*/
|
|
|
|
[Command("o", "~m~Benutzung: ~s~/o [Nachricht]", GreedyArg = true)]
|
|
public void CmdAdminO(Client player, string message)
|
|
{
|
|
if (!player.GetUser().IsAdmin(AdminLevel.SUPPORTER))
|
|
{
|
|
ChatService.NotAuthorized(player);
|
|
return;
|
|
}
|
|
|
|
string publicMessage = "~b~(( " + player.Name + ": " + message + " ))";
|
|
NAPI.Chat.SendChatMessageToAll(publicMessage);
|
|
}
|
|
|
|
[Command("veh", "~m~Benutzung:~s~ /veh [Fahrzeug] (Farbe 1) (Farbe 2)")]
|
|
public void CmdAdminVeh(Client player, VehicleHash hash, int color1 = 111, int color2 = 111)
|
|
{
|
|
// Alternative: siehe O Chat
|
|
int playerAdminLevel = 1;
|
|
if (playerAdminLevel < /* Benötigtes Level */ 1)
|
|
{
|
|
ChatService.NotAuthorized(player);
|
|
return;
|
|
}
|
|
|
|
if(player.IsInVehicle) // Man darf keine Autos erstellen, wenn man selbst in einem sitzt (verhindert Bugs)
|
|
{
|
|
player.SendChatMessage("~r~[FEHLER]~s~ Du sitzt momentan schon in einem Fahrzeug.");
|
|
return;
|
|
}
|
|
|
|
Vehicle v = NAPI.Vehicle.CreateVehicle(hash, player.Position, player.Rotation.Z, color1, color2);
|
|
|
|
player.SetIntoVehicle(v.Handle, -1);
|
|
}
|
|
|
|
[Command("fixveh")]
|
|
public void CmdAdminFixveh(Client player)
|
|
{
|
|
if (!player.GetUser().IsAdmin(AdminLevel.SUPPORTER))
|
|
{
|
|
ChatService.NotAuthorized(player);
|
|
return;
|
|
}
|
|
|
|
if (!player.IsInVehicle) // Man darf keine Autos erstellen, wenn man selbst in einem sitzt (verhindert Bugs)
|
|
{
|
|
player.SendChatMessage("~r~[FEHLER]~s~ Du sitzt momentan nicht in einem Fahrzeug.");
|
|
return;
|
|
}
|
|
|
|
player.Vehicle.Repair();
|
|
}
|
|
|
|
[Command("delveh")]
|
|
public void CmdAdminDelveh(Client player)
|
|
{
|
|
int playerAdminLevel = 1;
|
|
if (playerAdminLevel < /* Benötigtes Level */ 1)
|
|
{
|
|
ChatService.NotAuthorized(player);
|
|
return;
|
|
}
|
|
|
|
if (!player.IsInVehicle) // Man darf keine Autos erstellen, wenn man selbst in einem sitzt (verhindert Bugs)
|
|
{
|
|
player.SendChatMessage("~r~[FEHLER]~s~ Du sitzt momentan nicht in einem Fahrzeug.");
|
|
return;
|
|
}
|
|
|
|
/* TODO: Checken, ob das Fahrzeug in einem System genutzt wird (Fraktions-Autos / Spieler-Auto)
|
|
* Wenn Ja: Abbrechen und mitteilen, dass man den System-spezifischen Befehl zu nutzen hat */
|
|
|
|
player.Vehicle.Delete();
|
|
}
|
|
|
|
[Command("goto", "~m~Benutzung:~s~ /goto [Name]")]
|
|
public void CmdAdminGoto(Client player, string name)
|
|
{
|
|
if (!player.GetUser().IsAdmin(AdminLevel.SUPPORTER))
|
|
{
|
|
ChatService.NotAuthorized(player);
|
|
return;
|
|
}
|
|
|
|
Client target = ClientService.GetClientByName(name);
|
|
|
|
if(target == null)
|
|
{
|
|
ChatService.PlayerNotFound(player);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|