Fix missing database migration
This commit is contained in:
71
ReallifeGamemode.Client/Player/criminalrelease.ts
Normal file
71
ReallifeGamemode.Client/Player/criminalrelease.ts
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
import * as NativeUI from 'NativeUI';
|
||||||
|
|
||||||
|
const Menu = NativeUI.Menu;
|
||||||
|
const UIMenuItem = NativeUI.UIMenuItem;
|
||||||
|
const UIMenuListItem = NativeUI.UIMenuListItem;
|
||||||
|
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
|
||||||
|
const BadgeStyle = NativeUI.BadgeStyle;
|
||||||
|
const Point = NativeUI.Point;
|
||||||
|
const ItemsCollection = NativeUI.ItemsCollection;
|
||||||
|
const Color = NativeUI.Color;
|
||||||
|
|
||||||
|
let screenRes = mp.game.graphics.getScreenResolution(0, 0);
|
||||||
|
let saveItem = new UIMenuItem("Entlassen", "Setze den Gefangenen auf freiem Fuß");
|
||||||
|
saveItem.BackColor = new Color(13, 71, 161);
|
||||||
|
saveItem.HighlightedBackColor = new Color(25, 118, 210);
|
||||||
|
|
||||||
|
let cancelItem = new UIMenuItem("Abbrechen", "");
|
||||||
|
cancelItem.BackColor = new Color(213, 0, 0);
|
||||||
|
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
|
||||||
|
|
||||||
|
export default function jailList(globalData: GlobalData) {
|
||||||
|
|
||||||
|
var jailMenu: NativeUI.Menu;
|
||||||
|
|
||||||
|
var prisoners;
|
||||||
|
|
||||||
|
var prisoner = "";
|
||||||
|
|
||||||
|
|
||||||
|
//Weapon Menu
|
||||||
|
|
||||||
|
mp.events.add('showJailMenu', (prisonersArr) => {
|
||||||
|
if (!globalData.InMenu) {
|
||||||
|
|
||||||
|
globalData.InMenu = true;
|
||||||
|
|
||||||
|
prisoners = prisonersArr;
|
||||||
|
|
||||||
|
jailMenu = new Menu("Gefängnis PC", "", new Point(50, 50), null, null);
|
||||||
|
|
||||||
|
jailMenu.AddItem(new UIMenuListItem("Gefangener", "", new ItemsCollection(prisoners)));
|
||||||
|
|
||||||
|
jailMenu.AddItem(saveItem);
|
||||||
|
jailMenu.AddItem(cancelItem);
|
||||||
|
jailMenu.Visible = true;
|
||||||
|
|
||||||
|
jailMenu.ListChange.on((item, index) => {
|
||||||
|
switch (item.Text) {
|
||||||
|
case "Gefangener":
|
||||||
|
prisoner = String(item.SelectedItem.DisplayText);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
jailMenu.ItemSelect.on((item) => {
|
||||||
|
if (item.Text === "Entlassen") {
|
||||||
|
mp.events.callRemote("setPrisonerFree", prisoner);
|
||||||
|
jailMenu.Close();
|
||||||
|
globalData.InMenu = false;
|
||||||
|
} else if (item.Text === "Abbrechen") {
|
||||||
|
jailMenu.Close();
|
||||||
|
globalData.InMenu = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
jailMenu.MenuClose.on(() => {
|
||||||
|
globalData.InMenu = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
111
ReallifeGamemode.Client/Player/weaponlist.ts
Normal file
111
ReallifeGamemode.Client/Player/weaponlist.ts
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
import * as NativeUI from 'NativeUI';
|
||||||
|
|
||||||
|
const Menu = NativeUI.Menu;
|
||||||
|
const UIMenuItem = NativeUI.UIMenuItem;
|
||||||
|
const UIMenuListItem = NativeUI.UIMenuListItem;
|
||||||
|
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
|
||||||
|
const BadgeStyle = NativeUI.BadgeStyle;
|
||||||
|
const Point = NativeUI.Point;
|
||||||
|
const ItemsCollection = NativeUI.ItemsCollection;
|
||||||
|
const Color = NativeUI.Color;
|
||||||
|
|
||||||
|
let screenRes = mp.game.graphics.getScreenResolution(0, 0);
|
||||||
|
let saveItem = new UIMenuItem("Waffen Nehmen", "");
|
||||||
|
saveItem.BackColor = new Color(13, 71, 161);
|
||||||
|
saveItem.HighlightedBackColor = new Color(25, 118, 210);
|
||||||
|
|
||||||
|
let cancelItem = new UIMenuItem("Abbrechen", "");
|
||||||
|
cancelItem.BackColor = new Color(213, 0, 0);
|
||||||
|
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
|
||||||
|
|
||||||
|
export default function weaponList(globalData: GlobalData) {
|
||||||
|
|
||||||
|
var weaponMenu: NativeUI.Menu;
|
||||||
|
|
||||||
|
var primaries;
|
||||||
|
var secondaries;
|
||||||
|
var melees;
|
||||||
|
var specialsWep;
|
||||||
|
|
||||||
|
|
||||||
|
var primary = "";
|
||||||
|
var secondary = "";
|
||||||
|
var melee = "";
|
||||||
|
var specialWep = "";
|
||||||
|
|
||||||
|
//Weapon Menu
|
||||||
|
|
||||||
|
mp.events.add('showWeaponMenu', (primariesArr, secondariesArr, meleesArr, specialsArr) => {
|
||||||
|
if (!globalData.InMenu) {
|
||||||
|
|
||||||
|
globalData.InMenu = true;
|
||||||
|
|
||||||
|
primaries = primariesArr;
|
||||||
|
secondaries = secondariesArr;
|
||||||
|
melees = meleesArr;
|
||||||
|
specialsWep = specialsArr;
|
||||||
|
|
||||||
|
weaponMenu = new Menu("Waffenschrank", "Stelle deine Waffen Ausrüstung zusammen", new Point(50, 50), null, null);
|
||||||
|
|
||||||
|
weaponMenu.AddItem(new UIMenuListItem("Primäre", "", new ItemsCollection(primaries)));
|
||||||
|
weaponMenu.AddItem(new UIMenuListItem("Sekundäre", "", new ItemsCollection(secondaries)));
|
||||||
|
weaponMenu.AddItem(new UIMenuListItem("Nahkampf", "", new ItemsCollection(melees)));
|
||||||
|
weaponMenu.AddItem(new UIMenuListItem("Spezial", "", new ItemsCollection(specialsWep)));
|
||||||
|
weaponMenu.AddItem(saveItem);
|
||||||
|
weaponMenu.AddItem(cancelItem);
|
||||||
|
weaponMenu.Visible = true;
|
||||||
|
|
||||||
|
weaponMenu.ListChange.on((item, index) => {
|
||||||
|
switch (item.Text) {
|
||||||
|
case "Primäre":
|
||||||
|
if (item.SelectedItem.DisplayText === "Keine") {
|
||||||
|
primary = "";
|
||||||
|
} else {
|
||||||
|
primary = String(item.SelectedItem.DisplayText);
|
||||||
|
mp.events.callRemote("updateWeaponSelection", primary, 1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "Sekundäre":
|
||||||
|
if (item.SelectedItem.DisplayText === "Keine") {
|
||||||
|
secondary = "";
|
||||||
|
} else {
|
||||||
|
secondary = String(item.SelectedItem.DisplayText);
|
||||||
|
mp.events.callRemote("updateWeaponSelection", secondary, 2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "Nahkampf":
|
||||||
|
if (item.SelectedItem.DisplayText === "Keine") {
|
||||||
|
melee = "";
|
||||||
|
} else {
|
||||||
|
melee = String(item.SelectedItem.DisplayText);
|
||||||
|
mp.events.callRemote("updateWeaponSelection", melee, 3);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "Spezial":
|
||||||
|
if (item.SelectedItem.DisplayText === "Keine") {
|
||||||
|
specialWep = "";
|
||||||
|
} else {
|
||||||
|
specialWep = String(item.SelectedItem.DisplayText);
|
||||||
|
mp.events.callRemote("updateWeaponSelection", specialWep, 4);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
weaponMenu.ItemSelect.on((item) => {
|
||||||
|
if (item.Text === "Waffen Nehmen") {
|
||||||
|
mp.events.callRemote("saveWeaponSelection", primary, secondary, melee, specialWep);
|
||||||
|
weaponMenu.Close();
|
||||||
|
globalData.InMenu = false;
|
||||||
|
} else if (item.Text === "Abbrechen") {
|
||||||
|
weaponMenu.Close();
|
||||||
|
globalData.InMenu = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
weaponMenu.MenuClose.on(() => {
|
||||||
|
globalData.InMenu = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -106,6 +106,12 @@ Login(globalData);
|
|||||||
import dutyCloth from './Player/dutycloth';
|
import dutyCloth from './Player/dutycloth';
|
||||||
dutyCloth(globalData);
|
dutyCloth(globalData);
|
||||||
|
|
||||||
|
import weaponList from './Player/weaponlist';
|
||||||
|
weaponList(globalData);
|
||||||
|
|
||||||
|
import jailList from './Player/criminalrelease';
|
||||||
|
jailList(globalData);
|
||||||
|
|
||||||
import keys from './Player/keys';
|
import keys from './Player/keys';
|
||||||
keys(globalData);
|
keys(globalData);
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"**/*",
|
"**/*",
|
||||||
"node_modules/NativeUI/index.ts"
|
"node_modules/NativeUI/index.ts", "../ReallifeGamemode.Server/Entities/FactionWeapon.cs"
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"node_modules/NativeUI/index.ts"
|
"node_modules/NativeUI/index.ts"
|
||||||
|
|||||||
@@ -254,51 +254,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("release", "~m~Benutzung: ~s~/release [Name / ID] [Grund]", GreedyArg = true)]
|
|
||||||
public void CmdFactionJailRelease(Client player, string nameOrId, string reason)
|
|
||||||
{
|
|
||||||
User user = player.GetUser();
|
|
||||||
if (user == null || (user.FactionId != 1 && user.FactionId != 3))
|
|
||||||
{
|
|
||||||
ChatService.NotAuthorized(player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Client target = ClientService.GetClientByNameOrId(nameOrId);
|
|
||||||
if (target == null || !target.IsLoggedIn())
|
|
||||||
{
|
|
||||||
ChatService.PlayerNotFound(player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
User targetCop = target.GetUser();
|
|
||||||
if (targetCop.FactionId == 1 || targetCop.FactionId == 3)
|
|
||||||
{
|
|
||||||
ChatService.ErrorMessage(player, "Diese Person sollte sich nicht im Knast befinden");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (target.Position.DistanceTo(player.Position) < 6)
|
|
||||||
{
|
|
||||||
User targetUser = target.GetUser();
|
|
||||||
if (targetUser.JailTime > 0)
|
|
||||||
{
|
|
||||||
Jail.Release_Jail(target, reason);
|
|
||||||
ChatService.SendMessage(target, "~r~Du wurdest von " + player.Name + " aus dem Knast befreit");
|
|
||||||
|
|
||||||
ChatService.BroadcastFaction("~r~HQ: " + user.Name + " wurde von " + player.Name + " aus dem Knast entlassen. Grund: " + reason + ".", new List<int>() { 1, 3 });
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ChatService.ErrorMessage(player, "Diese Person befindet sich nicht im Knast");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ChatService.ErrorMessage(player, "Du bist zu weit entfernt");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
25
ReallifeGamemode.Server/Entities/FactionWeapon.cs
Normal file
25
ReallifeGamemode.Server/Entities/FactionWeapon.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
using GTANetworkAPI;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Entities
|
||||||
|
{
|
||||||
|
public class FactionWeapon
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("Faction")]
|
||||||
|
public int FactionId { get; set; }
|
||||||
|
public Faction Faction { get; set; }
|
||||||
|
|
||||||
|
public int WeaponHash { get; set; }
|
||||||
|
public string WeaponModel { get; set; }
|
||||||
|
public int SlotID { get; set; }
|
||||||
|
public int Rank { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -131,66 +131,166 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
var user = player.GetUser();
|
var user = player.GetUser();
|
||||||
if (user?.FactionId != null)
|
if (user?.FactionId != null)
|
||||||
{
|
{
|
||||||
DutyPoint nearest = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.5 && d.FactionId == user.FactionId);
|
DutyPoint nearestDuty = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.5 && d.FactionId == user.FactionId);
|
||||||
if (nearest == null) return;
|
WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.5 && w.FactionId == user.FactionId);
|
||||||
var nameTagColor = new Color(0, 0, 0);
|
JailReleasePoint nearestJailReleasePoint = PositionManager.JailReleasePoints.Find(j => j.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3) && user.GetData<bool>("duty"));
|
||||||
var factionId = user.FactionId;
|
if (nearestDuty != null)// Duty Point
|
||||||
|
|
||||||
if (user.GetData<bool>("duty") == false)
|
|
||||||
{
|
{
|
||||||
user.SetData("duty", true);
|
var nameTagColor = new Color(0, 0, 0);
|
||||||
player.SendNotification("Du bist nun ~g~im Dienst.");
|
var factionId = user.FactionId;
|
||||||
if (player.GetUser().FactionId == 2) //Fire Department
|
|
||||||
{
|
|
||||||
int medicCount = 0;
|
|
||||||
foreach (Client c in NAPI.Pools.GetAllPlayers())
|
|
||||||
{
|
|
||||||
if ((c.GetUser()?.Faction.Id ?? 0) == 2)
|
|
||||||
{
|
|
||||||
medicCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", medicCount);
|
|
||||||
}
|
|
||||||
switch (factionId)
|
|
||||||
{
|
|
||||||
//LSPD
|
|
||||||
case 1:
|
|
||||||
nameTagColor = new Color(28, 134, 238);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
player.NametagColor = nameTagColor;
|
|
||||||
using (var context = new DatabaseContext())
|
|
||||||
{
|
|
||||||
List<CharacterCloth> clothes = context.CharacterClothes.Where(u => u.UserId == user.Id && u.Duty == true).ToList();
|
|
||||||
|
|
||||||
foreach (var cloth in clothes)
|
if (user.GetData<bool>("duty") == false)
|
||||||
|
{
|
||||||
|
user.SetData("duty", true);
|
||||||
|
player.SendNotification("Du bist nun ~g~im Dienst.");
|
||||||
|
if (player.GetUser().FactionId == 2) //Fire Department
|
||||||
{
|
{
|
||||||
if (cloth.SlotType == 0)
|
int medicCount = 0;
|
||||||
|
foreach (Client c in NAPI.Pools.GetAllPlayers())
|
||||||
{
|
{
|
||||||
player.SetClothes(cloth.SlotId, cloth.ClothId, 0);
|
if ((c.GetUser()?.Faction.Id ?? 0) == 2)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (cloth.ClothId != -1)
|
|
||||||
{
|
{
|
||||||
player.SetAccessories(cloth.SlotId, cloth.ClothId, 0);
|
medicCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", medicCount);
|
||||||
|
}
|
||||||
|
switch (factionId)
|
||||||
|
{
|
||||||
|
//LSPD
|
||||||
|
case 1:
|
||||||
|
nameTagColor = new Color(28, 134, 238);
|
||||||
|
player.SetSharedData("blipColor", 38);
|
||||||
|
break;
|
||||||
|
|
||||||
|
//Medic
|
||||||
|
case 2:
|
||||||
|
nameTagColor = new Color(255, 0, 0);
|
||||||
|
player.SetSharedData("blipColor", 79);
|
||||||
|
break;
|
||||||
|
|
||||||
|
//FBI
|
||||||
|
case 3:
|
||||||
|
nameTagColor = new Color(173, 0, 118);
|
||||||
|
player.SetSharedData("blipColor", 83);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
player.NametagColor = nameTagColor;
|
||||||
|
using (var context = new DatabaseContext())
|
||||||
|
{
|
||||||
|
List<CharacterCloth> clothes = context.CharacterClothes.Where(u => u.UserId == user.Id && u.Duty == true).ToList();
|
||||||
|
|
||||||
|
foreach (var cloth in clothes)
|
||||||
|
{
|
||||||
|
if (cloth.SlotType == 0)
|
||||||
|
{
|
||||||
|
player.SetClothes(cloth.SlotId, cloth.ClothId, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.ClearAccessory(cloth.SlotId);
|
if (cloth.ClothId != -1)
|
||||||
|
{
|
||||||
|
player.SetAccessories(cloth.SlotId, cloth.ClothId, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.ClearAccessory(cloth.SlotId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
user.SetData("duty", false);
|
||||||
|
player.SendNotification("Du bist nun ~r~außer Dienst.");
|
||||||
|
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", false);
|
||||||
|
player.NametagColor = new Color(255, 255, 255);
|
||||||
|
UpdateCharacterCloth.LoadCharacterDefaults(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
if (nearestWeapon != null) // Weapon Point
|
||||||
{
|
{
|
||||||
user.SetData("duty", false);
|
|
||||||
player.SendNotification("Du bist nun ~r~außer Dienst.");
|
List<string> primarys = new List<string>();
|
||||||
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", false);
|
List<string> secondarys = new List<string>();
|
||||||
player.NametagColor = new Color(255, 255, 255);
|
List<string> melees = new List<string>();
|
||||||
UpdateCharacterCloth.LoadCharacterDefaults(player);
|
List<string> specials = new List<string>();
|
||||||
|
using (var context = new DatabaseContext())
|
||||||
|
{
|
||||||
|
List<FactionWeapon> weapons = context.FactionWeapons.ToList().FindAll(w => w.FactionId == user.FactionId);
|
||||||
|
foreach (var weapon in weapons)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
switch (weapon.SlotID)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
if (weapon.WeaponHash != -1)
|
||||||
|
{
|
||||||
|
if (user.FactionRank.Order >= weapon.Rank)
|
||||||
|
primarys.Add(weapon.WeaponModel.ToString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
primarys.Add("Keine");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (weapon.WeaponHash != -1)
|
||||||
|
{
|
||||||
|
if (user.FactionRank.Order >= weapon.Rank)
|
||||||
|
secondarys.Add(weapon.WeaponModel.ToString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
secondarys.Add("Keine");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (weapon.WeaponHash != -1)
|
||||||
|
{
|
||||||
|
if (user.FactionRank.Order >= weapon.Rank)
|
||||||
|
melees.Add(weapon.WeaponModel.ToString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
melees.Add("Keine");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if (weapon.WeaponHash != -1)
|
||||||
|
{
|
||||||
|
if (user.FactionRank.Order >= weapon.Rank)
|
||||||
|
specials.Add(weapon.WeaponModel.ToString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
specials.Add("Keine");
|
||||||
|
specials.Add("Schutzweste");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
player.TriggerEvent("showWeaponMenu", primarys.ToArray(), secondarys.ToArray(), melees.ToArray(), specials.ToArray());
|
||||||
|
}
|
||||||
|
if(nearestJailReleasePoint != null)
|
||||||
|
{
|
||||||
|
List<string> criminals = new List<string>();
|
||||||
|
foreach (Client target in NAPI.Pools.GetAllPlayers())
|
||||||
|
{
|
||||||
|
User c = target.GetUser();
|
||||||
|
|
||||||
|
{
|
||||||
|
if (c.JailTime > 0)
|
||||||
|
{
|
||||||
|
criminals.Add(c.Name.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
player.TriggerEvent("showJailMenu", criminals.ToArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
79
ReallifeGamemode.Server/Events/UpdateCharacterWeapon.cs
Normal file
79
ReallifeGamemode.Server/Events/UpdateCharacterWeapon.cs
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using GTANetworkAPI;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using ReallifeGamemode.Server.Entities;
|
||||||
|
using ReallifeGamemode.Server.Extensions;
|
||||||
|
using ReallifeGamemode.Server.Models;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Events
|
||||||
|
{
|
||||||
|
public class UpdateCharacterWeapon : Script
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[RemoteEvent("updateWeaponSelection")]
|
||||||
|
public void UpdateWeaponSelection(Client client, string weaponModel, int slot)
|
||||||
|
{
|
||||||
|
if(weaponModel == "Schutzweste")
|
||||||
|
{
|
||||||
|
client.Armor = 100;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
WeaponHash weaponHash = NAPI.Util.WeaponNameToModel(weaponModel);
|
||||||
|
|
||||||
|
if (slot == 1)
|
||||||
|
{
|
||||||
|
client.RemoveAllWeapons();
|
||||||
|
client.GiveWeapon(weaponHash, 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (slot == 2)
|
||||||
|
{
|
||||||
|
client.RemoveAllWeapons();
|
||||||
|
client.GiveWeapon(weaponHash, 0);
|
||||||
|
}
|
||||||
|
if (slot == 3)
|
||||||
|
{
|
||||||
|
client.RemoveAllWeapons();
|
||||||
|
client.GiveWeapon(weaponHash, 0);
|
||||||
|
}
|
||||||
|
if (slot == 4)
|
||||||
|
{
|
||||||
|
client.RemoveAllWeapons();
|
||||||
|
client.GiveWeapon(weaponHash, 0);
|
||||||
|
client.Armor = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[RemoteEvent("cancelWeaponSelection")]
|
||||||
|
public void CancelWeaponSelection(Client client)
|
||||||
|
{
|
||||||
|
client.RemoveAllWeapons();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[RemoteEvent("saveWeaponSelection")]
|
||||||
|
public void SaveWeaponSelection(Client client, string primaryModel, string secondaryModel, string meleeModel, string specialModel)
|
||||||
|
{
|
||||||
|
client.RemoveAllWeapons();
|
||||||
|
WeaponHash primary = NAPI.Util.WeaponNameToModel(primaryModel);
|
||||||
|
WeaponHash secondary = NAPI.Util.WeaponNameToModel(secondaryModel);
|
||||||
|
WeaponHash melee = NAPI.Util.WeaponNameToModel(meleeModel);
|
||||||
|
|
||||||
|
|
||||||
|
client.GiveWeapon(primary, 150);
|
||||||
|
client.GiveWeapon(secondary, 600);
|
||||||
|
client.GiveWeapon(melee, 1);
|
||||||
|
if(specialModel != "Schutzweste")
|
||||||
|
{
|
||||||
|
WeaponHash special = NAPI.Util.WeaponNameToModel(specialModel);
|
||||||
|
client.GiveWeapon(special, 50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,9 +11,17 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
public static List<DutyPoint> DutyPoints = new List<DutyPoint>();
|
public static List<DutyPoint> DutyPoints = new List<DutyPoint>();
|
||||||
public static List<ColShape> DutyColShapes = new List<ColShape>();
|
public static List<ColShape> DutyColShapes = new List<ColShape>();
|
||||||
|
|
||||||
|
public static List<WeaponPoint> WeaponPoints = new List<WeaponPoint>();
|
||||||
|
public static List<ColShape> WeaponColShapes = new List<ColShape>();
|
||||||
|
|
||||||
|
public static List<JailReleasePoint> JailReleasePoints = new List<JailReleasePoint>();
|
||||||
|
public static List<ColShape> JailReleaseColShapes = new List<ColShape>();
|
||||||
|
|
||||||
[ServerEvent(Event.ResourceStart)]
|
[ServerEvent(Event.ResourceStart)]
|
||||||
public void OnResourceStart()
|
public void OnResourceStart()
|
||||||
{
|
{
|
||||||
|
#region DutyPoints
|
||||||
|
|
||||||
DutyPoint dutyPointLSPD = new DutyPoint()
|
DutyPoint dutyPointLSPD = new DutyPoint()
|
||||||
{
|
{
|
||||||
Position = new Vector3(458.24, -990.86, 30.68),
|
Position = new Vector3(458.24, -990.86, 30.68),
|
||||||
@@ -28,6 +36,39 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
new Vector3(0, 0, 0), 3, new Color(255, 255, 255, 50), false, 0);
|
new Vector3(0, 0, 0), 3, new Color(255, 255, 255, 50), false, 0);
|
||||||
NAPI.TextLabel.CreateTextLabel("Stempeluhr - Dr\u00fccke ~y~E\n~s~Dienstkleidung - Dr\u00fccke ~y~K", d.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
NAPI.TextLabel.CreateTextLabel("Stempeluhr - Dr\u00fccke ~y~E\n~s~Dienstkleidung - Dr\u00fccke ~y~K", d.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
#region WeaponPoints
|
||||||
|
WeaponPoint weaponPointLSPD = new WeaponPoint()
|
||||||
|
{
|
||||||
|
Position = new Vector3(460.3162,-981.0168,30.68959),
|
||||||
|
FactionId = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
WeaponPoints.Add(weaponPointLSPD);
|
||||||
|
|
||||||
|
foreach(WeaponPoint w in WeaponPoints)
|
||||||
|
{
|
||||||
|
NAPI.Marker.CreateMarker(1, new Vector3(w.Position.X, w.Position.Y, w.Position.Z - 2), new Vector3(w.Position.X, w.Position.Y, w.Position.Z + 1),
|
||||||
|
new Vector3(0, 0, 0), 2, new Color(255, 255, 255, 50), false, 0);
|
||||||
|
NAPI.TextLabel.CreateTextLabel("Waffenspind - Dr\u00fccke ~y~E", w.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region JailReleasePoint
|
||||||
|
JailReleasePoint jailPointLSPD = new JailReleasePoint()
|
||||||
|
{
|
||||||
|
Position = new Vector3(459.5327, -988.8435, 24.91487)
|
||||||
|
};
|
||||||
|
|
||||||
|
JailReleasePoints.Add(jailPointLSPD);
|
||||||
|
|
||||||
|
foreach(JailReleasePoint j in JailReleasePoints)
|
||||||
|
{
|
||||||
|
NAPI.Marker.CreateMarker(1, new Vector3(j.Position.X, j.Position.Y, j.Position.Z - 2), new Vector3(j.Position.X, j.Position.Y, j.Position.Z + 1),
|
||||||
|
new Vector3(0, 0, 0), 1.5f, new Color(255, 255, 255, 50), false, 0);
|
||||||
|
NAPI.TextLabel.CreateTextLabel("Gefängnis PC - Dr\u00fccke ~y~E", j.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,5 +78,16 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
public int FactionId { get; set; }
|
public int FactionId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class WeaponPoint
|
||||||
|
{
|
||||||
|
public Vector3 Position { get; set; }
|
||||||
|
public int FactionId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class JailReleasePoint
|
||||||
|
{
|
||||||
|
public Vector3 Position { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1236
ReallifeGamemode.Server/Migrations/20190721144830_FactionWeapons.Designer.cs
generated
Normal file
1236
ReallifeGamemode.Server/Migrations/20190721144830_FactionWeapons.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,45 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Migrations
|
||||||
|
{
|
||||||
|
public partial class FactionWeapons : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "FactionWeapons",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
FactionId = table.Column<int>(nullable: false),
|
||||||
|
WeaponHash = table.Column<int>(nullable: false),
|
||||||
|
WeaponModel = table.Column<string>(nullable: true),
|
||||||
|
SlotID = table.Column<int>(nullable: false),
|
||||||
|
Rank = table.Column<int>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_FactionWeapons", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_FactionWeapons_Factions_FactionId",
|
||||||
|
column: x => x.FactionId,
|
||||||
|
principalTable: "Factions",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_FactionWeapons_FactionId",
|
||||||
|
table: "FactionWeapons",
|
||||||
|
column: "FactionId");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "FactionWeapons");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -389,6 +389,28 @@ namespace ReallifeGamemode.Migrations
|
|||||||
b.ToTable("FactionRanks");
|
b.ToTable("FactionRanks");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionWeapon", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<int>("FactionId");
|
||||||
|
|
||||||
|
b.Property<int>("Rank");
|
||||||
|
|
||||||
|
b.Property<int>("SlotID");
|
||||||
|
|
||||||
|
b.Property<int>("WeaponHash");
|
||||||
|
|
||||||
|
b.Property<string>("WeaponModel");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("FactionId");
|
||||||
|
|
||||||
|
b.ToTable("FactionWeapons");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.GotoPoint", b =>
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.GotoPoint", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@@ -1093,6 +1115,14 @@ namespace ReallifeGamemode.Migrations
|
|||||||
.OnDelete(DeleteBehavior.Cascade);
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionWeapon", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("FactionId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupBankAccount", b =>
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupBankAccount", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group")
|
b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group")
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ namespace ReallifeGamemode.Server.Models
|
|||||||
public DbSet<Entities.Character> Characters { get; set; }
|
public DbSet<Entities.Character> Characters { get; set; }
|
||||||
public DbSet<Entities.CharacterCloth> CharacterClothes { get; set; }
|
public DbSet<Entities.CharacterCloth> CharacterClothes { get; set; }
|
||||||
public DbSet<Entities.DutyCloth> DutyClothes { get; set; }
|
public DbSet<Entities.DutyCloth> DutyClothes { get; set; }
|
||||||
|
public DbSet<Entities.FactionWeapon> FactionWeapons { get; set; }
|
||||||
public DbSet<Entities.ClothCombination> ClothCombinations { get; set; }
|
public DbSet<Entities.ClothCombination> ClothCombinations { get; set; }
|
||||||
public DbSet<Entities.User> Users { get; set; }
|
public DbSet<Entities.User> Users { get; set; }
|
||||||
public DbSet<Entities.UserVehicle> UserVehicles { get; set; }
|
public DbSet<Entities.UserVehicle> UserVehicles { get; set; }
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ using ReallifeGamemode.Server.Services;
|
|||||||
|
|
||||||
namespace ReallifeGamemode.Server.Wanted
|
namespace ReallifeGamemode.Server.Wanted
|
||||||
{
|
{
|
||||||
public class Jail
|
public class Jail : Script
|
||||||
{
|
{
|
||||||
private static Dictionary<int, int> Jailtime { get; set; } = new Dictionary<int, int>(); //time in seconds
|
private static Dictionary<int, int> Jailtime { get; set; } = new Dictionary<int, int>(); //time in seconds
|
||||||
|
|
||||||
@@ -172,8 +172,15 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Release_Jail(Client player, string reason)
|
|
||||||
|
|
||||||
|
[RemoteEvent("setPrisonerFree")]
|
||||||
|
public void Release_Jail(Client cop, string client)
|
||||||
{
|
{
|
||||||
|
Client player = ClientService.GetClientByNameOrId(client);
|
||||||
|
if (player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
User user = player.GetUser();
|
User user = player.GetUser();
|
||||||
if (Jailtime.ContainsKey(user.Id))
|
if (Jailtime.ContainsKey(user.Id))
|
||||||
{
|
{
|
||||||
@@ -191,7 +198,7 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
User copUser = copPlayer.GetUser();
|
User copUser = copPlayer.GetUser();
|
||||||
if ((copUser.FactionId == 1 || copUser.FactionId == 3))
|
if ((copUser.FactionId == 1 || copUser.FactionId == 3))
|
||||||
{
|
{
|
||||||
ChatService.SendMessage(copPlayer, "~r~HQ: Beamter " + copPlayer.Name + " hat " + user.Name + " aus dem Knast entlassen. Grund: " + reason + ".");
|
ChatService.SendMessage(copPlayer, "~r~HQ: Beamter " + cop.Name + " hat " + user.Name + " aus dem Knast entlassen.");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user