Add some Admin Commands, set default 'Command not found'-message
This commit is contained in:
@@ -2,15 +2,105 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using reallife_gamemode.Server.Services;
|
||||
|
||||
namespace reallife_gamemode.Server.Command
|
||||
namespace reallife_gamemode.Server.Commands
|
||||
{
|
||||
public class Admin : Script
|
||||
{
|
||||
[Command("o")]
|
||||
public void sendOChat(Client player, string message)
|
||||
/**
|
||||
* @overview Life of German Reallife - Admin.cs
|
||||
* @author VegaZ, hydrant
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
[Command("o", "~m~Benutzung: ~s~/o [Nachricht]", GreedyArg = true)]
|
||||
public void CmdAdminOChat(Client player, string message)
|
||||
{
|
||||
NAPI.Chat.SendChatMessageToAll("~r~" + player.Name + " sagt:~w~ " + message);
|
||||
/*
|
||||
* Alternative:
|
||||
* Account playerAccount = AccountManager.GetAccount(player);
|
||||
* if(!playerAccount.IsAdmin(adminLevel))
|
||||
* {
|
||||
* ChatService.NotAuthorized(player);
|
||||
* return;
|
||||
* }
|
||||
*/
|
||||
int playerAdminLevel = 1;
|
||||
if(playerAdminLevel < /* Benötigtes Level */ 1)
|
||||
{
|
||||
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)
|
||||
{
|
||||
// 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 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user