Add Edit-Mode, Hotkey-Blip-Saves
This commit is contained in:
@@ -16,6 +16,7 @@ mp.keys.bind(0x0D, false, function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//F7
|
//F7
|
||||||
mp.keys.bind(0x76, false, function () {
|
mp.keys.bind(0x76, false, function () {
|
||||||
if (showGui === true) {
|
if (showGui === true) {
|
||||||
@@ -27,6 +28,12 @@ mp.keys.bind(0x76, false, function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//NUM2
|
||||||
|
mp.keys.bind(0x62, false, function () {
|
||||||
|
mp.events.callRemote("keyPress:NUM2");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
//I
|
//I
|
||||||
mp.keys.bind(0x49, false, function () {
|
mp.keys.bind(0x49, false, function () {
|
||||||
if (!chat) {
|
if (!chat) {
|
||||||
|
|||||||
22
Main.cs
22
Main.cs
@@ -41,6 +41,28 @@ namespace reallife_gamemode
|
|||||||
context.Users.FirstOrDefault();
|
context.Users.FirstOrDefault();
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TempBlip tempBlip = new TempBlip()
|
||||||
|
{
|
||||||
|
Color = 1,
|
||||||
|
Name = "",
|
||||||
|
Transparency = 0,
|
||||||
|
ShortRange = true,
|
||||||
|
Sprite = 1,
|
||||||
|
Scale = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
NAPI.Data.SetWorldData("blipTemplate", tempBlip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class TempBlip
|
||||||
|
{
|
||||||
|
public byte Color { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public byte Transparency { get; set; }
|
||||||
|
public bool ShortRange { get; set; }
|
||||||
|
public uint Sprite { get; set; }
|
||||||
|
public float Scale { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -894,6 +894,50 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
|
|
||||||
|
|
||||||
#region ALevel1337
|
#region ALevel1337
|
||||||
|
[Command("editmode")]
|
||||||
|
public void CmdAdminToggleEditMode(Client player)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(player.GetData("editmode") == false)
|
||||||
|
{
|
||||||
|
player.SetData("editmode", true);
|
||||||
|
player.SendNotification("Edit-Mode ~g~aktiviert");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.SetData("editmode", false);
|
||||||
|
player.SendNotification("Edit-Mode ~r~deaktiviert");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("setbliptemplate", "~m~Benutzung: ~s~/setbliptemplate [byte COLOR] [byte ALPHA] [bool SHORTRANGE] [uint SPRITE] [float SCALE] [string NAME]", GreedyArg = true)]
|
||||||
|
public void CmdAdminSetBlipTemplate(Client player, byte color, byte alpha, bool shortRange, uint sprite, float scale, string name)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TempBlip newTempBlip = new TempBlip()
|
||||||
|
{
|
||||||
|
Color = color,
|
||||||
|
Name = name,
|
||||||
|
Transparency = alpha,
|
||||||
|
ShortRange = shortRange,
|
||||||
|
Sprite = sprite,
|
||||||
|
Scale = scale,
|
||||||
|
};
|
||||||
|
|
||||||
|
NAPI.Data.SetWorldData("blipTemplate", newTempBlip);
|
||||||
|
}
|
||||||
|
|
||||||
[Command("setskin", "~m~Benutzung: ~s~/setskin [Spieler] [Skin]")]
|
[Command("setskin", "~m~Benutzung: ~s~/setskin [Spieler] [Skin]")]
|
||||||
public void CmdAdminSetSkin(Client player, string name, string Skin)
|
public void CmdAdminSetSkin(Client player, string name, string Skin)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using reallife_gamemode.Server.Extensions;
|
||||||
using reallife_gamemode.Server.Util;
|
using reallife_gamemode.Server.Util;
|
||||||
/**
|
/**
|
||||||
* @overview Life of German Reallife - Event Key (Key.cs)
|
* @overview Life of German Reallife - Event Key (Key.cs)
|
||||||
@@ -14,6 +15,17 @@ namespace reallife_gamemode.Server.Events
|
|||||||
{
|
{
|
||||||
public class Key : Script
|
public class Key : Script
|
||||||
{
|
{
|
||||||
|
[RemoteEvent("keyPress:NUM2")]
|
||||||
|
public void KeyPressNUM2(Client player)
|
||||||
|
{
|
||||||
|
if(player.GetData("editmode") == true && player.GetUser().IsAdmin(AdminLevel.HEADADMIN) == true)
|
||||||
|
{
|
||||||
|
TempBlip tempBlip = NAPI.Data.GetWorldData("blipTemplate");
|
||||||
|
SaveManager.OnSaveBlipData(player, tempBlip.Sprite.ToString(), tempBlip.Name, tempBlip.Scale.ToString(), tempBlip.Color.ToString(),
|
||||||
|
tempBlip.Transparency.ToString(), 200.ToString(), tempBlip.ShortRange.ToString(), 0.ToString(), 0.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[RemoteEvent("keyPress:I")]
|
[RemoteEvent("keyPress:I")]
|
||||||
public void KeyPressI(Client player)
|
public void KeyPressI(Client player)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,6 +48,11 @@ namespace reallife_gamemode.Server.Events
|
|||||||
player.SetData("spec", true);
|
player.SetData("spec", true);
|
||||||
player.SetData("duty", false);
|
player.SetData("duty", false);
|
||||||
|
|
||||||
|
if(user.IsAdmin(AdminLevel.HEADADMIN) == true)
|
||||||
|
{
|
||||||
|
player.SetData("editmode", false);
|
||||||
|
}
|
||||||
|
|
||||||
var userBankAccount = loginUser.UserBankAccounts.SingleOrDefault(u => u.UserId == user.Id);
|
var userBankAccount = loginUser.UserBankAccounts.SingleOrDefault(u => u.UserId == user.Id);
|
||||||
userBankAccount.Balance = userBankAccount.Balance;
|
userBankAccount.Balance = userBankAccount.Balance;
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace reallife_gamemode.Server.Events
|
|||||||
public class SaveManager : Script
|
public class SaveManager : Script
|
||||||
{
|
{
|
||||||
[RemoteEvent("OnSaveBlipData")]
|
[RemoteEvent("OnSaveBlipData")]
|
||||||
public void OnSaveBlipData(Client player, string blipSprite, string blipName, string blipScale, string blipColor,
|
public static void OnSaveBlipData(Client player, string blipSprite, string blipName, string blipScale, string blipColor,
|
||||||
string blipAlpha, string blipDrawDistance, string blipShortRange, string blipRotation, string blipDimension)
|
string blipAlpha, string blipDrawDistance, string blipShortRange, string blipRotation, string blipDimension)
|
||||||
{
|
{
|
||||||
float x = player.Position.X;
|
float x = player.Position.X;
|
||||||
|
|||||||
Reference in New Issue
Block a user