Merge branch 'develop' of ssh://development.life-of-german.org:451/log-gtav/reallife-gamemode into develop
This commit is contained in:
@@ -25,14 +25,15 @@
|
||||
playerBlipMap.set(player, pBlip);
|
||||
}
|
||||
let pBlip = playerBlipMap.get(player);
|
||||
let color = player.getVariable("blipColor");
|
||||
pBlip.setColour(isNaN(color) ? 0 : color);
|
||||
pBlip.setPosition(player.position.x, player.position.y, player.position.z);
|
||||
if (player.isDead()) {
|
||||
pBlip.setSprite(303);
|
||||
} else {
|
||||
pBlip.setSprite(1);
|
||||
}
|
||||
let color = player.getVariable("blipColor");
|
||||
pBlip.setColour(isNaN(color) ? 0 : color);
|
||||
pBlip.setPosition(player.position.x, player.position.y, player.position.z);
|
||||
|
||||
});
|
||||
}, 50);
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ const colors = [
|
||||
export default function customNametags() {
|
||||
mp.nametags.enabled = false;
|
||||
|
||||
mp.events.add('render', (nametags) => {
|
||||
mp.events.add(RageEnums.EventKey.RENDER, (nametags) => {
|
||||
const graphics = mp.game.graphics;
|
||||
const screenRes = graphics.getScreenResolution(0, 0);
|
||||
|
||||
@@ -51,7 +51,13 @@ export default function customNametags() {
|
||||
|
||||
let color = colors.find(c => c.id === colorId).color;
|
||||
|
||||
mp.game.graphics.drawText(player.name + " (" + player.remoteId + ")", [x, y],
|
||||
let nametagText = player.name + " (" + player.remoteId + ")";
|
||||
|
||||
if (player.getVariable("isAfk")) {
|
||||
nametagText += " ~r~AFK";
|
||||
}
|
||||
|
||||
mp.game.graphics.drawText(nametagText, [x, y],
|
||||
{
|
||||
font: 4,
|
||||
color: [color[0], color[1], color[2], color[3]],
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Menu, Point, UIMenuItem } from "../libs/NativeUI";
|
||||
import { createMenuItem } from "../util";
|
||||
import moneyformat from "../moneyformat";
|
||||
var screenRes = mp.game.graphics.getScreenResolution(0, 0);
|
||||
var menu: Menu = new Menu("Polizeirevier", "Die Hilfestelle der Polizei", new Point(0, screenRes.y / 3));
|
||||
var menu: Menu = new Menu("", "Hier kannst du den Waffenschein erwerben", new Point(0, screenRes.y / 3), "shopui_title_gunclub", "shopui_title_gunclub");
|
||||
|
||||
menu.AddItem(createMenuItem("Waffenschein kaufen", "Erwerbe einen Waffenschein", (item) => {
|
||||
item.SetRightLabel("$" + moneyformat(5000));
|
||||
@@ -24,7 +24,7 @@ menu.MenuClose.on(() => {
|
||||
game.events.add("SERVER:PoliceDepartment_EnterColShape", () => {
|
||||
//game.ui.setHelpText("Drücke ~INPUT_CONTEXT~, um das Menü des Polizeireviers zu öffnen");
|
||||
|
||||
mp.events.call("renderHelpTextOnScreen", "~s~Drücke ~g~E~s~ um das Menü des ~b~Polizeireviers ~s~zu öffnen")
|
||||
//mp.events.call("renderHelpTextOnScreen", "~s~Drücke ~g~E~s~ um das Menü des ~b~Polizeireviers ~s~zu öffnen")
|
||||
game.events.bindKey(Key.E, false, keyPressHandler);
|
||||
});
|
||||
|
||||
|
||||
@@ -9,6 +9,44 @@ var screenRes = mp.game.graphics.getScreenResolution(0, 0);
|
||||
|
||||
export default function vehicleMenu(globalData: IGlobalData) {
|
||||
let menuBrowser: BrowserMp = null;
|
||||
var lastDriversBrowser: BrowserMp = null;
|
||||
|
||||
var lastDrivers = null;
|
||||
|
||||
mp.events.add('lookLastDrivers', (lastDriversParam) => {
|
||||
lastDrivers = JSON.parse(lastDriversParam);
|
||||
|
||||
if (lastDriversBrowser !== null) {
|
||||
lastDriversBrowser.destroy();
|
||||
lastDriversBrowser = null;
|
||||
globalData.InMenu = false;
|
||||
mp.gui.cursor.show(false, false);
|
||||
mp.gui.chat.activate(true);
|
||||
}
|
||||
else if (!globalData.InMenu) {
|
||||
globalData.InMenu = true;
|
||||
lastDriversBrowser = mp.browsers.new('package://assets/vehicle/lastPlayers.html');
|
||||
mp.gui.chat.activate(false);
|
||||
mp.gui.cursor.show(true, true);
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.add("CEF:VehicleLook_Loaded", () => {
|
||||
lastDriversBrowser.execute(`setDrivers('${JSON.stringify(lastDrivers)}');`);
|
||||
});
|
||||
|
||||
mp.events.add("removeLookMenu", () => {
|
||||
if (lastDriversBrowser == null) {
|
||||
return;
|
||||
}
|
||||
else if (globalData.InMenu) {
|
||||
lastDriversBrowser.destroy();
|
||||
lastDriversBrowser = null;
|
||||
globalData.InMenu = false;
|
||||
mp.gui.cursor.show(false, false);
|
||||
mp.gui.chat.activate(true);
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.add('ToggleVehicleMenu', () => {
|
||||
if (menuBrowser !== null) {
|
||||
|
||||
89
ReallifeGamemode.Client/Interaction/ammunation/ammunation.ts
Normal file
89
ReallifeGamemode.Client/Interaction/ammunation/ammunation.ts
Normal file
@@ -0,0 +1,89 @@
|
||||
import * as NativeUI from '../../libs/NativeUI';
|
||||
|
||||
const Menu = NativeUI.Menu;
|
||||
const MenuItem = NativeUI.UIMenuItem;
|
||||
const MenuListItem = NativeUI.UIMenuListItem;
|
||||
const MenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
|
||||
const BadgeStyle = NativeUI.BadgeStyle;
|
||||
const Point = NativeUI.Point;
|
||||
const ItemsCollection = NativeUI.ItemsCollection;
|
||||
const Color = NativeUI.Color;
|
||||
|
||||
export default function ammunation(globalData: IGlobalData) {
|
||||
|
||||
var screenRes = mp.game.graphics.getScreenResolution(0, 0);
|
||||
var weapons: Weapon[];
|
||||
|
||||
mp.events.add("AmmunationShop:LoadNativeUI", (weaponList: string) => {
|
||||
|
||||
weapons = JSON.parse(weaponList);
|
||||
var menu = getAmmunationMenu();
|
||||
|
||||
//Schaut nach ob mindestens eine Waffe in weapons existiert welche die CategoryId beinhaltet
|
||||
for (var c = 1; c < 10; c++) {
|
||||
switch (c) {
|
||||
case 1: { //Meelee
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: { //Pistolen
|
||||
if (weapons.find(w => w.CategoryId == c)) {
|
||||
var pistolItem = new MenuItem("Pistolen", "Das kleine Kaliber",);
|
||||
menu.AddItem(pistolItem);
|
||||
menu.BindMenuToItem(getWeaponsFromCategory(menu, c, "Pistolen"),pistolItem);
|
||||
}
|
||||
break;
|
||||
}
|
||||
/*case 9: { //Sonstiges (Armor / Fallschirm)
|
||||
var otherItem = new MenuItem("Sonstiges", "Schutzwesten, Fallschirme...",);
|
||||
menu.AddItem(otherItem);
|
||||
menu.BindMenuToItem(getWeaponsFromCategory(menu, c, "Sonstiges"), otherItem);
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
menu.Open();
|
||||
mp.gui.chat.activate(false);
|
||||
globalData.InMenu = true;
|
||||
|
||||
menu.MenuClose.on(() => {
|
||||
globalData.InMenu = false;
|
||||
mp.gui.chat.show(true);
|
||||
})
|
||||
});
|
||||
|
||||
function getAmmunationMenu(): NativeUI.Menu {
|
||||
return new Menu("", "AMMU NATION - Waffenladen", new Point(0, screenRes.y / 3), "shopui_title_gunclub", "shopui_title_gunclub");
|
||||
}
|
||||
|
||||
function getWeaponsFromCategory(parentMenu: NativeUI.Menu, category: number, categoryName: string): NativeUI.Menu {
|
||||
var categoryMenu = new Menu("", categoryName, new Point(0, screenRes.y / 3), "shopui_title_gunclub", "shopui_title_gunclub");
|
||||
|
||||
categoryMenu.Visible = false;
|
||||
|
||||
var cWeapons: Weapon[] = weapons.filter(w => w.CategoryId == category);
|
||||
|
||||
if (category < 9) { //Weapons aus Datenbank
|
||||
cWeapons.forEach(weapon => {
|
||||
var weaponItem: NativeUI.UIMenuItem = new MenuItem(weapon.WeaponModel, "Du erhältst " + weapon.Ammo + " Munition", [weapon.WeaponModel, weapon.Ammo, weapon.Price]);
|
||||
categoryMenu.AddItem(weaponItem);
|
||||
weaponItem.SetRightLabel("~g~$" + weapon.Price.toString());
|
||||
})
|
||||
} else { //Sonstiges = Schutzwesten / Fallschirme
|
||||
var armorItem = new MenuItem("Schutzweste", "Sch\u00fctzt dich","armor",);
|
||||
categoryMenu.AddItem(armorItem);
|
||||
armorItem.SetRightLabel("~g~$3000");
|
||||
|
||||
var parachuteItem = new MenuItem("Fallschirm", "Flieg damit wohin du willst");
|
||||
categoryMenu.AddItem(parachuteItem);
|
||||
parachuteItem.SetRightLabel("~g~$500");
|
||||
}
|
||||
|
||||
categoryMenu.ItemSelect.on((item: NativeUI.UIMenuItem, index: number) => {
|
||||
mp.events.callRemote("CLIENT:Ammunation_BuyWeapon", item.Data[0], item.Data[1], item.Data[2]); //weaponmodel / ammo / price
|
||||
});
|
||||
|
||||
return categoryMenu;
|
||||
};
|
||||
};
|
||||
@@ -464,6 +464,23 @@ export default function (globalData: IGlobalData) {
|
||||
wageItem.SetRightLabel("$" + jobdata.wage.toString())
|
||||
}
|
||||
jobMenu.AddItem(wageItem);
|
||||
|
||||
if (jobdata.isActive) {
|
||||
var quitJobItem = new UIMenuItem("Job Beenden", "Beendet den Job und bringt dich zurück zur Base")
|
||||
jobMenu.AddItem(quitJobItem);
|
||||
quitJobItem.HighlightedBackColor = new Color(213, 0, 0);
|
||||
quitJobItem.BackColor = new Color(229, 57, 53);
|
||||
|
||||
jobMenu.ItemSelect.on((item, index) => {
|
||||
if (item == quitJobItem) {
|
||||
mp.events.callRemote("CLIENT:Job_StopJob");
|
||||
jobMenu.Close(true);
|
||||
mp.gui.chat.activate(true);
|
||||
globalData.InMenu = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
jobMenu.Visible = false;
|
||||
mp.gui.chat.show(false);
|
||||
return jobMenu;
|
||||
|
||||
12
ReallifeGamemode.Client/admin/spectate.ts
Normal file
12
ReallifeGamemode.Client/admin/spectate.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
let cam: CameraMp = mp.cameras.new('spectateCam');;
|
||||
mp.events.add("SERVER:ADMIN_SPECTATE", (targetPlayer) => {
|
||||
cam.attachTo(targetPlayer.handle, 10.0, 0.0, 10.0, true);
|
||||
cam.setActive(true);
|
||||
});
|
||||
|
||||
mp.events.add("SERVER:ADMIN_STOP_SPECTATE", () => {
|
||||
if (cam.isActive() == true) {
|
||||
cam.setActive(false);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
<ul id="chat_messages"></ul>
|
||||
</div>
|
||||
<script type="text/javascript" src="jquery-1.11.3.min.js"></script>
|
||||
<script src="js/newMain.js"></script>
|
||||
<script src="js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,6 +1,4 @@
|
||||
var neatoEmojiConverter = require('neato-emoji-converter')
|
||||
|
||||
let chat =
|
||||
let chat =
|
||||
{
|
||||
size: 0,
|
||||
history_limit: 50,
|
||||
@@ -40,14 +38,7 @@ var chatAPI =
|
||||
push: (text) => {
|
||||
let colorPositions = [];
|
||||
let colors = [];
|
||||
let chatElement = "<li>"
|
||||
|
||||
var converter = new neatoEmojiConverter([replacements]);
|
||||
text = converter.replaceShortcodesWith(text, function (unicodeChar, shortcode, name, object) {
|
||||
if (unicodeChar) { return unicodeChar }
|
||||
else if (object.url) { return `<img src="${object.url}" alt="${name}" title="${name}" style="max-height:35px; max-width:35px; width:auto; height:auto;" />` }
|
||||
else { return shortcode }
|
||||
});
|
||||
let chatElement = "<li>";
|
||||
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
let colorCheck = `${text[i]}${text[i + 1]}${text[i + 2]}`;
|
||||
|
||||
@@ -206,6 +206,10 @@
|
||||
|
||||
enableChatInput(false);
|
||||
}
|
||||
|
||||
chatAPI.push("lol");
|
||||
|
||||
$("#chat").hide();
|
||||
});
|
||||
});
|
||||
}, { "neato-emoji-converter": 2 }], 2: [function (require, module, exports) {
|
||||
|
||||
16
ReallifeGamemode.Client/assets/html/vehiclemenu/script.js
Normal file
16
ReallifeGamemode.Client/assets/html/vehiclemenu/script.js
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
|
||||
function ad_row(id, name, faction, ping) {
|
||||
var table_id = "t1";
|
||||
var table = document.getElementById(table_id);
|
||||
var rows = table.getElementsByTagName('tr').length;
|
||||
var tr = table.insertRow(rows);
|
||||
var td1 = document.createElement('td');
|
||||
var td2 = document.createElement('td');
|
||||
var td3 = document.createElement('td');
|
||||
var td4 = document.createElement('td');
|
||||
var test = faction;
|
||||
td1.innerHTML = ''+driver;
|
||||
tr.appendChild(td1);
|
||||
}
|
||||
67
ReallifeGamemode.Client/assets/html/vehiclemenu/style.css
Normal file
67
ReallifeGamemode.Client/assets/html/vehiclemenu/style.css
Normal file
@@ -0,0 +1,67 @@
|
||||
/* style.css für Tabliste */
|
||||
.greyFont {
|
||||
color: gray;
|
||||
font-size: 14px;
|
||||
width: 250px;
|
||||
}
|
||||
div {
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
body {
|
||||
overflow: hidden;
|
||||
font-family: 'Roboto', sans-serif;
|
||||
font-weight: 500;
|
||||
color: #222;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
font-weight: 700;
|
||||
font-size: 18px;
|
||||
color: white;
|
||||
margin:5px;
|
||||
padding: 5px;
|
||||
border: 1px solid #808080;
|
||||
width: 20.75em;
|
||||
}
|
||||
.TabWrapper {
|
||||
background: rgba(0,0,0,0.6);
|
||||
height: 600px;
|
||||
width: 600px;
|
||||
display: block;
|
||||
padding: 5px;
|
||||
position: absolute;
|
||||
left: 32%;
|
||||
top: 10%;
|
||||
}
|
||||
th, td {
|
||||
color: white;
|
||||
font-size: 18px;
|
||||
width:10%;
|
||||
text-align: left;
|
||||
}
|
||||
.scroll {
|
||||
height: 600px;
|
||||
width: 600px;
|
||||
font-size: 12px;
|
||||
overflow: auto;
|
||||
}
|
||||
.force-overflow {
|
||||
min-height: 600px;
|
||||
}
|
||||
|
||||
#style1::-webkit-scrollbar {
|
||||
width: 10px;
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
|
||||
#style1::-webkit-scrollbar-thumb {
|
||||
background-color: #FF0040;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
26
ReallifeGamemode.Client/assets/vehicle/application.js
Normal file
26
ReallifeGamemode.Client/assets/vehicle/application.js
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
let close = document.getElementById('close');
|
||||
|
||||
$(document).ready(function () {
|
||||
mp.trigger("CEF:VehicleLook_Loaded");
|
||||
});
|
||||
|
||||
function setDrivers(driversJson) {
|
||||
var drivers = JSON.parse(driversJson);
|
||||
var listTag = $("#drivers-list");
|
||||
drivers.forEach(driver => {
|
||||
var name = driver.Name;
|
||||
var dateTime = new Date(driver.Time);
|
||||
|
||||
var date = `${dateTime.getDay()}.${dateTime.getMonth()}.${dateTime.getFullYear()}`;
|
||||
var time = `${dateTime.getHours()}:${dateTime.getMinutes()}:${dateTime.getSeconds()}`;
|
||||
|
||||
var infoLine = `${name} am ${date} um ${time} Uhr`;
|
||||
var listItemTag = `<li>${infoLine}</li>`;
|
||||
listTag.append(listItemTag);
|
||||
});
|
||||
}
|
||||
|
||||
close.onclick = function closeWindow() {
|
||||
mp.trigger('removeLookMenu');
|
||||
}
|
||||
29
ReallifeGamemode.Client/assets/vehicle/lastPlayers.html
Normal file
29
ReallifeGamemode.Client/assets/vehicle/lastPlayers.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>Eingabe | Life of German</title>
|
||||
|
||||
<link rel="stylesheet" href="package://assets/css/Introduction/style.css" />
|
||||
<link rel="stylesheet" href="../../font/font-awesome/css/fontawesome.min.css">
|
||||
<link rel="stylesheet" href="../../font/font-awesome/css/regular.min.css">
|
||||
<link rel="stylesheet" href="../../font/roboto-mono/include_500.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main>
|
||||
<div class="input-main">
|
||||
<h1>Letze Fahrer</h1>
|
||||
</div>
|
||||
<div id="content" class="form" role="form">
|
||||
<ul id="drivers-list">
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<a id="close" href="#"></a>
|
||||
</main>
|
||||
<script src="../js/jquery-3.3.1.min.js"></script>
|
||||
<script src="./application.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
67
ReallifeGamemode.Client/assets/vehicle/style.css
Normal file
67
ReallifeGamemode.Client/assets/vehicle/style.css
Normal file
@@ -0,0 +1,67 @@
|
||||
/* style.css für Tabliste */
|
||||
.greyFont {
|
||||
color: gray;
|
||||
font-size: 14px;
|
||||
width: 250px;
|
||||
}
|
||||
div {
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
body {
|
||||
overflow: hidden;
|
||||
font-family: 'Roboto', sans-serif;
|
||||
font-weight: 500;
|
||||
color: #222;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
font-weight: 700;
|
||||
font-size: 18px;
|
||||
color: white;
|
||||
margin:5px;
|
||||
padding: 5px;
|
||||
border: 1px solid #808080;
|
||||
width: 20.75em;
|
||||
}
|
||||
.TabWrapper {
|
||||
background: rgba(0,0,0,0.6);
|
||||
height: 600px;
|
||||
width: 600px;
|
||||
display: block;
|
||||
padding: 5px;
|
||||
position: absolute;
|
||||
left: 32%;
|
||||
top: 10%;
|
||||
}
|
||||
th, td {
|
||||
color: white;
|
||||
font-size: 18px;
|
||||
width:10%;
|
||||
text-align: left;
|
||||
}
|
||||
.scroll {
|
||||
height: 600px;
|
||||
width: 600px;
|
||||
font-size: 12px;
|
||||
overflow: auto;
|
||||
}
|
||||
.force-overflow {
|
||||
min-height: 600px;
|
||||
}
|
||||
|
||||
#style1::-webkit-scrollbar {
|
||||
width: 10px;
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
|
||||
#style1::-webkit-scrollbar-thumb {
|
||||
background-color: #FF0040;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
3
ReallifeGamemode.Client/dlcpacks/fbigarage/dlc.rpf
Normal file
3
ReallifeGamemode.Client/dlcpacks/fbigarage/dlc.rpf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1e40413c355d3721e2a483add948aaad408b17c3ed9a0db409b141aa6110dbb6
|
||||
size 35840
|
||||
14
ReallifeGamemode.Client/global.d.ts
vendored
14
ReallifeGamemode.Client/global.d.ts
vendored
@@ -30,6 +30,7 @@ declare type JobData = {
|
||||
busskill: number;
|
||||
pilotskill: number;
|
||||
wage: number;
|
||||
isActive: boolean;
|
||||
}
|
||||
|
||||
declare type VehicleData = {
|
||||
@@ -75,4 +76,17 @@ declare type FactionMember = {
|
||||
|
||||
declare type FactionRank = {
|
||||
|
||||
}
|
||||
|
||||
declare type Weapon = {
|
||||
WeaponModel: string;
|
||||
CategoryId: number;
|
||||
SlotID: number;
|
||||
Ammo: number;
|
||||
Price: number;
|
||||
}
|
||||
|
||||
declare type WeaponCategory = {
|
||||
Category: number;
|
||||
Weapons: Weapon[];
|
||||
}
|
||||
@@ -262,8 +262,12 @@ antiCheat(globalData);
|
||||
import antiAfk from './Player/antiafk';
|
||||
antiAfk(globalData);
|
||||
|
||||
import ammunation from './Interaction/ammunation/ammunation';
|
||||
ammunation(globalData);
|
||||
|
||||
require('./Gui/policedepartment');
|
||||
require('./Gui/helptext');
|
||||
require('./admin/spectate');
|
||||
|
||||
interface VehicleData {
|
||||
EngineState: boolean;
|
||||
|
||||
@@ -133,11 +133,13 @@ export default function animationSync() {
|
||||
mp.events.callRemote("CLIENT:ClearAnimationData", false);
|
||||
}
|
||||
|
||||
const blockInputControls = [12, 13, 14, 15, 22, 24, 25, 37, 261, 262];
|
||||
|
||||
mp.events.add("render", () => {
|
||||
if (blockInput) {
|
||||
mp.game.controls.disableControlAction(32, 25, true);
|
||||
mp.game.controls.disableControlAction(32, 24, true);
|
||||
mp.game.controls.disableControlAction(32, 22, true);
|
||||
blockInputControls.forEach((ctrl) => {
|
||||
mp.game.controls.disableControlAction(32, ctrl, true);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
25
ReallifeGamemode.Database/Entities/UserWeapon.cs
Normal file
25
ReallifeGamemode.Database/Entities/UserWeapon.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;
|
||||
|
||||
namespace ReallifeGamemode.Database.Entities
|
||||
{
|
||||
public partial class UserWeapon
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[ForeignKey("User")]
|
||||
public int UserId { get; set; }
|
||||
public User User { get; set; }
|
||||
|
||||
[ForeignKey("Weapon")]
|
||||
public int WeaponId { get; set; }
|
||||
public Weapon Weapon { get; set; }
|
||||
|
||||
public int Ammo { get; set; }
|
||||
}
|
||||
}
|
||||
26
ReallifeGamemode.Database/Entities/Weapon.cs
Normal file
26
ReallifeGamemode.Database/Entities/Weapon.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
|
||||
namespace ReallifeGamemode.Database.Entities
|
||||
{
|
||||
public partial class Weapon
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
public string WeaponModel { get; set; }
|
||||
[ForeignKey("WeaponCategory")]
|
||||
public int CategoryId { get; set; }
|
||||
public WeaponCategory WeaponCategory { get; set; }
|
||||
public int SlotID { get; set; }
|
||||
public int Ammo { get; set; }
|
||||
public float Price { get; set; }
|
||||
|
||||
public bool Legal { get; set; }
|
||||
public bool AmmunationActive { get; set; }
|
||||
}
|
||||
}
|
||||
17
ReallifeGamemode.Database/Entities/WeaponCategory.cs
Normal file
17
ReallifeGamemode.Database/Entities/WeaponCategory.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Database.Entities
|
||||
{
|
||||
public partial class WeaponCategory
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
public string Category { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
1975
ReallifeGamemode.Database/Migrations/20210413201146_Ammunations.Designer.cs
generated
Normal file
1975
ReallifeGamemode.Database/Migrations/20210413201146_Ammunations.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,101 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ReallifeGamemode.Database.Migrations
|
||||
{
|
||||
public partial class Ammunations : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WeaponCategories",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Category = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WeaponCategories", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Weapons",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
WeaponModel = table.Column<string>(nullable: true),
|
||||
CategoryId = table.Column<int>(nullable: false),
|
||||
SlotID = table.Column<int>(nullable: false),
|
||||
Ammo = table.Column<int>(nullable: false),
|
||||
Price = table.Column<float>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Weapons", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Weapons_WeaponCategories_CategoryId",
|
||||
column: x => x.CategoryId,
|
||||
principalTable: "WeaponCategories",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UserWeapons",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
UserId = table.Column<int>(nullable: false),
|
||||
WeaponId = table.Column<int>(nullable: false),
|
||||
Ammo = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UserWeapons", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_UserWeapons_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_UserWeapons_Weapons_WeaponId",
|
||||
column: x => x.WeaponId,
|
||||
principalTable: "Weapons",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserWeapons_UserId",
|
||||
table: "UserWeapons",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserWeapons_WeaponId",
|
||||
table: "UserWeapons",
|
||||
column: "WeaponId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Weapons_CategoryId",
|
||||
table: "Weapons",
|
||||
column: "CategoryId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "UserWeapons");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Weapons");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WeaponCategories");
|
||||
}
|
||||
}
|
||||
}
|
||||
1981
ReallifeGamemode.Database/Migrations/20210416175726_Ammunations2.Designer.cs
generated
Normal file
1981
ReallifeGamemode.Database/Migrations/20210416175726_Ammunations2.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,33 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ReallifeGamemode.Database.Migrations
|
||||
{
|
||||
public partial class Ammunations2 : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "AmmunationActive",
|
||||
table: "Weapons",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "Legal",
|
||||
table: "Weapons",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AmmunationActive",
|
||||
table: "Weapons");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Legal",
|
||||
table: "Weapons");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1519,6 +1519,30 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
b.ToTable("UserItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserWeapon", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Ammo")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("WeaponId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.HasIndex("WeaponId");
|
||||
|
||||
b.ToTable("UserWeapons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.VehicleItem", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -1567,6 +1591,54 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
b.ToTable("VehicleMods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Weapon", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Ammo")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("AmmunationActive")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("CategoryId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Legal")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<float>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("SlotID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("WeaponModel")
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CategoryId");
|
||||
|
||||
b.ToTable("Weapons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.WeaponCategory", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Category")
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("WeaponCategories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Whitelist", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -1844,6 +1916,21 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserWeapon", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.Weapon", "Weapon")
|
||||
.WithMany()
|
||||
.HasForeignKey("WeaponId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.VehicleItem", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.ServerVehicle", "Vehicle")
|
||||
@@ -1862,6 +1949,15 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Weapon", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.WeaponCategory", "WeaponCategory")
|
||||
.WithMany()
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.GroupVehicle", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.Group", "Group")
|
||||
|
||||
@@ -74,6 +74,8 @@ namespace ReallifeGamemode.Database.Models
|
||||
public DbSet<Entities.UserVehicle> UserVehicles { get; set; }
|
||||
public DbSet<Entities.UserBankAccount> UserBankAccounts { get; set; }
|
||||
|
||||
public DbSet<Entities.UserWeapon> UserWeapons { get; set; }
|
||||
|
||||
|
||||
//Inventar
|
||||
public DbSet<Entities.UserItem> UserItems { get; set; }
|
||||
@@ -85,8 +87,13 @@ namespace ReallifeGamemode.Database.Models
|
||||
public DbSet<Entities.FactionVehicle> FactionVehicles { get; set; }
|
||||
|
||||
//Shops
|
||||
public DbSet<Entities.ShopClothe> ShopClothes { get; set; }
|
||||
public DbSet<Entities.ShopItem> ShopItems { get; set; }
|
||||
public DbSet<Entities.Weapon> Weapons { get; set; }
|
||||
public DbSet<Entities.WeaponCategory> WeaponCategories { get; set; }
|
||||
|
||||
//Logs
|
||||
|
||||
//public DbSet<Logs.Ban> BanLogs { get; set; }
|
||||
public DbSet<Entities.Logs.BankAccountTransactionHistory> BankAccountTransactionLogs { get; set; }
|
||||
public DbSet<Entities.Logs.Death> DeathLogs { get; set; }
|
||||
@@ -155,12 +162,6 @@ namespace ReallifeGamemode.Database.Models
|
||||
//Gangwar
|
||||
public DbSet<Entities.Turfs> Turfs { get; set; }
|
||||
|
||||
//ClothesShop
|
||||
public DbSet<Entities.ShopClothe> ShopClothes { get; set; }
|
||||
|
||||
//ItemShop
|
||||
public DbSet<Entities.ShopItem> ShopItems { get; set; }
|
||||
|
||||
//Server Variablen
|
||||
public DbSet<Entities.ServerVariable> ServerVariables { get; set; }
|
||||
}
|
||||
|
||||
Binary file not shown.
43
ReallifeGamemode.Database/sql
Normal file
43
ReallifeGamemode.Database/sql
Normal file
@@ -0,0 +1,43 @@
|
||||
CREATE TABLE `WeaponCategories` (
|
||||
`Id` int NOT NULL AUTO_INCREMENT,
|
||||
`Category` longtext CHARACTER SET utf8mb4 NULL,
|
||||
CONSTRAINT `PK_WeaponCategories` PRIMARY KEY (`Id`)
|
||||
);
|
||||
|
||||
CREATE TABLE `Weapons` (
|
||||
`Id` int NOT NULL AUTO_INCREMENT,
|
||||
`WeaponModel` longtext CHARACTER SET utf8mb4 NULL,
|
||||
`CategoryId` int NOT NULL,
|
||||
`SlotID` int NOT NULL,
|
||||
`Ammo` int NOT NULL,
|
||||
`Price` float NOT NULL,
|
||||
CONSTRAINT `PK_Weapons` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_Weapons_WeaponCategories_CategoryId` FOREIGN KEY (`CategoryId`) REFERENCES `WeaponCategories` (`Id`) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE `UserWeapons` (
|
||||
`Id` int NOT NULL AUTO_INCREMENT,
|
||||
`UserId` int NOT NULL,
|
||||
`WeaponId` int NOT NULL,
|
||||
`Ammo` int NOT NULL,
|
||||
CONSTRAINT `PK_UserWeapons` PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_UserWeapons_Users_UserId` FOREIGN KEY (`UserId`) REFERENCES `Users` (`Id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `FK_UserWeapons_Weapons_WeaponId` FOREIGN KEY (`WeaponId`) REFERENCES `Weapons` (`Id`) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX `IX_UserWeapons_UserId` ON `UserWeapons` (`UserId`);
|
||||
|
||||
CREATE INDEX `IX_UserWeapons_WeaponId` ON `UserWeapons` (`WeaponId`);
|
||||
|
||||
CREATE INDEX `IX_Weapons_CategoryId` ON `Weapons` (`CategoryId`);
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20210413201146_Ammunations', '3.1.3');
|
||||
|
||||
ALTER TABLE `Weapons` ADD `AmmunationActive` tinyint(1) NOT NULL DEFAULT FALSE;
|
||||
|
||||
ALTER TABLE `Weapons` ADD `Legal` tinyint(1) NOT NULL DEFAULT FALSE;
|
||||
|
||||
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
|
||||
VALUES ('20210416175726_Ammunations2', '3.1.3');
|
||||
|
||||
@@ -61,9 +61,9 @@ namespace ReallifeGamemode.Server.Core.Menus
|
||||
|
||||
private void CreateVisuals()
|
||||
{
|
||||
Position pos = new Position(440.869, -981.045, 30.689);
|
||||
Position pos = new Position(12.7499, -1105.1168, 29.797);
|
||||
|
||||
Api.TextLabel.CreateTextLabel("Polizeirevier\n\nDrücke ~y~E~s~, um das Menü zu öffnen", pos, 20f, 1.3f, Font.ChaletLondon, Color.White);
|
||||
Api.TextLabel.CreateTextLabel("Waffenschein kaufen\n\nDrücke ~y~E~s~, um das Menü zu öffnen", pos, 20f, 1.3f, Font.ChaletLondon, Color.White);
|
||||
Api.Marker.CreateMarker(MarkerType.VerticalCylinder, pos.Subtract(new Position(0, 0, 1.7)), new Position(), new Position(), 1f, Color.White);
|
||||
IColShape colShape = Api.ColShape.CreateSphere(pos, 2f);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace ReallifeGamemode.Server.Business
|
||||
{
|
||||
public override int Id => 8;
|
||||
|
||||
public override string Name => "Motorrad Shop";
|
||||
public override string Name => "Bike Shop";
|
||||
|
||||
public override Vector3 Position => new Vector3(1180.997, -394.9542, 68.01635);
|
||||
|
||||
|
||||
25
ReallifeGamemode.Server/Business/ClassicAndLuxuryCarshop.cs
Normal file
25
ReallifeGamemode.Server/Business/ClassicAndLuxuryCarshop.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
|
||||
namespace ReallifeGamemode.Server.Business
|
||||
{
|
||||
class ClassicAndLuxuryCarshop : CarDealerBusinessBase
|
||||
{
|
||||
public override int Id => 13;
|
||||
|
||||
public override string Name => "Classic & Luxury Carshop";
|
||||
|
||||
public override Vector3 Position => new Vector3(-1274.3439, 315.1384, 65.51176);
|
||||
|
||||
public override Vector3 CarSpawnPositon => new Vector3(-1351.2072, 244.88942, 60.357693);
|
||||
|
||||
public override float CarSpawnHeading => 3.62f;
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
25
ReallifeGamemode.Server/Business/OldschoolCarshop.cs
Normal file
25
ReallifeGamemode.Server/Business/OldschoolCarshop.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
|
||||
namespace ReallifeGamemode.Server.Business
|
||||
{
|
||||
class OldschoolCarshop : CarDealerBusinessBase
|
||||
{
|
||||
public override int Id => 14;
|
||||
|
||||
public override string Name => "Oldschool Carshop";
|
||||
|
||||
public override Vector3 Position => new Vector3(-1888.1119, 2049.722, 140.9831);
|
||||
|
||||
public override Vector3 CarSpawnPositon => new Vector3(-1883.5817, 2029.6252, 140.55038);
|
||||
|
||||
public override float CarSpawnHeading => 163.73f;
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ namespace ReallifeGamemode.Server.Business
|
||||
{
|
||||
public override int Id => 3;
|
||||
|
||||
public override string Name => "Vapid Autohaus";
|
||||
public override string Name => "Vapid Carshop";
|
||||
|
||||
public override Vector3 Position => new Vector3(-177, -1156, 23);
|
||||
|
||||
|
||||
@@ -1402,6 +1402,13 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
target.TriggerEvent("onPlayerRevived");
|
||||
target.SendNotification("Du wurdest von Admin ~y~" + player.Name + "~s~ wiederbelebt.");
|
||||
|
||||
MedicTask task = Medic.ReviveTasks.FirstOrDefault(t => t.Victim == player.Name);
|
||||
if (task != null)
|
||||
{
|
||||
ChatService.BroadcastFaction("~y~[MEDIC] ~w~Der Auftrag von " + target.Name + " wurde entfernt (Administrativ wiederbelebt)", new List<int>() { 2 });
|
||||
}
|
||||
|
||||
target.SetData("isDead", false);
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
@@ -1686,6 +1693,32 @@ namespace ReallifeGamemode.Server.Commands
|
||||
NAPI.Vehicle.SetVehicleTyreSmokeColor(veh, new Color(r, g, b));
|
||||
}
|
||||
|
||||
[Command("spectate", "~m~Benutzung: ~s~/spectate [NAME/ID]", Alias = "spec")]
|
||||
public void CmdAdminSpectate(Player player, string targetname = null)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
Player target;
|
||||
if (targetname != null)
|
||||
{
|
||||
target = PlayerService.GetPlayerByNameOrId(targetname);
|
||||
if (target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
player.TriggerEvent("SERVER:ADMIN_SPECTATE", target);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.TriggerEvent("SERVER:ADMIN_STOP_SPECTATE");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion Admin
|
||||
|
||||
#region ALevel1337
|
||||
@@ -1976,7 +2009,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
foreach (var managedPlayer in peopleInRange)
|
||||
{
|
||||
if (!managedPlayer.IsLoggedIn() || managedPlayer.GetData<bool>("isDead")) return;
|
||||
if (!managedPlayer.IsLoggedIn() || managedPlayer.GetData<bool>("isDead")) continue;
|
||||
managedPlayer.SafeSetHealth(hp);
|
||||
ChatService.SendMessage(managedPlayer, "~b~Admin " + player.Name + " hat im Radius von " + radius + " die HP auf " + hp + " gesetzt.");
|
||||
}
|
||||
@@ -2059,6 +2092,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
[Command("showtuningmenu", "~m~Benutzung: ~s~/showtuningmenu", Alias = "stm")]
|
||||
public void CmdAdminShowtuningmenu(Player player)
|
||||
{
|
||||
|
||||
@@ -356,15 +356,15 @@ namespace ReallifeGamemode.Server.Commands
|
||||
public void CmdFactionMedicHealive(Player player, string receiver, int price = 10)
|
||||
{
|
||||
Player target = PlayerService.GetPlayerByNameOrId(receiver);
|
||||
if (player.GetUser()?.FactionId != 2)
|
||||
if(target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.Position.DistanceTo(target.Position) > 5)
|
||||
if (player.GetUser()?.FactionId != 2)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Der Patient ist zu weit entfernt");
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -391,6 +391,12 @@ namespace ReallifeGamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.Position.DistanceTo(target.Position) > 5)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Der Patient ist zu weit entfernt");
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.Health == 100)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Der Spieler ist bereits voll geheilt");
|
||||
@@ -408,6 +414,31 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
#region Staatsfraktionen (LSPD / FBI) Commands
|
||||
|
||||
[Command("m", "~m~Benutzung: ~s~/m [Message]", GreedyArg = true)]
|
||||
public void CmdFactionMegaphone(Player player, string message)
|
||||
{
|
||||
User user = player.GetUser();
|
||||
if (user == null || (user.FactionId != 1 && user.FactionId != 3))
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.IsDuty())
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Du bist nicht im Dienst");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.IsInVehicle)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Du bist nicht in einem Fahrzeug");
|
||||
return;
|
||||
}
|
||||
|
||||
ChatService.SendInRange(player.Position, 50, "!{#FFFF00}[" + player.GetUser().Faction.Name + " " + player.Name + ": !{#FFFF00}" + message + "]");
|
||||
}
|
||||
|
||||
[Command("cuff", "~m~Benutzung: ~s~/cuff")]
|
||||
public void CmdFactionCuff(Player player)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using GTANetworkAPI;
|
||||
using Newtonsoft.Json;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
@@ -16,6 +17,42 @@ namespace ReallifeGamemode.Server.Commands
|
||||
{
|
||||
internal class UserCommands : Script
|
||||
{
|
||||
[Command("look", "~m~look")]
|
||||
public void CmdUserLook(Player player)
|
||||
{
|
||||
if (!player.IsLoggedIn()) return;
|
||||
|
||||
Vehicle veh = NAPI.Pools.GetAllVehicles()
|
||||
.Where(v => v.Position.DistanceTo(player.Position) <= 5)
|
||||
.OrderBy(v => v.Position.DistanceTo(player.Position))
|
||||
.FirstOrDefault();
|
||||
|
||||
if (veh == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var lastDriverDic = new Dictionary<string, DateTime>();
|
||||
|
||||
if(VehicleManager.lastDriversInVehicle.ContainsKey(veh))
|
||||
{
|
||||
lastDriverDic = VehicleManager.lastDriversInVehicle[veh];
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendNotification("~r~Mit diesem Fahrzeug ist noch niemand gefahren");
|
||||
return;
|
||||
}
|
||||
|
||||
var list = lastDriverDic.Select(v => new
|
||||
{
|
||||
Name = v.Key,
|
||||
Time = v.Value
|
||||
}).OrderByDescending(v => v.Time).ToList();
|
||||
|
||||
player.TriggerEvent("lookLastDrivers", JsonConvert.SerializeObject(list));
|
||||
}
|
||||
|
||||
[Command("id", "~m~Benutzung: ~s~/id [Name]")]
|
||||
public void CmdUserId(Player player, String targetname)
|
||||
{
|
||||
@@ -61,7 +98,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
else
|
||||
{
|
||||
pVeh = NAPI.Pools.GetAllVehicles().Where(v => v.Position.DistanceTo(player.Position) <= 5).FirstOrDefault();
|
||||
pVeh = NAPI.Pools.GetAllVehicles().Where(v => v.Position.DistanceTo(player.Position) <= 5).OrderBy(v => v.Position.DistanceTo(player.Position)).FirstOrDefault();
|
||||
}
|
||||
|
||||
if (pVeh == null)
|
||||
|
||||
@@ -98,8 +98,18 @@ namespace ReallifeGamemode.Server.DrivingSchool
|
||||
|
||||
private static void EntityEnterBusinessColShape(ColShape colShape, Player client)
|
||||
{
|
||||
var user = client.GetUser();
|
||||
if (client.IsInVehicle || !client.IsLoggedIn()) return;
|
||||
|
||||
if (user.GetData<bool>("duty"))
|
||||
{
|
||||
client.SendNotification("~r~Im Dienst kannst du keinen Führerschein machen", false);
|
||||
return;
|
||||
}
|
||||
if (user.Wanteds > 0)
|
||||
{
|
||||
client.SendNotification("~r~Mit Wanteds kannst du keinen Führerschein machen", false);
|
||||
return;
|
||||
}
|
||||
client.TriggerEvent("drivingSchoolMenu");
|
||||
}
|
||||
|
||||
@@ -112,11 +122,13 @@ namespace ReallifeGamemode.Server.DrivingSchool
|
||||
public void StartDrivingSchool(Player client)
|
||||
{
|
||||
User user = client.GetUser();
|
||||
|
||||
if (user.DriverLicenseVehicle || client.HasData("ActiveSchool"))
|
||||
{
|
||||
client.SendChatMessage("~b~[INFO]~s~ Du besitzt schon einen Führerschein.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (user.Handmoney < 2500)
|
||||
{
|
||||
client.SendNotification("~r~[FEHLER]~s~ Du hast nicht genug Geld auf der Hand($2.500)!", true);
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
{
|
||||
string serverMsg = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
||||
if (serverMsg.Trim().Length == 0) return;
|
||||
NAPI.Player.GetPlayersInRadiusOfPlayer(10, player).ForEach(p =>
|
||||
NAPI.Player.GetPlayersInRadiusOfPlayer(25, player).ForEach(p =>
|
||||
{
|
||||
ChatService.SendMessage(p, $"{player.Name} sagt: {serverMsg}");
|
||||
});
|
||||
|
||||
@@ -25,9 +25,19 @@ namespace ReallifeGamemode.Server.Events
|
||||
{
|
||||
public class Death : Script
|
||||
{
|
||||
private readonly Dictionary<Player, DateTime> lastPlayerDeathTime = new Dictionary<Player, DateTime>();
|
||||
|
||||
|
||||
[ServerEvent(Event.PlayerDeath)]
|
||||
public void OnPlayerDeath(Player player, Player killer, uint reason)
|
||||
{
|
||||
if (lastPlayerDeathTime.TryGetValue(player, out DateTime lastDeathTime) && DateTime.Now - lastDeathTime < TimeSpan.FromSeconds(5))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lastPlayerDeathTime[player] = DateTime.Now;
|
||||
|
||||
if (!player.IsLoggedIn())
|
||||
{
|
||||
player.Kick();
|
||||
@@ -51,18 +61,28 @@ namespace ReallifeGamemode.Server.Events
|
||||
float killerPosZ = -1;
|
||||
float killerHeading = -1;
|
||||
|
||||
NAPI.Util.ConsoleOutput($"OnPlayerDeath - Player {player.Name} died - Killer = {(killer != null ? killer.Name : "no killer found")}");
|
||||
|
||||
if (killer.IsLoggedIn())
|
||||
{
|
||||
NAPI.Util.ConsoleOutput($"OnPlayerDeath - Player {player.Name} died - Killer is logged in");
|
||||
|
||||
var killerUser = killer.GetUser(dbContext);
|
||||
if (killerUser != null)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput($"OnPlayerDeath - Player {player.Name} died - Killer GetUser is not null");
|
||||
killerId = killerUser.Id;
|
||||
killerPosX = killer.Position.X;
|
||||
killerPosY = killer.Position.Y;
|
||||
killerPosZ = killer.Position.Z;
|
||||
killerHeading = killer.Heading;
|
||||
if (player.HasData("inGangWar") && killer.HasData("inGangWar"))
|
||||
|
||||
var playerInGangwar = player.HasData("inGangWar");
|
||||
var killerInGangwar = killer.HasData("inGangWar");
|
||||
NAPI.Util.ConsoleOutput($"OnPlayerDeath - Player {player.Name} died - PlayerInGangwar = {playerInGangwar}, KillerInGangwar = {killerInGangwar}");
|
||||
if (playerInGangwar && killerInGangwar)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput($"OnPlayerDeath - Player {player.Name} died - Both players in gangwar, setting kill");
|
||||
Gangwar.Gangwar.GangwarKill(killer, player);
|
||||
}
|
||||
|
||||
@@ -78,6 +98,22 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
}
|
||||
|
||||
var dead = new Database.Entities.Logs.Death
|
||||
{
|
||||
VictimId = player.GetUser().Id,
|
||||
KillerId = killerId,
|
||||
KillerPositionX = killerPosX,
|
||||
KillerPositionY = killerPosY,
|
||||
KillerPositionZ = killerPosZ,
|
||||
KillerHeading = killerHeading,
|
||||
VictimPositionX = player.Position.X,
|
||||
VictimPositionY = player.Position.Y,
|
||||
VictimPositionZ = player.Position.Z,
|
||||
VictimHeading = player.Heading,
|
||||
CauseOfDeath = reason.ToString()
|
||||
};
|
||||
dbContext.DeathLogs.Add(dead);
|
||||
|
||||
bool copNearby = NAPI.Pools.GetAllPlayers().Any(u => u.IsDuty() && u.IsAlive() && u.Position.DistanceToSquared(player.Position) <= 200 * 200);
|
||||
|
||||
if (user.Wanteds > 0)
|
||||
@@ -94,11 +130,13 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
}
|
||||
|
||||
Medic.delHealTask(player);
|
||||
|
||||
if (user.JailTime <= 0)
|
||||
{
|
||||
user.Dead = true;
|
||||
|
||||
if (!player.HasData("reviveSperre") && player.GetData<bool>("isDead") == false && !player.HasData("inGangWar") && player.GetData<bool>("SAdminduty") == false)
|
||||
if (!player.HasData("reviveSperre") && player.GetData<bool>("isDead") == false && !player.HasData("inGangWar") && player.GetData<bool>("SAdminduty") == false)
|
||||
{
|
||||
//MEDIC AUFTRAG
|
||||
MedicTask reviveTask = new MedicTask()
|
||||
@@ -113,11 +151,10 @@ namespace ReallifeGamemode.Server.Events
|
||||
MedicName = "none"
|
||||
};
|
||||
Medic.AddTaskToList(reviveTask);
|
||||
Medic.delHealTask(player);
|
||||
ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " ist soeben verstorben.", new List<int>() { 2 });
|
||||
}
|
||||
|
||||
player.SetData("isDead", true);
|
||||
player.SetData("isDead", true);
|
||||
|
||||
if (player.GetUser().IsAdmin(AdminLevel.ADMIN) == true)
|
||||
{
|
||||
@@ -152,24 +189,10 @@ namespace ReallifeGamemode.Server.Events
|
||||
TextLabel grndTxtLbl = NAPI.TextLabel.CreateTextLabel(iItem.Name + " ~s~(~y~" + amount + "~s~)", textPos, 5, 0.5f, 4, new Color(255, 255, 255), false, 0);
|
||||
GroundItem.AddGroundItem(grndItem, grndObject, grndTxtLbl);
|
||||
|
||||
player.ClearAnimation();
|
||||
|
||||
dbContext.Remove(item);
|
||||
}
|
||||
|
||||
var dead = new Database.Entities.Logs.Death
|
||||
{
|
||||
VictimId = player.GetUser().Id,
|
||||
KillerId = killerId,
|
||||
KillerPositionX = killerPosX,
|
||||
KillerPositionY = killerPosY,
|
||||
KillerPositionZ = killerPosZ,
|
||||
KillerHeading = killerHeading,
|
||||
VictimPositionX = player.Position.X,
|
||||
VictimPositionY = player.Position.Y,
|
||||
VictimPositionZ = player.Position.Z,
|
||||
VictimHeading = player.Heading,
|
||||
CauseOfDeath = reason.ToString()
|
||||
};
|
||||
dbContext.DeathLogs.Add(dead);
|
||||
}
|
||||
}
|
||||
Job.JobBase job = Managers.JobManager.GetJob(player.GetUser().JobId ?? -1);
|
||||
@@ -239,7 +262,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
player.RemoveAllWeapons();
|
||||
MedicTask task = Medic.ReviveTasks.FirstOrDefault(t => t.Victim == player.Name);
|
||||
|
||||
if(task != null)
|
||||
if (task != null)
|
||||
{
|
||||
Player medicPlayer = PlayerService.GetPlayerByNameOrId(task.MedicName);
|
||||
Medic.RemoveTaskFromList(task);
|
||||
|
||||
@@ -62,6 +62,19 @@ namespace ReallifeGamemode.Server.Events
|
||||
{
|
||||
ChatService.BroadcastAdmin("!{#FFFF00}*** " + player.Name + " hat den Server verlassen", AdminLevel.MAPPING);
|
||||
}
|
||||
|
||||
MedicTask task = Medic.ReviveTasks.FirstOrDefault(t => t.Victim == player.Name);
|
||||
|
||||
if (task != null)
|
||||
{
|
||||
ChatService.BroadcastFaction("~y~[MEDIC] ~w~Info: Der Auftrag von " + player.Name + " wurde entfernt (Ausgeloggt)", new List<int>() { 2 });
|
||||
}
|
||||
|
||||
if (player.IsAdminDuty())
|
||||
{
|
||||
ChatService.Broadcast("!{#ee4d2e}[SUPPORT] " + player.Name + " hat sich vom Support abgemeldet (Ausgeloggt)");
|
||||
}
|
||||
|
||||
/*
|
||||
TaxiDriverJob taxiJob = JobManager.GetJob<TaxiDriverJob>();
|
||||
TaxiContract taxiContract = taxiJob.TaxiContracts.Where(t => t.Name == player.Name).FirstOrDefault();
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
using ReallifeGamemode.Server.WeaponDeal;
|
||||
|
||||
@@ -20,6 +22,13 @@ namespace ReallifeGamemode.Server.Events
|
||||
if (vehicle.HasMarkerBehind())
|
||||
vehicle.RemoveMarkerBehind();
|
||||
|
||||
if (!VehicleManager.lastDriversInVehicle.ContainsKey(vehicle))
|
||||
{
|
||||
VehicleManager.lastDriversInVehicle.Add(vehicle, new Dictionary<string, DateTime>());
|
||||
}
|
||||
|
||||
VehicleManager.lastDriversInVehicle[vehicle][client.Name] = DateTime.Now;
|
||||
|
||||
if (vehicle.GetServerVehicle() is FactionVehicle veh)
|
||||
{
|
||||
User u = client.GetUser();
|
||||
|
||||
@@ -9,6 +9,7 @@ using ReallifeGamemode.Server.Types;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
using ReallifeGamemode.Server.WeaponDeal;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
using ReallifeGamemode.Server.Job;
|
||||
|
||||
namespace ReallifeGamemode.Server.Events
|
||||
{
|
||||
@@ -28,7 +29,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
|
||||
if (vehicle.GetServerVehicle() is FactionVehicle veh)
|
||||
{
|
||||
if (!veh.GetOwners().Contains(player.GetUser().FactionId ?? 0) && !(u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty()))
|
||||
if (!veh.GetOwners().Contains(player.GetUser().FactionId ?? 0) && !(u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty()) && !JobBase.GetPlayerInJob().Contains(player))
|
||||
{
|
||||
if ((VehicleHash)vehicle.Model == VehicleHash.Burrito3)
|
||||
{
|
||||
|
||||
@@ -168,6 +168,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
busskill = u.BusSkill,
|
||||
pilotskill = u.PilotSkill,
|
||||
wage = u.Wage,
|
||||
isActive = JobBase.GetPlayerInJob().Contains(player),
|
||||
};
|
||||
|
||||
var memberList = dbContext.Users.Where(f => f.FactionId == u.FactionId && u.FactionId != 0).OrderByDescending(f => f.FactionRank.Order).ThenBy(f => f.Name).Select(m => new
|
||||
@@ -230,11 +231,12 @@ namespace ReallifeGamemode.Server.Events
|
||||
WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.5 && w.FactionId == user.FactionId);
|
||||
JailReleasePoint nearestJailReleasePoint = PositionManager.JailReleasePoints.Find(j => j.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3) && user.GetData<bool>("duty"));
|
||||
ElevatorPoint nearestElevatorPoint = PositionManager.ElevatorPoints.Find(e => e.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 2 || user.FactionId == 3));
|
||||
ClotheshopPoint nearestClotheShopPoint = PositionManager.clotheshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5 && (!user.GetData<bool>("duty")));
|
||||
FriseurPoint nearestFriseurPoint = PositionManager.friseurPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5 && (!user.GetData<bool>("duty")));
|
||||
ClotheshopPoint nearestClotheShopPoint = PositionManager.clotheshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
|
||||
FriseurPoint nearestFriseurPoint = PositionManager.friseurPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
|
||||
ItemshopPoint nearestItemShopPoint = PositionManager.itemshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
|
||||
JobPoint nearestJobPoint = PositionManager.JobPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6);
|
||||
Player nearestCuffPlayer = PositionManager.cuffPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6 && user.GetData<bool>("duty"));
|
||||
AmmunationPoint nearestAmmunationPoint = PositionManager.AmmunationPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
|
||||
|
||||
if (user?.FactionId != null)
|
||||
{
|
||||
@@ -506,6 +508,16 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
if (nearestClotheShopPoint != null)
|
||||
{
|
||||
if (user.GetData<bool>("duty"))
|
||||
{
|
||||
player.SendNotification("~r~Im Dienst kannst du keine Kleidung kaufen", false);
|
||||
return;
|
||||
}
|
||||
if(JobBase.GetPlayerInJob().Contains(player))
|
||||
{
|
||||
player.SendNotification("~r~Im aktiven Job kannst du keine Kleidung kaufen", false);
|
||||
return;
|
||||
}
|
||||
nearestClotheShopPoint.clotheShop.LoadShopNUI(player);
|
||||
}
|
||||
if (nearestItemShopPoint != null)
|
||||
@@ -514,8 +526,29 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
if (nearestFriseurPoint != null)
|
||||
{
|
||||
if (user.GetData<bool>("duty"))
|
||||
{
|
||||
player.SendNotification("~r~Im Dienst wirst du nicht vom Friseur bedient", false);
|
||||
return;
|
||||
}
|
||||
if (JobBase.GetPlayerInJob().Contains(player))
|
||||
{
|
||||
player.SendNotification("~r~Im aktiven Job wirst du nicht vom Friseur bedient", false);
|
||||
return;
|
||||
}
|
||||
nearestFriseurPoint.friseurShop.LoadShopNUI(player);
|
||||
}
|
||||
if (nearestAmmunationPoint != null)
|
||||
{
|
||||
if (!user.WeaponLicense)
|
||||
{
|
||||
player.SendNotification("~r~Du besitzt keinen Waffenschein");
|
||||
}
|
||||
else
|
||||
{
|
||||
nearestAmmunationPoint.Ammunation.LoadShopNUI(player);
|
||||
}
|
||||
}
|
||||
if (user.FactionLeader)
|
||||
{
|
||||
player.TriggerEvent("CLIENT:StartGangwar");
|
||||
@@ -535,6 +568,16 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
if (!job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
if (user.GetData<bool>("duty"))
|
||||
{
|
||||
player.SendNotification("~r~Im Dienst kannst du keinen Job ausführen", false);
|
||||
return;
|
||||
}
|
||||
if (user.Wanteds > 0)
|
||||
{
|
||||
player.SendNotification("~r~Mit Wanteds kannst du keinen Job starten", false);
|
||||
return;
|
||||
}
|
||||
if (player.GetUser().JobId == 3)
|
||||
{
|
||||
if (nearestJobPoint.Skill > user.PilotSkill)
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
[RemoteEvent("CLIENT:SetAfkStatus")]
|
||||
public void SetPlayerAfkStatus(Player player, bool status)
|
||||
{
|
||||
player.SetServerData("isAfk", status);
|
||||
player.SetSharedData("isAfk", status);
|
||||
if(status)
|
||||
{
|
||||
player.SendNotification("Du wurdest ~b~AFK~s~ gesetzt", true);
|
||||
|
||||
@@ -118,5 +118,24 @@ namespace ReallifeGamemode.Server.Events
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
[RemoteEvent("CLIENT:Ammunation_BuyWeapon")]
|
||||
public void AmmunationBuyWeapoon(Player player, string weaponmodel, int ammo, int price)
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
User user = player.GetUser(dbContext);
|
||||
|
||||
if (user.Handmoney < price)
|
||||
{
|
||||
player.SendNotification("Du hast nicht genügend Geld bei dir");
|
||||
return;
|
||||
}
|
||||
user.Handmoney -= price;
|
||||
dbContext.SaveChanges();
|
||||
player.GiveWeapon(NAPI.Util.WeaponNameToModel(weaponmodel), ammo);
|
||||
//client.TriggerEvent("SERVER:SET_HANDMONEY", user.Handmoney);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,12 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
|
||||
public static bool IsAfk(this Player player)
|
||||
{
|
||||
return player.GetServerData("isAfk", false);
|
||||
if(!player.HasSharedData("isAfk"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return player.GetSharedData<bool>("isAfk");
|
||||
}
|
||||
|
||||
public static bool IsAlive(this Player player)
|
||||
@@ -438,6 +443,7 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
return;
|
||||
|
||||
player.SyncAnimation("hup");
|
||||
NAPI.Player.SetPlayerCurrentWeapon(player, WeaponHash.Unarmed);
|
||||
|
||||
if (player.GetUser().Wanteds > 0)
|
||||
PositionManager.cuffPoints.Add(player);
|
||||
|
||||
@@ -36,24 +36,23 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
return 210 * 1000;
|
||||
|
||||
case 4:
|
||||
if ((VehicleHash)vehicle.HashCode == VehicleHash.Moonbeam
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Moonbeam2
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Ratloader
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Ratloader2
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Slamvan
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Slamvan2
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Slamvan3
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Yosemite
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Yosemite2
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Picador
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Moonbeam)
|
||||
if ((VehicleHash)vehicle.Model == VehicleHash.Moonbeam
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Moonbeam2
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Ratloader
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Ratloader2
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Slamvan
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Slamvan2
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Slamvan3
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Yosemite
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Yosemite2
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Picador)
|
||||
return 250 * 1000;
|
||||
else
|
||||
return 180 * 1000;
|
||||
|
||||
case 5:
|
||||
if ((VehicleHash)vehicle.HashCode == VehicleHash.Fagaloa
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Cheburek)
|
||||
if ((VehicleHash)vehicle.Model == VehicleHash.Fagaloa
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Cheburek)
|
||||
return 200 * 1000;
|
||||
else
|
||||
return 110 * 1000;
|
||||
@@ -68,12 +67,12 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
return 5 * 1000;
|
||||
|
||||
case 9:
|
||||
if ((VehicleHash)vehicle.HashCode == VehicleHash.Bifta
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Blazer
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Blazer2
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Blazer3
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Blazer4
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Blazer5)
|
||||
if ((VehicleHash)vehicle.Model == VehicleHash.Bifta
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Blazer
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Blazer2
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Blazer3
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Blazer4
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Blazer5)
|
||||
return 30 * 1000;
|
||||
else
|
||||
return 300 * 1000;
|
||||
@@ -85,9 +84,9 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
return 0;
|
||||
|
||||
case 12:
|
||||
if ((VehicleHash)vehicle.HashCode == VehicleHash.Minivan
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Minivan2
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Bobcatxl)
|
||||
if ((VehicleHash)vehicle.Model == VehicleHash.Minivan
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Minivan2
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Bobcatxl)
|
||||
return 600 * 1000;
|
||||
else
|
||||
return 1000 * 1000;
|
||||
@@ -108,13 +107,13 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
return 0;
|
||||
|
||||
case 18:
|
||||
if ((VehicleHash)vehicle.HashCode == VehicleHash.Policet)
|
||||
if ((VehicleHash)vehicle.Model == VehicleHash.Policet)
|
||||
return 1000 * 1000;
|
||||
else if ((VehicleHash)vehicle.HashCode == VehicleHash.Firetruk
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Pbus
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Policeb
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Polmav
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Predator)
|
||||
else if ((VehicleHash)vehicle.Model == VehicleHash.Firetruk
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Pbus
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Policeb
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Polmav
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Predator)
|
||||
return 0;
|
||||
else
|
||||
return 150 * 1000;
|
||||
|
||||
@@ -263,7 +263,7 @@ namespace ReallifeGamemode.Server.Factions.Medic
|
||||
{
|
||||
player.SetData("healauftrag", false);
|
||||
var medicPlayer = PlayerService.GetPlayerByNameOrId(task.MedicName);
|
||||
if (task.MedicName != "none")
|
||||
if (medicPlayer != null)
|
||||
{
|
||||
medicPlayer.TriggerEvent("destroyMedicTaskCheckpoint");
|
||||
}
|
||||
|
||||
@@ -49,13 +49,22 @@ namespace ReallifeGamemode.Server.Gangwar
|
||||
|
||||
public static void GangwarKill(Player killer, Player victim)
|
||||
{
|
||||
if (killer.HasData("GotInsideOfTurf") && victim.HasData("GotInsideOfTurf"))
|
||||
var killerInsideTurf = killer.HasData("GotInsideOfTurf");
|
||||
var victimInsideTurf = victim.HasData("GotInsideOfTurf");
|
||||
|
||||
NAPI.Util.ConsoleOutput($"GangwarKill - Victim {victim.Name} - KillerInsideTurf = {killerInsideTurf}, VictimInsideTurf = {victimInsideTurf}");
|
||||
|
||||
if (killerInsideTurf && victimInsideTurf)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput($"GangwarKill - Victim {victim.Name} - Killer and Victim are in Turf area");
|
||||
foreach (var turf in getTurfs())
|
||||
{
|
||||
if (turf.getId() == victim.GetData<int>("inGangWar"))
|
||||
{
|
||||
turf.setKill(victim.GetUser().Faction.Name);
|
||||
NAPI.Util.ConsoleOutput($"GangwarKill - Victim {victim.Name} - Killed in turf id {turf.getId()}");
|
||||
var victimFactionName = victim.GetUser().Faction.Name;
|
||||
NAPI.Util.ConsoleOutput($"GangwarKill - Victim {victim.Name} - Faction Name = {victimFactionName}");
|
||||
turf.setKill(victimFactionName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,11 +203,16 @@ namespace ReallifeGamemode.Server.Gangwar
|
||||
public void enter(Player client)
|
||||
{
|
||||
User user = client.GetUser();
|
||||
if(user == null || user.FactionId == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.status == "attack")
|
||||
{
|
||||
if (user.Faction.Name != getOwner() && user.Faction.Name != getAttacker())
|
||||
return;
|
||||
Player gPlayer = playerInGangwar.Where(c => c != null && !c.Handle.IsNull && c.IsLoggedIn() && c.GetUser()?.Id == user.Id).FirstOrDefault();
|
||||
Player gPlayer = playerInGangwar.Where(c => c != null && !c.Handle.IsNull && c.IsLoggedIn() && c.Handle.Value == client.Handle.Value).FirstOrDefault();
|
||||
if (gPlayer == null)
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
@@ -366,10 +371,12 @@ namespace ReallifeGamemode.Server.Gangwar
|
||||
{
|
||||
if (getOwner() == FactionName)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput($"GangwarKill - Adding Point for Faction {getAttacker()}");
|
||||
Att_Score += 1;
|
||||
}
|
||||
else if (getAttacker() == FactionName)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput($"GangwarKill - Adding Point for Faction {getOwner()}");
|
||||
Def_Score += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ using ReallifeGamemode.Server.Managers;
|
||||
|
||||
namespace ReallifeGamemode.Server.Inventory.Items
|
||||
{
|
||||
internal class Döner : ConsumableItem
|
||||
internal class Kebab : ConsumableItem
|
||||
{
|
||||
public override int Id => 106;
|
||||
public override string Name => "Döner";
|
||||
@@ -33,9 +33,9 @@ namespace ReallifeGamemode.Server.Job
|
||||
public const uint VEHICLE_INTERMEDIATE = (uint)VehicleHash.Coach;
|
||||
public const uint VEHICLE_PROFESSIONAL = (uint)VehicleHash.Tourbus;
|
||||
|
||||
public const int WAGE_BEGINNER = 800;
|
||||
public const int WAGE_INTERMEDIATE = 1200;
|
||||
public const int WAGE_PROFESSIOAL = 1800;
|
||||
public const int WAGE_BEGINNER = 400;
|
||||
public const int WAGE_INTERMEDIATE = 600;
|
||||
public const int WAGE_PROFESSIOAL = 900;
|
||||
|
||||
public const string BEGINNER = "Anfänger";
|
||||
public const string INTERMEDIATE = "Fortgeschrittener";
|
||||
@@ -195,25 +195,16 @@ namespace ReallifeGamemode.Server.Job
|
||||
{ 0,
|
||||
new List<Vector3>()
|
||||
{
|
||||
//new Vector3(-601.733, -2049.285, 6.090),
|
||||
//new Vector3(-598.849365234375, -2053.087646484375, 5.8428778648376465),
|
||||
new Vector3(-229.679931640625, -2049.821533203125, 27.384798049926758),
|
||||
new Vector3(-72.33480834960938, -615.8173217773438, 35.91234588623047),
|
||||
new Vector3(-176.9166717529297, -153.85665893554688, 43.38493728637695),
|
||||
new Vector3(-508.5746765136719, -261.1121826171875, 35.247962951660156),
|
||||
new Vector3(-1396.5457763671875, 51.69581604003906, 53.21350860595703),
|
||||
new Vector3(-1911.845458984375, 205.62884521484375, 84.06185150146484),
|
||||
new Vector3(-1675.4029541015625, 488.7856140136719, 128.6395721435547),
|
||||
new Vector3(-995.8155517578125, 589.4381713867188, 102.18698120117188),
|
||||
new Vector3(-314.6571350097656, 451.9184875488281, 107.99801635742188),
|
||||
new Vector3(211.09194946289062, 350.1848449707031, 105.41163635253906),
|
||||
new Vector3(599.4515380859375, 626.0756225585938, 128.6754608154297),
|
||||
new Vector3(969.324462890625, 164.03329467773438, 80.59388732910156),
|
||||
new Vector3(1069.521240234375, -763.7572631835938, 57.43597412109375),
|
||||
new Vector3(1421.075927734375, -1854.2821044921875, 70.56175994873047),
|
||||
new Vector3(268.5604248046875, -2070.274169921875, 16.816179275512695),
|
||||
new Vector3(-147.51795959472656, -1974.3182373046875, 22.48438262939453),
|
||||
new Vector3(-569.0294189453125, -2210.80908203125, 5.571292877197266),
|
||||
new Vector3(-146.62071, -2178.8228, 10.194298),
|
||||
new Vector3(14.580393, -1578.6385, 29.212185),
|
||||
new Vector3(222.91612, -1098.8556, 29.227453),
|
||||
new Vector3(246.44946, -648.45496, 39.420746),
|
||||
new Vector3(102.181, -298.95276, 46.04399),
|
||||
new Vector3(-104.91002, -606.26013, 36.06103),
|
||||
new Vector3(-288.1007, -1204.5107, 24.403156),
|
||||
new Vector3(-166.23526, -1574.4166, 35.152023),
|
||||
new Vector3(-60.337997, -1976.121, 16.486664),
|
||||
new Vector3(-599.1891, -2049.2695, 6.14637),
|
||||
}
|
||||
},
|
||||
{ 1,
|
||||
@@ -238,16 +229,15 @@ namespace ReallifeGamemode.Server.Job
|
||||
new List<Vector3>()
|
||||
{
|
||||
//new Vector3(-601.733, -2049.285, 6.090),
|
||||
new Vector3(-146.62071, -2178.8228, 9.194298),
|
||||
new Vector3(14.580393, -1578.6385, 28.212185),
|
||||
new Vector3(222.91612, -1098.8556, 28.227453),
|
||||
new Vector3(246.44946, -648.45496, 38.420746),
|
||||
new Vector3(102.181, -298.95276, 45.04399),
|
||||
new Vector3(-104.91002, -606.26013, 35.06103),
|
||||
new Vector3(-288.1007, -1204.5107, 23.403156),
|
||||
new Vector3(-166.23526, -1574.4166, 34.152023),
|
||||
new Vector3(-60.337997, -1976.121, 15.486664),
|
||||
new Vector3(-599.1891, -2049.2695, 5.14637),
|
||||
new Vector3(-566.381, -2209.74, 5.88064),
|
||||
new Vector3(769.912, -1983.54, 29.2573),
|
||||
new Vector3(1021.58, -725.525, 57.6664),
|
||||
new Vector3(244.279, -860.634, 29.5133),
|
||||
new Vector3(-506.147, -282.95, 35.4909),
|
||||
new Vector3(-1205.3, -130.106, 40.9405),
|
||||
new Vector3(-1396.98, -773.447, 20.68),
|
||||
new Vector3(-666.861, -1241.26, 10.5494),
|
||||
new Vector3(-599.541, -2054.42, 6.0372),
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -443,6 +433,14 @@ namespace ReallifeGamemode.Server.Job
|
||||
player.SendChatMessage("~y~[JOB]: ~w~Die neue Route lädt. Bitte warten...");
|
||||
string type = getPlayerRouteType(player);
|
||||
|
||||
if (type == BEGINNER)
|
||||
BusJobEvents.payWage(player, WAGE_BEGINNER);
|
||||
else if (type == INTERMEDIATE)
|
||||
BusJobEvents.payWage(player, WAGE_INTERMEDIATE);
|
||||
else if (type == PROFESSIONAL)
|
||||
BusJobEvents.payWage(player, WAGE_PROFESSIOAL);
|
||||
|
||||
|
||||
NAPI.Task.Run(() =>
|
||||
{
|
||||
if (type == BEGINNER)
|
||||
@@ -466,6 +464,7 @@ namespace ReallifeGamemode.Server.Job
|
||||
NAPI.ClientEvent.TriggerClientEventForAll("SERVER:setIndicatorStatus", veh.Handle.Value, data.Left, data.Right);
|
||||
}
|
||||
|
||||
|
||||
public void BusCheckpoint(Player player)
|
||||
{
|
||||
if (!player.IsInVehicle || player.VehicleSeat != 0) return;
|
||||
@@ -564,7 +563,7 @@ namespace ReallifeGamemode.Server.Job
|
||||
return;
|
||||
}
|
||||
|
||||
if(!playerVehiclePair.ContainsKey(player))
|
||||
if (!playerVehiclePair.ContainsKey(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -624,7 +623,7 @@ namespace ReallifeGamemode.Server.Job
|
||||
payWage(player, BusDriverJob.WAGE_PROFESSIOAL / BusDriverJob.playerRouteCurrent[player.Name].Count);
|
||||
}
|
||||
|
||||
private void payWage(Player player, int wage)
|
||||
public static void payWage(Player player, int wage)
|
||||
{
|
||||
using var dbContext = new DatabaseContext();
|
||||
User user = player.GetUser(dbContext);
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace ReallifeGamemode.Server.Job
|
||||
public void removeClientFromData(Player player)
|
||||
{
|
||||
if (client1 == player) { client1 = null; }
|
||||
if (client2 == player) { client2 = null;}
|
||||
if (client2 == player) { client2 = null; }
|
||||
}
|
||||
|
||||
public int getTrashCount()
|
||||
|
||||
@@ -122,6 +122,7 @@ namespace ReallifeGamemode.Server
|
||||
ShopManager.LoadClotheShops();
|
||||
ShopManager.LoadItemShops();
|
||||
ShopManager.LoadFriseur();
|
||||
ShopManager.LoadAmmunations();
|
||||
TuningManager.LoadTuningGarages();
|
||||
|
||||
TimeManager.StartTimeManager();
|
||||
|
||||
@@ -181,6 +181,11 @@ namespace ReallifeGamemode.Server.Managers
|
||||
ChatService.ErrorMessage(player, "Dieser Spieler ist schon in einer Fraktion");
|
||||
return;
|
||||
}
|
||||
if (targetUser?.Wanteds > 0)
|
||||
{
|
||||
player.SendNotification("~r~Du kannst diesen Spieler nicht inviten da er aktuell gesucht wird. (Wanted)", false);
|
||||
return;
|
||||
}
|
||||
|
||||
target.SetData("accept_faction_invite", player.Name);
|
||||
|
||||
@@ -486,7 +491,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
using var dbContext = new DatabaseContext();
|
||||
var user = player.GetUser(dbContext);
|
||||
|
||||
if(user.FactionId == null)
|
||||
if (user.FactionId == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -517,7 +522,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
}
|
||||
|
||||
var factionVehicleCount = dbContext.FactionVehicles.ToList().Where(v => v.Id == id && v.GetOwners().Contains(user.FactionId.Value)).Count();
|
||||
if(factionVehicleCount <= 6)
|
||||
if (factionVehicleCount <= 6)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Die Fraktion braucht mindestens 6 Fahrzeuge");
|
||||
return;
|
||||
@@ -589,86 +594,77 @@ namespace ReallifeGamemode.Server.Managers
|
||||
public void InteractionMenu_LSPD_Points3(Player player, string jsonNameOrId, string jsoAmount, string jsonReason)
|
||||
{
|
||||
string nameOrId = (string)JsonConvert.DeserializeObject(jsonNameOrId);
|
||||
int amount = Int32.Parse((string)JsonConvert.DeserializeObject(jsoAmount));
|
||||
string reason = (string)JsonConvert.DeserializeObject(jsonReason);
|
||||
Player target = PlayerService.GetPlayerByNameOrId(nameOrId);
|
||||
string playername = NAPI.Player.GetPlayerName(player);
|
||||
string targetname = NAPI.Player.GetPlayerName(target);
|
||||
|
||||
if (!int.TryParse((string)JsonConvert.DeserializeObject(jsoAmount), out int amount))
|
||||
{
|
||||
player.SendNotification("~r~Es muss eine gültige Zahl für die Punkte angegeben werden!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
else if (target.GetUser().DriverLicenseVehicle == false && target.GetUser().DriverLicenseBike == false)
|
||||
{
|
||||
player.SendNotification("~r~Spieler hat weder Auto- noch Motorradführerschein!");
|
||||
}
|
||||
else if (target == player)
|
||||
|
||||
if (target == player)
|
||||
{
|
||||
player.SendNotification("~r~Du kannst dir selbst keine Punkte setzen!");
|
||||
return;
|
||||
}
|
||||
|
||||
using var dbContext = new DatabaseContext();
|
||||
User targetUser = target.GetUser(dbContext);
|
||||
|
||||
if(targetUser == null)
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetUser.DriverLicenseVehicle == false && targetUser.DriverLicenseBike == false)
|
||||
{
|
||||
player.SendNotification("~r~Spieler hat weder Auto- noch Motorradführerschein!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (amount < -13 || amount > 13)
|
||||
{
|
||||
player.SendNotification("~r~Du kannst nur zwischen 1 und 12 Punkte verteilen!");
|
||||
return;
|
||||
}
|
||||
|
||||
targetUser.Points += amount;
|
||||
|
||||
player.SendNotification($"~w~Du hast ~y~{targetname} ~b~{amount} ~w~Strafpunkte gegeben. Grund: ~g~{reason}~w~.");
|
||||
target.SendNotification($"~b~{player.GetUser().FactionRank.RankName} | {playername} ~w~hat dir ~y~{amount} ~w~Strafpunkte gegeben.", true);
|
||||
ChatService.HQMessage(targetname + " hat von " + playername + " " + amount + " Strafpunkt(e) erhalten. Gesamt: " + targetUser.Points);
|
||||
|
||||
if (targetUser.Points < 0)
|
||||
{
|
||||
targetUser.Points = 0;
|
||||
}
|
||||
else if (targetUser.Points >= 12)
|
||||
{
|
||||
target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~r~12/12 ~x~Strafpunkten.", true);
|
||||
target.SendNotification($"~w~Dir wird ~r~Auto- ~w~und ~r~Motorradführerschein ~w~entzogen.", true); //FlashNotif
|
||||
|
||||
ChatService.HQMessage(targetname + " besitzt nun keinen Führerschein mehr.");
|
||||
|
||||
targetUser.Points = 0;
|
||||
targetUser.DriverLicenseVehicle = false;
|
||||
targetUser.DriverLicenseBike = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (amount > -13 && amount < 13)
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
User target2 = target.GetUser(dbContext);
|
||||
target2.Points += amount;
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
player.SendNotification($"~w~Du hast ~y~{targetname} ~b~{amount} ~w~Strafpunkte gegeben. Grund: ~g~{reason}~w~.");
|
||||
target.SendNotification($"~b~{player.GetUser().FactionRank.RankName} | {playername} ~w~hat dir ~y~{amount} ~w~Strafpunkte gegeben.", true);
|
||||
ChatService.BroadcastFaction("!{#8181E9}HQ: " + targetname + " hat von " + playername + " " + amount + " Strafpunkt(e) erhalten. Gesamt: " + target.GetUser().Points, new List<int>() { 1, 3 });
|
||||
if (target.GetUser().Points < 0)
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
User target2 = target.GetUser(dbContext);
|
||||
target2.Points = 0;
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
else if (target.GetUser().Points >= 12)
|
||||
{
|
||||
target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~r~12/12 ~x~Strafpunkten.", true);
|
||||
target.SendNotification($"~w~Dir wird ~r~Auto- ~w~und ~r~Motorradführerschein ~w~entzogen.", true); //FlashNotif
|
||||
ChatService.HQMessage(targetname + "hat von" + playername + " " + amount + " Strafpunkt erhalten(e). Gesamt: " + target.GetUser().Points);
|
||||
foreach (var copPlayer in NAPI.Pools.GetAllPlayers())
|
||||
{
|
||||
User copUser = copPlayer.GetUser();
|
||||
if (copUser == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (copUser.FactionId == 1 || copUser.FactionId == 3)
|
||||
{
|
||||
if (copUser.GetData<bool>("duty") == true)
|
||||
{
|
||||
ChatService.HQMessage(targetname + " besitzt nun keinen Führerschein mehr.");
|
||||
}
|
||||
}
|
||||
}
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
User target2 = target.GetUser(dbContext);
|
||||
target2.Points = 0;
|
||||
target2.DriverLicenseVehicle = false;
|
||||
target2.DriverLicenseBike = false;
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~y~{target.GetUser().Points}/12 ~x~Strafpunkten.", true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendNotification("~r~Du kannst nur zwischen 1 und 12 Punkte verteilen!");
|
||||
}
|
||||
target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~y~{targetUser.Points}/12 ~x~Strafpunkten.", true);
|
||||
}
|
||||
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
[RemoteEvent("CLIENT:InteractionMenu_Ticket")]
|
||||
|
||||
@@ -563,6 +563,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
if (iItem is IWeaponDealItem obj)
|
||||
{
|
||||
player.ClearAttachments();
|
||||
player.ClearAnimation();
|
||||
dropPosition.Z -= 1.05f;
|
||||
grndObject = NAPI.Object.CreateObject(3666746839, dropPosition, new Vector3(0, 0, r.Next(0, 360)), 255, 0);
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
VehicleStreaming.SetEngineState(player.Vehicle, false);
|
||||
}
|
||||
|
||||
player.Position = playerJobStartPosition[player];
|
||||
job.StopJob(player);
|
||||
|
||||
if (playerTimersJobVehicleRespawn.ContainsKey(player))
|
||||
|
||||
@@ -6,6 +6,7 @@ using ReallifeGamemode.Server.Shop.SevenEleven;
|
||||
using ReallifeGamemode.Server.Shop.Friseur;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Shop.Ammunation;
|
||||
|
||||
namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
@@ -29,6 +30,8 @@ namespace ReallifeGamemode.Server.Managers
|
||||
|
||||
public static List<Player> cuffPoints = new List<Player>();
|
||||
|
||||
public static List<AmmunationPoint> AmmunationPoints = new List<AmmunationPoint>();
|
||||
|
||||
public static void LoadPositionManager()
|
||||
{
|
||||
#region DutyPoints
|
||||
@@ -280,6 +283,20 @@ namespace ReallifeGamemode.Server.Managers
|
||||
NAPI.TextLabel.CreateTextLabel("24/7 - Dr\u00fccke ~y~E", s.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||
}
|
||||
|
||||
foreach (Ammunation s in ShopManager.Ammunations)
|
||||
{
|
||||
NAPI.Marker.CreateMarker(1, new Vector3(s.vector.X, s.vector.Y, s.vector.Z - 2), new Vector3(s.vector.X, s.vector.Y, s.vector.Z + 1),
|
||||
new Vector3(0, 0, 0), 2, new Color(255, 255, 255, 50), false, 0);
|
||||
NAPI.TextLabel.CreateTextLabel("Ammunation - Dr\u00fccke ~y~E", s.vector, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||
|
||||
AmmunationPoint ammuShop = new AmmunationPoint
|
||||
{
|
||||
Position = s.vector,
|
||||
Ammunation = s
|
||||
};
|
||||
AmmunationPoints.Add(ammuShop);
|
||||
}
|
||||
|
||||
#endregion Shops
|
||||
}
|
||||
|
||||
@@ -407,3 +424,9 @@ public class ElevatorPoint
|
||||
public int FactionId { get; set; }
|
||||
public string Stage { get; set; }
|
||||
}
|
||||
|
||||
public class AmmunationPoint
|
||||
{
|
||||
public Vector3 Position { get; set; }
|
||||
public Ammunation Ammunation { get; set; }
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Shop.Clothing;
|
||||
using ReallifeGamemode.Server.Shop.SevenEleven;
|
||||
using ReallifeGamemode.Server.Shop.Friseur;
|
||||
using ReallifeGamemode.Server.Shop.Ammunation;
|
||||
|
||||
namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
@@ -14,6 +15,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
public static List<ClotheShop> clotheStores = new List<ClotheShop>();
|
||||
public static List<ItemShop> itemShops = new List<ItemShop>();
|
||||
public static List<Friseur> FriseurStores = new List<Friseur>();
|
||||
public static List<Ammunation> Ammunations = new List<Ammunation>();
|
||||
|
||||
public static void LoadClotheShops()
|
||||
{
|
||||
@@ -81,5 +83,20 @@ namespace ReallifeGamemode.Server.Managers
|
||||
}
|
||||
}
|
||||
|
||||
public static void LoadAmmunations()
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
List<SavedBlip> ammunations = dbContext.Blips.ToList().FindAll(s => s.Name == "Ammunation");
|
||||
|
||||
foreach (var store in ammunations)
|
||||
{
|
||||
Vector3 pos = new Vector3(store.PositionX, store.PositionY, store.PositionZ);
|
||||
Ammunation newShop = new Ammunation(pos);
|
||||
Ammunations.Add(newShop);
|
||||
}
|
||||
NAPI.Util.ConsoleOutput($"Loading {ammunations.Count} Ammunations");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,9 @@ namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
public class VehicleManager : Script
|
||||
{
|
||||
|
||||
public static Dictionary<Vehicle, Dictionary<string, DateTime>> lastDriversInVehicle = new Dictionary<Vehicle, Dictionary<string, DateTime>>();
|
||||
|
||||
private static readonly List<string> _enabledMods = new List<string>()
|
||||
{
|
||||
"ninef",
|
||||
|
||||
40
ReallifeGamemode.Server/Shop/Ammunation/Ammunation.cs
Normal file
40
ReallifeGamemode.Server/Shop/Ammunation/Ammunation.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using Newtonsoft.Json;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
|
||||
namespace ReallifeGamemode.Server.Shop.Ammunation
|
||||
{
|
||||
public class Ammunation
|
||||
{
|
||||
public Vector3 vector { get; set; }
|
||||
public List<Weapon> weaponList = new List<Weapon>();
|
||||
|
||||
public Ammunation(Vector3 position)
|
||||
{
|
||||
this.vector = position;
|
||||
LoadWeapons();
|
||||
}
|
||||
|
||||
public void LoadWeapons()
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
weaponList = dbContext.Weapons.ToList().FindAll(w => w.AmmunationActive == true);
|
||||
}
|
||||
}
|
||||
public void LoadShopNUI(Player client)
|
||||
{
|
||||
|
||||
List<Weapon> shopWeapons = weaponList.ToList();
|
||||
client.TriggerEvent("AmmunationShop:LoadNativeUI", JsonConvert.SerializeObject(shopWeapons));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,7 @@ namespace ReallifeGamemode.Server.Wanted
|
||||
dbContext.SaveChanges();
|
||||
waTimer[user.Id] = WantedEscapeTime;
|
||||
}
|
||||
else if (!isNearCop)
|
||||
else if (!isNearCop && !player.IsAfk())
|
||||
{
|
||||
player.TriggerEvent("SERVER:SetWantedFlash", true);
|
||||
waTimer[user.Id] -= 2500;
|
||||
|
||||
@@ -196,7 +196,7 @@ namespace ReallifeGamemode.Server.WeaponDeal
|
||||
fVeh.AddAttachment("weapondeal1", false);
|
||||
fVeh.AddAttachment("weapondeal2", false);
|
||||
InventoryManager.RemoveAllItemsfromVehicleInventory(fVeh);
|
||||
int oMembers = NAPI.Pools.GetAllPlayers().Where(p => p.IsLoggedIn() && p.GetUser(context).FactionId == user.FactionId).Count();
|
||||
int oMembers = NAPI.Pools.GetAllPlayers().Where(p => !p.IsAfk() && p.IsLoggedIn() && p.GetUser(context).FactionId == user.FactionId).Count();
|
||||
|
||||
if (factionVehicle.GetOwners().Contains(8) || factionVehicle.GetOwners().Contains(7))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user