Merged group system into develop
This commit is contained in:
@@ -14,9 +14,9 @@ import moneyFormat from '../moneyformat';
|
|||||||
|
|
||||||
export default function carDealer() {
|
export default function carDealer() {
|
||||||
|
|
||||||
var shopMenu;
|
var shopMenu: NativeUI.Menu;
|
||||||
|
|
||||||
mp.events.add('ShopVehicle_OpenMenu', (businessName, price) => {
|
mp.events.add('ShopVehicle_OpenMenu', (businessName, price, availableOptions: string[]) => {
|
||||||
var veh = mp.players.local.vehicle;
|
var veh = mp.players.local.vehicle;
|
||||||
if (!veh) return;
|
if (!veh) return;
|
||||||
mp.gui.chat.show(false);
|
mp.gui.chat.show(false);
|
||||||
@@ -34,6 +34,10 @@ export default function carDealer() {
|
|||||||
priceItem.SetRightLabel("~g~$~s~ " + moneyFormat(price));
|
priceItem.SetRightLabel("~g~$~s~ " + moneyFormat(price));
|
||||||
shopMenu.AddItem(priceItem);
|
shopMenu.AddItem(priceItem);
|
||||||
|
|
||||||
|
var targetsCollection = new ItemsCollection(availableOptions);
|
||||||
|
var targetItem = new UIMenuListItem("Kaufen f<>r", "W<>hle den Besitzer aus", targetsCollection);
|
||||||
|
shopMenu.AddItem(targetItem);
|
||||||
|
|
||||||
var saveItem = new UIMenuItem("Kaufen");
|
var saveItem = new UIMenuItem("Kaufen");
|
||||||
saveItem.BackColor = new Color(0, 100, 0);
|
saveItem.BackColor = new Color(0, 100, 0);
|
||||||
saveItem.HighlightedBackColor = new Color(0, 150, 0);
|
saveItem.HighlightedBackColor = new Color(0, 150, 0);
|
||||||
@@ -48,7 +52,7 @@ export default function carDealer() {
|
|||||||
if (item === cancelItem) {
|
if (item === cancelItem) {
|
||||||
shopMenu.Close();
|
shopMenu.Close();
|
||||||
} else if (item === saveItem) {
|
} else if (item === saveItem) {
|
||||||
mp.events.callRemote("VehShop_BuyVehicle");
|
mp.events.callRemote("VehShop_BuyVehicle", targetItem.SelectedValue);
|
||||||
shopMenu.Close();
|
shopMenu.Close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
70
ReallifeGamemode.Client/Gui/cityhall.ts
Normal file
70
ReallifeGamemode.Client/Gui/cityhall.ts
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
import InputHelper from '../inputhelper';
|
||||||
|
|
||||||
|
export default function (globalData: GlobalData) {
|
||||||
|
|
||||||
|
var keyBound = false;
|
||||||
|
var menu: NativeUI.Menu = null;
|
||||||
|
|
||||||
|
mp.events.add("SERVER:CityHall_ShowHelpText", () => {
|
||||||
|
mp.game.ui.setTextComponentFormat('STRING');
|
||||||
|
mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um das Stadthallen-Menü zu öffnen');
|
||||||
|
mp.game.ui.displayHelpTextFromStringLabel(0, true, true, -1);
|
||||||
|
|
||||||
|
if (!keyBound) {
|
||||||
|
keyBound = true;
|
||||||
|
mp.keys.bind(0x45, false, keyPressHandler);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mp.events.add("SERVER:CityHall_ClearHelpText", () => {
|
||||||
|
mp.game.ui.clearHelp(false);
|
||||||
|
if (keyBound) {
|
||||||
|
mp.keys.unbind(0x45, false, keyPressHandler);
|
||||||
|
keyBound = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function keyPressHandler(): void {
|
||||||
|
if (globalData.InChat || globalData.Interaction) return;
|
||||||
|
menu = new Menu("Stadthalle", "", new Point(50, 50), null, null);
|
||||||
|
|
||||||
|
globalData.Interaction = true;
|
||||||
|
mp.gui.chat.show(false);
|
||||||
|
|
||||||
|
var groupCreateItem = new UIMenuItem("Gruppe erstellen", "Erstelle eine neue Gruppe");
|
||||||
|
groupCreateItem.SetRightLabel("~g~50.000$");
|
||||||
|
menu.AddItem(groupCreateItem);
|
||||||
|
|
||||||
|
var cancelItem = new UIMenuItem("Schließen");
|
||||||
|
cancelItem.BackColor = new Color(213, 0, 0);
|
||||||
|
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
|
||||||
|
menu.AddItem(cancelItem);
|
||||||
|
|
||||||
|
menu.ItemSelect.on((item, index) => {
|
||||||
|
if (index === 0) { // Gruppe
|
||||||
|
var input = new InputHelper("Wie soll die Gruppe heißen?");
|
||||||
|
input.show();
|
||||||
|
input.getValue((name: string) => {
|
||||||
|
mp.events.callRemote("CLIENT:CityHall_CreateGroup", name);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
menu.Close();
|
||||||
|
});
|
||||||
|
|
||||||
|
menu.MenuClose.on(() => {
|
||||||
|
globalData.Interaction = false;
|
||||||
|
mp.gui.chat.show(true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
133
ReallifeGamemode.Client/Interaction/interactionmenu.ts
Normal file
133
ReallifeGamemode.Client/Interaction/interactionmenu.ts
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
import * as NativeUI from 'NativeUI';
|
||||||
|
import InputHelper from '../inputhelper';
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
export default function (globalData: GlobalData) {
|
||||||
|
|
||||||
|
var menuClose = false;
|
||||||
|
|
||||||
|
var accountItem = new UIMenuItem("Account", "Account Informationen");
|
||||||
|
|
||||||
|
var factionItem = new UIMenuItem("Fraktion", "Verwalte deine Fraktion");
|
||||||
|
var groupItem = new UIMenuItem("Gruppe", "Verwalte deine Gruppe");
|
||||||
|
|
||||||
|
|
||||||
|
mp.events.add("SERVER:InteractionMenu_OpenMenu", (accountDataJson: string, faction: string, group: string, factionInvite: boolean, groupInvite: boolean) => {
|
||||||
|
var accountData: AccountData = JSON.parse(accountDataJson);
|
||||||
|
|
||||||
|
var menu = getInteractionMenu();
|
||||||
|
|
||||||
|
menu.AddItem(accountItem);
|
||||||
|
menu.BindMenuToItem(getAccountMenu(accountData), accountItem);
|
||||||
|
|
||||||
|
if (faction) {
|
||||||
|
factionItem.SetRightLabel(faction);
|
||||||
|
menu.AddItem(factionItem);
|
||||||
|
menu.BindMenuToItem(getFactionMenu(faction, menu), factionItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (group) {
|
||||||
|
groupItem.SetRightLabel(group);
|
||||||
|
menu.AddItem(groupItem);
|
||||||
|
menu.BindMenuToItem(getGroupMenu(group), groupItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
var items: Array<string> = new Array<string>();
|
||||||
|
if (factionInvite) items.push("Fraktion");
|
||||||
|
if (groupInvite) items.push("Gruppe");
|
||||||
|
var acceptItem: NativeUI.UIMenuListItem;
|
||||||
|
|
||||||
|
if (items.length !== 0) {
|
||||||
|
acceptItem = new UIMenuListItem("Einladung annehmen", "", new ItemsCollection(items));
|
||||||
|
menu.AddItem(acceptItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
menu.Visible = true;
|
||||||
|
mp.gui.chat.show(false);
|
||||||
|
globalData.Interaction = true;
|
||||||
|
|
||||||
|
menu.ItemSelect.on((item, index) => {
|
||||||
|
if (item === acceptItem) {
|
||||||
|
mp.events.callRemote("CLIENT:InteractionMenu_AcceptInvite", acceptItem.SelectedValue);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
menu.MenuClose.on(() => {
|
||||||
|
globalData.Interaction = false;
|
||||||
|
mp.gui.chat.show(true);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
function getInteractionMenu(): NativeUI.Menu {
|
||||||
|
return new Menu("Hauptmenü", "Interaktionen | " + mp.players.local.name, new Point(50, 50), null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAccountMenu(data: AccountData): NativeUI.Menu {
|
||||||
|
var accountMenu = new NativeUI.Menu("Account", mp.players.local.name, new Point(50, 50), null, null);
|
||||||
|
|
||||||
|
var menuItem = new UIMenuItem("Fraktion");
|
||||||
|
menuItem.SetRightLabel(data.faction);
|
||||||
|
accountMenu.AddItem(menuItem);
|
||||||
|
|
||||||
|
menuItem = new UIMenuItem("Fraktionsrang");
|
||||||
|
menuItem.SetRightLabel(data.factionRank);
|
||||||
|
accountMenu.AddItem(menuItem);
|
||||||
|
|
||||||
|
menuItem = new UIMenuItem("Gruppe");
|
||||||
|
menuItem.SetRightLabel(data.group);
|
||||||
|
accountMenu.AddItem(menuItem);
|
||||||
|
|
||||||
|
menuItem = new UIMenuItem("Gruppenrang");
|
||||||
|
menuItem.SetRightLabel(data.groupRank);
|
||||||
|
accountMenu.AddItem(menuItem);
|
||||||
|
|
||||||
|
menuItem = new UIMenuItem("Registrierungsdatum");
|
||||||
|
menuItem.SetRightLabel(data.regDate);
|
||||||
|
accountMenu.AddItem(menuItem);
|
||||||
|
|
||||||
|
menuItem = new UIMenuItem("Adminrang");
|
||||||
|
menuItem.SetRightLabel(data.adminLevel);
|
||||||
|
accountMenu.AddItem(menuItem);
|
||||||
|
|
||||||
|
accountMenu.Visible = false;
|
||||||
|
return accountMenu;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFactionMenu(faction: string, parentMenu: NativeUI.Menu): NativeUI.Menu {
|
||||||
|
var factionMenu = new NativeUI.Menu("Fraktion", faction, new Point(50, 50), null, null);
|
||||||
|
factionMenu.AddItem(new UIMenuItem("Spieler einladen"));
|
||||||
|
factionMenu.AddItem(new UIMenuItem("Spieler rauswerfen"));
|
||||||
|
factionMenu.Visible = false;
|
||||||
|
|
||||||
|
factionMenu.ItemSelect.on((item, index) => {
|
||||||
|
if (index === 0) { // Inviten
|
||||||
|
var input = new InputHelper("Welchen Spieler möchtest du inviten (Name / ID)?");
|
||||||
|
input.show();
|
||||||
|
input.getValue(name => {
|
||||||
|
mp.events.callRemote("CLIENT:InteractionMenu_InviteFaction", name);
|
||||||
|
parentMenu.Close();
|
||||||
|
});
|
||||||
|
} else if (index === 1) { // Uninviten
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return factionMenu;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getGroupMenu(group: string): NativeUI.Menu {
|
||||||
|
var groupMenu = new NativeUI.Menu("Gruppe", group, new Point(50, 50), null, null);
|
||||||
|
groupMenu.AddItem(new UIMenuItem("Spieler einladen"));
|
||||||
|
groupMenu.AddItem(new UIMenuItem("Spieler rauswerfen"));
|
||||||
|
groupMenu.Visible = false;
|
||||||
|
|
||||||
|
return groupMenu;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,135 +1,131 @@
|
|||||||
export default function freeCam() {
|
export default function () {
|
||||||
const controlsIds = {
|
var getNormalizedVector = function (vector) {
|
||||||
F5: 327,
|
var mag = Math.sqrt(
|
||||||
W: 32, // 232
|
vector.x * vector.x + vector.y * vector.y + vector.z * vector.z
|
||||||
S: 33, // 31, 219, 233, 268, 269
|
);
|
||||||
A: 34, // 234
|
vector.x = vector.x / mag;
|
||||||
D: 35, // 30, 218, 235, 266, 267
|
vector.y = vector.y / mag;
|
||||||
Space: 321,
|
vector.z = vector.z / mag;
|
||||||
LCtrl: 326
|
return vector;
|
||||||
};
|
};
|
||||||
|
var getCrossProduct = function (v1, v2) {
|
||||||
var global = {
|
var vector = new mp.Vector3(0, 0, 0);
|
||||||
gameplayCam: undefined,
|
vector.x = v1.y * v2.z - v1.z * v2.y;
|
||||||
fly: undefined
|
vector.y = v1.z * v2.x - v1.x * v2.z;
|
||||||
|
vector.z = v1.x * v2.y - v1.y * v2.x;
|
||||||
|
return vector;
|
||||||
};
|
};
|
||||||
|
var bindVirtualKeys = {
|
||||||
global.fly = {
|
F2: 0x71
|
||||||
flying: false, f: 2.0, w: 2.0, h: 2.0, point_distance: 1000, l:0
|
|
||||||
};
|
};
|
||||||
global.gameplayCam = mp.cameras.new('gameplay');
|
var bindASCIIKeys = {
|
||||||
|
Q: 69,
|
||||||
mp.game.graphics.notify('~r~Fly script loaded!');
|
E: 81,
|
||||||
mp.game.graphics.notify('~r~F5~w~ - enable/disable\n~r~F5+Space~w~ - disable without warping to ground\n~r~W/A/S/D/Space/LCtrl~w~ - move');
|
LCtrl: 17,
|
||||||
mp.game.graphics.notify('~r~/savecam~w~ - save Camera position.');
|
Shift: 16
|
||||||
|
};
|
||||||
let direction = null;
|
mp.game.graphics.notify('~r~NoClip ~w~by ~b~Morbo');
|
||||||
let coords = null;
|
var isNoClip = false;
|
||||||
|
var noClipCamera;
|
||||||
function pointingAt(distance) {
|
var shiftModifier = false;
|
||||||
const farAway = new mp.Vector3((direction.x * distance) + (coords.x), (direction.y * distance) + (coords.y), (direction.z * distance) + (coords.z));
|
var controlModifier = false;
|
||||||
|
var localPlayer = mp.players.local;
|
||||||
const result = mp.raycasting.testPointToPoint(coords, farAway, 16);
|
mp.keys.bind(bindVirtualKeys.F2, true, function () {
|
||||||
if (result === undefined) {
|
isNoClip = !isNoClip;
|
||||||
return 'undefined';
|
mp.game.ui.displayRadar(!isNoClip);
|
||||||
}
|
if (isNoClip) {
|
||||||
return result;
|
startNoClip();
|
||||||
}
|
} else {
|
||||||
|
stopNoClip();
|
||||||
mp.events.add('render', () => {
|
|
||||||
|
|
||||||
const controls = mp.game.controls;
|
|
||||||
const fly = global.fly;
|
|
||||||
direction = global.gameplayCam.getDirection();
|
|
||||||
coords = global.gameplayCam.getCoord();
|
|
||||||
|
|
||||||
coords.x = coords.x.toFixed(2);
|
|
||||||
coords.y = coords.y.toFixed(2);
|
|
||||||
coords.z = coords.z.toFixed(2);
|
|
||||||
|
|
||||||
direction.x = direction.x.toFixed(2);
|
|
||||||
direction.y = direction.y.toFixed(2);
|
|
||||||
direction.z = direction.z.toFixed(2);
|
|
||||||
|
|
||||||
//mp.game.graphics.drawText(`Coords: ${JSON.stringify(coords)}`, [0.5, 0.005], {
|
|
||||||
// font: 0,
|
|
||||||
// color: [255, 255, 255, 185],
|
|
||||||
// scale: [0.3, 0.3],
|
|
||||||
// outline: true,
|
|
||||||
// centre: false
|
|
||||||
//});
|
|
||||||
|
|
||||||
if (controls.isControlJustPressed(0, controlsIds.F5)) {
|
|
||||||
fly.flying = !fly.flying;
|
|
||||||
|
|
||||||
const player = mp.players.local;
|
|
||||||
|
|
||||||
player.setInvincible(fly.flying);
|
|
||||||
player.freezePosition(fly.flying);
|
|
||||||
player.setAlpha(fly.flying ? 0 : 255);
|
|
||||||
|
|
||||||
if (!fly.flying && !controls.isControlPressed(0, controlsIds.Space)) {
|
|
||||||
const position = mp.players.local.position;
|
|
||||||
position.z = mp.game.gameplay.getGroundZFor3dCoord(position.x, position.y, position.z, 0.0, false);
|
|
||||||
mp.players.local.setCoordsNoOffset(position.x, position.y, position.z, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
mp.game.graphics.notify(fly.flying ? 'Fly: ~g~Enabled' : 'Fly: ~r~Disabled');
|
|
||||||
} else if (fly.flying) {
|
|
||||||
let updated = false;
|
|
||||||
const position = mp.players.local.position;
|
|
||||||
|
|
||||||
if (controls.isControlPressed(0, controlsIds.W)) {
|
|
||||||
if (fly.f < 8.0) { fly.f *= 1.025; }
|
|
||||||
|
|
||||||
position.x += direction.x * fly.f;
|
|
||||||
position.y += direction.y * fly.f;
|
|
||||||
position.z += direction.z * fly.f;
|
|
||||||
updated = true;
|
|
||||||
} else if (controls.isControlPressed(0, controlsIds.S)) {
|
|
||||||
if (fly.f < 8.0) { fly.f *= 1.025; }
|
|
||||||
|
|
||||||
position.x -= direction.x * fly.f;
|
|
||||||
position.y -= direction.y * fly.f;
|
|
||||||
position.z -= direction.z * fly.f;
|
|
||||||
updated = true;
|
|
||||||
} else {
|
|
||||||
fly.f = 2.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (controls.isControlPressed(0, controlsIds.A)) {
|
|
||||||
if (fly.l < 8.0) { fly.l *= 1.025; }
|
|
||||||
|
|
||||||
position.x += (-direction.y) * fly.l;
|
|
||||||
position.y += direction.x * fly.l;
|
|
||||||
updated = true;
|
|
||||||
} else if (controls.isControlPressed(0, controlsIds.D)) {
|
|
||||||
if (fly.l < 8.0) { fly.l *= 1.05; }
|
|
||||||
|
|
||||||
position.x -= -direction.y * fly.l;
|
|
||||||
position.y -= direction.x * fly.l;
|
|
||||||
updated = true;
|
|
||||||
} else {
|
|
||||||
fly.l = 2.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (controls.isControlPressed(0, controlsIds.Space)) {
|
|
||||||
if (fly.h < 8.0) { fly.h *= 1.025; }
|
|
||||||
|
|
||||||
position.z += fly.h;
|
|
||||||
updated = true;
|
|
||||||
} else if (controls.isControlPressed(0, controlsIds.LCtrl)) {
|
|
||||||
if (fly.h < 8.0) { fly.h *= 1.05; }
|
|
||||||
|
|
||||||
position.z -= fly.h;
|
|
||||||
updated = true;
|
|
||||||
} else {
|
|
||||||
fly.h = 2.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (updated) {
|
|
||||||
mp.players.local.setCoordsNoOffset(position.x, position.y, position.z, 0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
function startNoClip() {
|
||||||
|
mp.game.graphics.notify('NoClip ~g~activated');
|
||||||
|
var camPos = new mp.Vector3(
|
||||||
|
localPlayer.position.x,
|
||||||
|
localPlayer.position.y,
|
||||||
|
localPlayer.position.z
|
||||||
|
);
|
||||||
|
var camRot = mp.game.cam.getGameplayCamRot(2);
|
||||||
|
noClipCamera = mp.cameras.new('default', camPos, camRot, 45);
|
||||||
|
noClipCamera.setActive(true);
|
||||||
|
mp.game.cam.renderScriptCams(true, false, 0, true, false);
|
||||||
|
localPlayer.freezePosition(true);
|
||||||
|
localPlayer.setInvincible(true);
|
||||||
|
localPlayer.setVisible(false, false);
|
||||||
|
localPlayer.setCollision(false, false);
|
||||||
|
}
|
||||||
|
function stopNoClip() {
|
||||||
|
mp.game.graphics.notify('NoClip ~r~disabled');
|
||||||
|
if (noClipCamera) {
|
||||||
|
localPlayer.position = noClipCamera.getCoord();
|
||||||
|
localPlayer.setHeading(noClipCamera.getRot(2).z);
|
||||||
|
noClipCamera.destroy(true);
|
||||||
|
noClipCamera = null;
|
||||||
|
}
|
||||||
|
mp.game.cam.renderScriptCams(false, false, 0, true, false);
|
||||||
|
localPlayer.freezePosition(false);
|
||||||
|
localPlayer.setInvincible(false);
|
||||||
|
localPlayer.setVisible(true, false);
|
||||||
|
localPlayer.setCollision(true, false);
|
||||||
|
}
|
||||||
|
mp.events.add('render', function () {
|
||||||
|
if (!noClipCamera || mp.gui.cursor.visible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
controlModifier = mp.keys.isDown(bindASCIIKeys.LCtrl);
|
||||||
|
shiftModifier = mp.keys.isDown(bindASCIIKeys.Shift);
|
||||||
|
var rot = noClipCamera.getRot(2);
|
||||||
|
var fastMult = 1;
|
||||||
|
var slowMult = 1;
|
||||||
|
if (shiftModifier) {
|
||||||
|
fastMult = 3;
|
||||||
|
} else if (controlModifier) {
|
||||||
|
slowMult = 0.5;
|
||||||
|
}
|
||||||
|
var rightAxisX = mp.game.controls.getDisabledControlNormal(0, 220);
|
||||||
|
var rightAxisY = mp.game.controls.getDisabledControlNormal(0, 221);
|
||||||
|
var leftAxisX = mp.game.controls.getDisabledControlNormal(0, 218);
|
||||||
|
var leftAxisY = mp.game.controls.getDisabledControlNormal(0, 219);
|
||||||
|
var pos = noClipCamera.getCoord();
|
||||||
|
var rr = noClipCamera.getDirection();
|
||||||
|
var vector = new mp.Vector3(0, 0, 0);
|
||||||
|
vector.x = rr.x * leftAxisY * fastMult * slowMult;
|
||||||
|
vector.y = rr.y * leftAxisY * fastMult * slowMult;
|
||||||
|
vector.z = rr.z * leftAxisY * fastMult * slowMult;
|
||||||
|
var upVector = new mp.Vector3(0, 0, 1);
|
||||||
|
var rightVector = getCrossProduct(
|
||||||
|
getNormalizedVector(rr),
|
||||||
|
getNormalizedVector(upVector)
|
||||||
|
);
|
||||||
|
rightVector.x *= leftAxisX * 0.5;
|
||||||
|
rightVector.y *= leftAxisX * 0.5;
|
||||||
|
rightVector.z *= leftAxisX * 0.5;
|
||||||
|
var upMovement = 0.0;
|
||||||
|
if (mp.keys.isDown(bindASCIIKeys.Q)) {
|
||||||
|
upMovement = 0.5;
|
||||||
|
}
|
||||||
|
var downMovement = 0.0;
|
||||||
|
if (mp.keys.isDown(bindASCIIKeys.E)) {
|
||||||
|
downMovement = 0.5;
|
||||||
|
}
|
||||||
|
mp.players.local.position = new mp.Vector3(
|
||||||
|
pos.x + vector.x + 1,
|
||||||
|
pos.y + vector.y + 1,
|
||||||
|
pos.z + vector.z + 1
|
||||||
|
);
|
||||||
|
mp.players.local.heading = rr.z;
|
||||||
|
noClipCamera.setCoord(
|
||||||
|
pos.x - vector.x + rightVector.x,
|
||||||
|
pos.y - vector.y + rightVector.y,
|
||||||
|
pos.z - vector.z + rightVector.z + upMovement - downMovement
|
||||||
|
);
|
||||||
|
noClipCamera.setRot(
|
||||||
|
rot.x + rightAxisY * -5.0,
|
||||||
|
0.0,
|
||||||
|
rot.z + rightAxisX * -5.0,
|
||||||
|
2
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
9
ReallifeGamemode.Client/global.d.ts
vendored
9
ReallifeGamemode.Client/global.d.ts
vendored
@@ -6,6 +6,15 @@
|
|||||||
LoggedIn: boolean
|
LoggedIn: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare interface AccountData {
|
||||||
|
regDate: string;
|
||||||
|
adminLevel: string;
|
||||||
|
faction: string;
|
||||||
|
factionRank: string;
|
||||||
|
group: string;
|
||||||
|
groupRank: string;
|
||||||
|
}
|
||||||
|
|
||||||
declare interface FactionRanks {
|
declare interface FactionRanks {
|
||||||
factionId: number,
|
factionId: number,
|
||||||
ranks: FactionRank[]
|
ranks: FactionRank[]
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ let globalData: GlobalData = {
|
|||||||
LoggedIn: false
|
LoggedIn: false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
import cityHall from './Gui/cityhall';
|
||||||
|
cityHall(globalData);
|
||||||
|
|
||||||
import adminSpeed from './admin/aspeed';
|
import adminSpeed from './admin/aspeed';
|
||||||
adminSpeed();
|
adminSpeed();
|
||||||
|
|
||||||
@@ -69,6 +72,9 @@ worldInteraction();
|
|||||||
import playerInteraction from './Interaction/playerinteraction';
|
import playerInteraction from './Interaction/playerinteraction';
|
||||||
playerInteraction(globalData);
|
playerInteraction(globalData);
|
||||||
|
|
||||||
|
import interactionMenu from './Interaction/interactionmenu';
|
||||||
|
interactionMenu(globalData);
|
||||||
|
|
||||||
import Login from './Login/main';
|
import Login from './Login/main';
|
||||||
Login(globalData);
|
Login(globalData);
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
export default class InputHelper {
|
export default class InputHelper {
|
||||||
title: string;
|
private title: string;
|
||||||
value: string;
|
private value: string;
|
||||||
created: boolean;
|
private created: boolean;
|
||||||
browser: BrowserMp;
|
private browser: BrowserMp;
|
||||||
|
|
||||||
constructor(title: string) {
|
constructor(title: string) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
mp.events.add('render', this.disableControls);
|
mp.events.add('render', this.disableControls);
|
||||||
}
|
}
|
||||||
|
|
||||||
disableControls() {
|
private disableControls() {
|
||||||
for (var i = 0; i <= 33; i++) {
|
for (var i = 0; i <= 33; i++) {
|
||||||
mp.game.controls.disableAllControlActions(i);
|
mp.game.controls.disableAllControlActions(i);
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
this.browser = mp.browsers.new('package://assets/html/inputhelper/index.html');
|
this.browser = mp.browsers.new('package://assets/html/inputhelper/index.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
finish() {
|
private finish() {
|
||||||
if (this.browser) {
|
if (this.browser) {
|
||||||
mp.events.remove('cef_inputhelper_sendvalue');
|
mp.events.remove('cef_inputhelper_sendvalue');
|
||||||
mp.events.remove('cef_request_title');
|
mp.events.remove('cef_request_title');
|
||||||
@@ -45,16 +45,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cefTitleCall() {
|
private cefTitleCall() {
|
||||||
this.browser.execute(`setTitle('${this.title}')`);
|
this.browser.execute(`setTitle('${this.title}')`);
|
||||||
}
|
}
|
||||||
|
|
||||||
cefCallback(val) {
|
private cefCallback(val) {
|
||||||
this.value = val;
|
this.value = val;
|
||||||
this.finish();
|
this.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
valueGetter() {
|
private valueGetter(): Promise<string> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
if (this.value !== undefined) resolve(this.value);
|
if (this.value !== undefined) resolve(this.value);
|
||||||
|
|||||||
33
ReallifeGamemode.Client/package-lock.json
generated
33
ReallifeGamemode.Client/package-lock.json
generated
@@ -349,8 +349,9 @@
|
|||||||
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ=="
|
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ=="
|
||||||
},
|
},
|
||||||
"NativeUI": {
|
"NativeUI": {
|
||||||
"version": "git+https://github.com/sprayzcs/RageMP-NativeUI.git#0ca40b56d9124056ceb9ca016d209aa4e3ecfeb3",
|
"version": "https://github.com/sprayzcs/RageMP-NativeUI/tarball/master",
|
||||||
"from": "git+https://github.com/sprayzcs/RageMP-NativeUI.git#master"
|
"integrity": "sha512-iG7Cym2lnzuiwNBY6ATvSoaQ5Pfs4p8hW0s2EYL7MhPYrCpVhr/5zZOvQHijTV4gv5bipPtnuT0c1k4pkrlFZA==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"acorn": {
|
"acorn": {
|
||||||
"version": "6.1.1",
|
"version": "6.1.1",
|
||||||
@@ -1565,13 +1566,11 @@
|
|||||||
},
|
},
|
||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"bundled": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"brace-expansion": {
|
"brace-expansion": {
|
||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"balanced-match": "^1.0.0",
|
"balanced-match": "^1.0.0",
|
||||||
"concat-map": "0.0.1"
|
"concat-map": "0.0.1"
|
||||||
@@ -1584,18 +1583,15 @@
|
|||||||
},
|
},
|
||||||
"code-point-at": {
|
"code-point-at": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"bundled": true,
|
"bundled": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"concat-map": {
|
"concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"bundled": true,
|
"bundled": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"console-control-strings": {
|
"console-control-strings": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"bundled": true,
|
"bundled": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"core-util-is": {
|
"core-util-is": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
@@ -1698,8 +1694,7 @@
|
|||||||
},
|
},
|
||||||
"inherits": {
|
"inherits": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"bundled": true,
|
"bundled": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"ini": {
|
"ini": {
|
||||||
"version": "1.3.5",
|
"version": "1.3.5",
|
||||||
@@ -1709,7 +1704,6 @@
|
|||||||
"is-fullwidth-code-point": {
|
"is-fullwidth-code-point": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"number-is-nan": "^1.0.0"
|
"number-is-nan": "^1.0.0"
|
||||||
}
|
}
|
||||||
@@ -1722,20 +1716,17 @@
|
|||||||
"minimatch": {
|
"minimatch": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "0.0.8",
|
"version": "0.0.8",
|
||||||
"bundled": true,
|
"bundled": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"minipass": {
|
"minipass": {
|
||||||
"version": "2.3.5",
|
"version": "2.3.5",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"safe-buffer": "^5.1.2",
|
"safe-buffer": "^5.1.2",
|
||||||
"yallist": "^3.0.0"
|
"yallist": "^3.0.0"
|
||||||
@@ -1752,7 +1743,6 @@
|
|||||||
"mkdirp": {
|
"mkdirp": {
|
||||||
"version": "0.5.1",
|
"version": "0.5.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"minimist": "0.0.8"
|
"minimist": "0.0.8"
|
||||||
}
|
}
|
||||||
@@ -1825,8 +1815,7 @@
|
|||||||
},
|
},
|
||||||
"number-is-nan": {
|
"number-is-nan": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"bundled": true,
|
"bundled": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"object-assign": {
|
"object-assign": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.1",
|
||||||
@@ -1836,7 +1825,6 @@
|
|||||||
"once": {
|
"once": {
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
}
|
}
|
||||||
@@ -1942,7 +1930,6 @@
|
|||||||
"string-width": {
|
"string-width": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"code-point-at": "^1.0.0",
|
"code-point-at": "^1.0.0",
|
||||||
"is-fullwidth-code-point": "^1.0.0",
|
"is-fullwidth-code-point": "^1.0.0",
|
||||||
|
|||||||
@@ -3,13 +3,11 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/ragemp-c": "git+https://github.com/sprayzcs/types-ragemp-c.git#master",
|
"@types/ragemp-c": "git+https://github.com/sprayzcs/types-ragemp-c.git#master",
|
||||||
|
"NativeUI": "https://github.com/sprayzcs/RageMP-NativeUI/tarball/master",
|
||||||
"copy-webpack-plugin": "^5.0.1",
|
"copy-webpack-plugin": "^5.0.1",
|
||||||
"uglifyjs-webpack-plugin": "^2.1.2"
|
"uglifyjs-webpack-plugin": "^2.1.2",
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@babel/core": "^7.3.4",
|
"@babel/core": "^7.3.4",
|
||||||
"@types/node": "^11.9.5",
|
"@types/node": "^11.9.5",
|
||||||
"NativeUI": "git+https://github.com/sprayzcs/RageMP-NativeUI.git#master",
|
|
||||||
"babel-loader": "^8.0.5",
|
"babel-loader": "^8.0.5",
|
||||||
"ts-loader": "^5.3.3",
|
"ts-loader": "^5.3.3",
|
||||||
"typescript": "^3.3.3333",
|
"typescript": "^3.3.3333",
|
||||||
@@ -19,5 +17,10 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"watch": "webpack --watch --config webpack.config.development.js",
|
"watch": "webpack --watch --config webpack.config.development.js",
|
||||||
"build:server": "webpack --config webpack.config.build.js"
|
"build:server": "webpack --config webpack.config.build.js"
|
||||||
|
},
|
||||||
|
"-vs-binding": {
|
||||||
|
"ProjectOpened": [
|
||||||
|
"watch"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ namespace ReallifeGamemode.Server.Business
|
|||||||
|
|
||||||
public User GetOwner(DatabaseContext dbContext = null)
|
public User GetOwner(DatabaseContext dbContext = null)
|
||||||
{
|
{
|
||||||
if(dbContext == null)
|
if (dbContext == null)
|
||||||
{
|
{
|
||||||
using (dbContext = new DatabaseContext())
|
using (dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
IItem iItem = InventoryManager.GetItemByName(item);
|
IItem iItem = InventoryManager.GetItemByName(item);
|
||||||
|
|
||||||
if(iItem == null)
|
if (iItem == null)
|
||||||
{
|
{
|
||||||
player.SendChatMessage("Dieses Essen existiert nicht.");
|
player.SendChatMessage("Dieses Essen existiert nicht.");
|
||||||
return;
|
return;
|
||||||
@@ -46,13 +46,13 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
List<UserItem> itemList = player.GetUser().GetItems();
|
List<UserItem> itemList = player.GetUser().GetItems();
|
||||||
UserItem eatItem = itemList.FirstOrDefault(i => i.ItemId == iItem.Id);
|
UserItem eatItem = itemList.FirstOrDefault(i => i.ItemId == iItem.Id);
|
||||||
|
|
||||||
if(eatItem == null)
|
if (eatItem == null)
|
||||||
{
|
{
|
||||||
player.SendChatMessage("Du hast dieses Item nicht");
|
player.SendChatMessage("Du hast dieses Item nicht");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(iItem is IUsableItem usableItemObj)
|
if (iItem is IUsableItem usableItemObj)
|
||||||
{
|
{
|
||||||
usableItemObj.Use(eatItem);
|
usableItemObj.Use(eatItem);
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
if (receiverUser == null)
|
if (receiverUser == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Diese Fraktion existiert nicht.");
|
ChatService.Error(player, "Diese Fraktion existiert nicht");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,7 +229,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
if (target == player)
|
if (target == player)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Du kannst dir nicht selber zuflüstern.");
|
ChatService.Error(player, "Du kannst dir nicht selber zuflüstern");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,7 +339,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var gotoString = "";
|
var gotoString = "";
|
||||||
using(var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
foreach (GotoPoint point in dbContext.GotoPoints)
|
foreach (GotoPoint point in dbContext.GotoPoints)
|
||||||
{
|
{
|
||||||
@@ -610,20 +610,20 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
user = dbContext.Users.FirstOrDefault(u => u.Name == userName);
|
user = dbContext.Users.FirstOrDefault(u => u.Name == userName);
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(admin, "Dieser Spieler existiert nicht.");
|
ChatService.Error(admin, "Dieser Spieler existiert nicht");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user.BanId == null)
|
if (user.BanId == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(admin, "Dieser Spieler ist nicht gebannt.");
|
ChatService.Error(admin, "Dieser Spieler ist nicht gebannt");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ban ban = dbContext.Bans.FirstOrDefault(b => b.Id == user.BanId);
|
Ban ban = dbContext.Bans.FirstOrDefault(b => b.Id == user.BanId);
|
||||||
if (ban == null)
|
if (ban == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(admin, "Dieser Spieler ist nicht gebannt.");
|
ChatService.Error(admin, "Dieser Spieler ist nicht gebannt");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -636,7 +636,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
int currentTimestamp = (int)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
|
int currentTimestamp = (int)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
|
||||||
if (ban.UntilDateTime < currentTimestamp)
|
if (ban.UntilDateTime < currentTimestamp)
|
||||||
{
|
{
|
||||||
ChatService.Error(admin, "Dieser Spieler ist nicht gebannt.");
|
ChatService.Error(admin, "Dieser Spieler ist nicht gebannt");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -659,9 +659,9 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
{
|
{
|
||||||
GotoPoint p = dbContext.GotoPoints.FirstOrDefault(x => x.Description == location);
|
GotoPoint p = dbContext.GotoPoints.FirstOrDefault(x => x.Description == location);
|
||||||
|
|
||||||
if(p == null)
|
if (p == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieser Goto-Punkt existiert nicht.");
|
ChatService.Error(player, "Dieser Goto-Punkt existiert nicht");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -687,7 +687,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
if (target == player)
|
if (target == player)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Du kannst dich nicht selber spectaten.");
|
ChatService.Error(player, "Du kannst dich nicht selber spectaten");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -757,9 +757,9 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vehicle v = VehicleManager.GetVehicleFromId(vehid);
|
Vehicle v = VehicleManager.GetVehicleFromId(vehid);
|
||||||
if(v == null)
|
if (v == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieses Fahrzeug existiert nicht.");
|
ChatService.Error(player, "Dieses Fahrzeug existiert nicht");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -778,7 +778,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
Vehicle v = VehicleManager.GetVehicleFromId(vehid);
|
Vehicle v = VehicleManager.GetVehicleFromId(vehid);
|
||||||
if (v == null)
|
if (v == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieses Fahrzeug existiert nicht.");
|
ChatService.Error(player, "Dieses Fahrzeug existiert nicht");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -864,7 +864,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
public void CmdAdminVeh(Client player, string hash, int color1 = 111, int color2 = 111)
|
public void CmdAdminVeh(Client player, string hash, int color1 = 111, int color2 = 111)
|
||||||
{
|
{
|
||||||
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN3) ?? true)
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN3) ?? true)
|
||||||
//TODO: Bestimmte Autos nur ab Adminlevel 1337, "normale Fahrzeuge" schon ab Adminlevel 3.
|
//TODO: Bestimmte Autos nur ab Adminlevel 1337, "normale Fahrzeuge" schon ab Adminlevel 3.
|
||||||
{
|
{
|
||||||
ChatService.NotAuthorized(player);
|
ChatService.NotAuthorized(player);
|
||||||
return;
|
return;
|
||||||
@@ -872,16 +872,16 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
if (player.IsInVehicle) // Man darf keine Autos erstellen, wenn man selbst in einem sitzt (verhindert Bugs)
|
if (player.IsInVehicle) // Man darf keine Autos erstellen, wenn man selbst in einem sitzt (verhindert Bugs)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Du sitzt momentan schon in einem Fahrzeug.");
|
ChatService.Error(player, "Du sitzt momentan schon in einem Fahrzeug");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!uint.TryParse(hash, out uint uHash))
|
if (!uint.TryParse(hash, out uint uHash))
|
||||||
uHash = NAPI.Util.GetHashKey(hash);
|
uHash = NAPI.Util.GetHashKey(hash);
|
||||||
|
|
||||||
if(!VehicleManager.IsValidHash(uHash))
|
if (!VehicleManager.IsValidHash(uHash))
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieses Fahrzeug existiert nicht.");
|
ChatService.Error(player, "Dieses Fahrzeug existiert nicht");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -902,7 +902,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
if (!player.IsInVehicle)
|
if (!player.IsInVehicle)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Du sitzt momentan nicht in einem Fahrzeug.");
|
ChatService.Error(player, "Du sitzt momentan nicht in einem Fahrzeug");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.Vehicle.Repair();
|
player.Vehicle.Repair();
|
||||||
@@ -931,15 +931,15 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
targetVeh = VehicleManager.GetVehicleFromId(vid);
|
targetVeh = VehicleManager.GetVehicleFromId(vid);
|
||||||
if(targetVeh == null)
|
if (targetVeh == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieses Fahrzeug existiert nicht.");
|
ChatService.Error(player, "Dieses Fahrzeug existiert nicht");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerVehicle veh = VehicleManager.GetServerVehicleFromVehicle(targetVeh);
|
ServerVehicle veh = VehicleManager.GetServerVehicleFromVehicle(targetVeh);
|
||||||
if(veh != null)
|
if (veh != null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieses Fahrzeug wird von einem Server-System benutzt: ~m~" + veh.GetType().Name);
|
ChatService.Error(player, "Dieses Fahrzeug wird von einem Server-System benutzt: ~m~" + veh.GetType().Name);
|
||||||
return;
|
return;
|
||||||
@@ -959,7 +959,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
if (!player.IsInVehicle)
|
if (!player.IsInVehicle)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Du sitzt momentan nicht in einem Fahrzeug.");
|
ChatService.Error(player, "Du sitzt momentan nicht in einem Fahrzeug");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -979,7 +979,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
if (!player.IsInVehicle)
|
if (!player.IsInVehicle)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Du sitzt momentan in keinem Fahrzeug!");
|
ChatService.Error(player, "Du sitzt momentan in keinem Fahrzeug");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -999,7 +999,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
if (ammo <= 0)
|
if (ammo <= 0)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Es muss mindestens 1 Munition vergeben werden.");
|
ChatService.Error(player, "Es muss mindestens 1 Munition vergeben werden");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1014,7 +1014,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
if (wHash == default)
|
if (wHash == default)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Diese Waffe existiert nicht.");
|
ChatService.Error(player, "Diese Waffe existiert nicht");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1040,7 +1040,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
if (target.Health != 0)
|
if (target.Health != 0)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Der Spieler ist nicht tot.");
|
ChatService.Error(player, "Der Spieler ist nicht tot");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
target.TriggerEvent("onPlayerRevived");
|
target.TriggerEvent("onPlayerRevived");
|
||||||
@@ -1155,7 +1155,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
using (var context = new DatabaseContext())
|
using (var context = new DatabaseContext())
|
||||||
{
|
{
|
||||||
List<UserItem> userItems = context.UserItems.ToList().FindAll(i => i.UserId == target.GetUser().Id);
|
List<UserItem> userItems = context.UserItems.ToList().FindAll(i => i.UserId == target.GetUser().Id);
|
||||||
foreach(var uItem in userItems)
|
foreach (var uItem in userItems)
|
||||||
{
|
{
|
||||||
invWeight += uItem.Amount * InventoryManager.GetItemById(uItem.ItemId).Gewicht;
|
invWeight += uItem.Amount * InventoryManager.GetItemById(uItem.ItemId).Gewicht;
|
||||||
}
|
}
|
||||||
@@ -1202,7 +1202,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(player.GetData("editmode") == false)
|
if (player.GetData("editmode") == false)
|
||||||
{
|
{
|
||||||
player.SetData("editmode", true);
|
player.SetData("editmode", true);
|
||||||
player.SendNotification("Edit-Mode ~g~aktiviert");
|
player.SendNotification("Edit-Mode ~g~aktiviert");
|
||||||
@@ -1250,7 +1250,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
if (!player.IsInVehicle)
|
if (!player.IsInVehicle)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Du sitzt momentan nicht in einem Fahrzeug.");
|
ChatService.Error(player, "Du sitzt momentan nicht in einem Fahrzeug");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1268,7 +1268,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
if (!player.IsInVehicle)
|
if (!player.IsInVehicle)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Du sitzt momentan nicht in einem Fahrzeug.");
|
ChatService.Error(player, "Du sitzt momentan nicht in einem Fahrzeug");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1288,7 +1288,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
if (!player.IsInVehicle)
|
if (!player.IsInVehicle)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Du sitzt momentan nicht in einem Fahrzeug.");
|
ChatService.Error(player, "Du sitzt momentan nicht in einem Fahrzeug");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1409,7 +1409,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
if (wHash == default)
|
if (wHash == default)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Diese Waffe existiert nicht.");
|
ChatService.Error(player, "Diese Waffe existiert nicht");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1433,13 +1433,13 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hour > 23 || min > 59 || sec > 59)
|
if (hour > 23 || min > 59 || sec > 59)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Es wurde eine ungültige Zeit eingegeben.");
|
ChatService.Error(player, "Es wurde eine ungültige Zeit eingegeben");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hour == -1)
|
if (hour == -1)
|
||||||
{
|
{
|
||||||
player.SendChatMessage("Es wird nun wieder die Echtzeit genutzt.");
|
player.SendChatMessage("Es wird nun wieder die Echtzeit genutzt.");
|
||||||
TimeManager.StartTimeManager();
|
TimeManager.StartTimeManager();
|
||||||
@@ -1475,7 +1475,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
Entities.Faction f = dbContext.Factions.FirstOrDefault(x => x.Id == faction);
|
Entities.Faction f = dbContext.Factions.FirstOrDefault(x => x.Id == faction);
|
||||||
if (f == null && faction != 0)
|
if (f == null && faction != 0)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Diese Fraktion existiert nicht (Liste: ~m~/factionlist).");
|
ChatService.Error(player, "Diese Fraktion existiert nicht (Liste: ~m~/factionlist~s~)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1526,7 +1526,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
Entities.Faction f = dbContext.Factions.FirstOrDefault(x => x.Id == faction);
|
Entities.Faction f = dbContext.Factions.FirstOrDefault(x => x.Id == faction);
|
||||||
if (f == null)
|
if (f == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Diese Fraktion existiert nicht (Liste: ~m~/factionlist).");
|
ChatService.Error(player, "Diese Fraktion existiert nicht (Liste: ~m~/factionlist~s~)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1618,28 +1618,28 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
case "svehicle":
|
case "svehicle":
|
||||||
if (player.IsInVehicle)
|
if (player.IsInVehicle)
|
||||||
{
|
{
|
||||||
if(option1 == null || option2 == null)
|
if (option1 == null || option2 == null)
|
||||||
{
|
{
|
||||||
player.SendChatMessage("~m~Benutzung: ~s~/save SVehicle [Carshop Business ID] [Preis]");
|
player.SendChatMessage("~m~Benutzung: ~s~/save SVehicle [Carshop Business ID] [Preis]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!int.TryParse(option1, out int businessId) || !int.TryParse(option2, out int price))
|
if (!int.TryParse(option1, out int businessId) || !int.TryParse(option2, out int price))
|
||||||
{
|
{
|
||||||
player.SendChatMessage("~m~Benutzung: ~s~/save SVehicle [Carshop Business ID] [Preis]");
|
player.SendChatMessage("~m~Benutzung: ~s~/save SVehicle [Carshop Business ID] [Preis]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BusinessBase business = BusinessManager.GetBusiness(businessId);
|
BusinessBase business = BusinessManager.GetBusiness(businessId);
|
||||||
if(business == null)
|
if (business == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieses Business existiert nicht.");
|
ChatService.Error(player, "Dieses Business existiert nicht");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(business is CarDealerBusinessBase))
|
if (!(business is CarDealerBusinessBase))
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieses Business ist kein Fahrzeug-Business.");
|
ChatService.Error(player, "Dieses Business ist kein Fahrzeug-Business");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1666,23 +1666,23 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(type.ToLower())
|
switch (type.ToLower())
|
||||||
{
|
{
|
||||||
case "vehicle":
|
case "vehicle":
|
||||||
if(!player.IsInVehicle)
|
if (!player.IsInVehicle)
|
||||||
{
|
{
|
||||||
player.SendChatMessage("~m~Du sitzt in keinem Fahrzeug!");
|
player.SendChatMessage("~m~Du sitzt in keinem Fahrzeug!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerVehicle veh = player.Vehicle.GetServerVehicle();
|
ServerVehicle veh = player.Vehicle.GetServerVehicle();
|
||||||
if(veh == null)
|
if (veh == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieses Fahrzeug wird nicht von einem Server-System genutzt.");
|
ChatService.Error(player, "Dieses Fahrzeug wird nicht von einem Server-System genutzt");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(option.ToLower() != "yes")
|
if (option.ToLower() != "yes")
|
||||||
{
|
{
|
||||||
player.SendChatMessage("Bist du sicher, dass du folgendes Fahrzeug löschen willst: ~m~" + veh.ToString() + " ~s~?");
|
player.SendChatMessage("Bist du sicher, dass du folgendes Fahrzeug löschen willst: ~m~" + veh.ToString() + " ~s~?");
|
||||||
player.SendChatMessage("Falls ~g~Ja~s~, nutze ~y~/remove vehicle yes");
|
player.SendChatMessage("Falls ~g~Ja~s~, nutze ~y~/remove vehicle yes");
|
||||||
@@ -1699,7 +1699,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "goto":
|
case "goto":
|
||||||
if(option == "")
|
if (option == "")
|
||||||
{
|
{
|
||||||
player.SendChatMessage("~m~Benutzung: ~s~/remove [Goto] [Punkt]");
|
player.SendChatMessage("~m~Benutzung: ~s~/remove [Goto] [Punkt]");
|
||||||
return;
|
return;
|
||||||
@@ -1712,9 +1712,9 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
using (var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
GotoPoint p = dbContext.GotoPoints.FirstOrDefault(x => x.Description == option);
|
GotoPoint p = dbContext.GotoPoints.FirstOrDefault(x => x.Description == option);
|
||||||
if(p == null)
|
if (p == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieser Goto-Punkt existiert nicht.");
|
ChatService.Error(player, "Dieser Goto-Punkt existiert nicht");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1969,7 +1969,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
Entities.Faction f = context.Factions.FirstOrDefault(id => id.Id == factionID);
|
Entities.Faction f = context.Factions.FirstOrDefault(id => id.Id == factionID);
|
||||||
if (f == null)
|
if (f == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Diese Fraktion existiert nicht (Liste: ~m~/factionlist).");
|
ChatService.Error(player, "Diese Fraktion existiert nicht (Liste: ~m~/factionlist~s~)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2017,7 +2017,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieses Wetter existiert nicht.");
|
ChatService.Error(player, "Dieses Wetter existiert nicht");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2047,7 +2047,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
if (!player.IsInVehicle)
|
if (!player.IsInVehicle)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Du sitzt momentan nicht in einem Fahrzeug.");
|
ChatService.Error(player, "Du sitzt momentan nicht in einem Fahrzeug");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2119,26 +2119,26 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(target.GetUser().BusinessId != null)
|
if (target.GetUser().BusinessId != null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Der Spieler besitzt momentan schon ein Business: ~o~" + BusinessManager.GetBusiness(target.GetUser().BusinessId).Name);
|
ChatService.Error(player, "Der Spieler besitzt momentan schon ein Business: ~o~" + BusinessManager.GetBusiness(target.GetUser().BusinessId).Name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BusinessBase business = BusinessManager.GetBusiness(businessid);
|
BusinessBase business = BusinessManager.GetBusiness(businessid);
|
||||||
if(business == null)
|
if (business == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieses Business existiert nicht. ~m~/businesslist");
|
ChatService.Error(player, "Dieses Business existiert nicht. ~m~/businesslist");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(business.GetOwner() != null)
|
if (business.GetOwner() != null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Das Business hat momentan noch einen Besitzer: ~o~" + business.GetOwner().Name + "~s~. Entferne diesen Besitzer erst mit ~m~/clearbusiness");
|
ChatService.Error(player, "Das Business hat momentan noch einen Besitzer: ~o~" + business.GetOwner().Name + "~s~. Entferne diesen Besitzer erst mit ~m~/clearbusiness");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using(var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
Entities.User targetUser = target.GetUser(dbContext);
|
Entities.User targetUser = target.GetUser(dbContext);
|
||||||
targetUser.BusinessId = businessid;
|
targetUser.BusinessId = businessid;
|
||||||
@@ -2164,12 +2164,12 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using(var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
User owner = business.GetOwner(dbContext);
|
User owner = business.GetOwner(dbContext);
|
||||||
if(owner == null)
|
if (owner == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieses Business hat momentan keinen Besitzer.");
|
ChatService.Error(player, "Dieses Business hat momentan keinen Besitzer");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2226,16 +2226,16 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
option1 = option1.ToString();
|
option1 = option1.ToString();
|
||||||
|
|
||||||
if(option1 != "add" && option1 != "remove" && option1 != "setenterposition" && option1 != "setexitposition")
|
if (option1 != "add" && option1 != "remove" && option1 != "setenterposition" && option1 != "setexitposition")
|
||||||
{
|
{
|
||||||
player.SendChatMessage("~m~Benutzung: ~s~/interior [Add / Remove / SetEnterPosition / SetExitPosition] [Name]");
|
player.SendChatMessage("~m~Benutzung: ~s~/interior [Add / Remove / SetEnterPosition / SetExitPosition] [Name]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(option1)
|
switch (option1)
|
||||||
{
|
{
|
||||||
case "add":
|
case "add":
|
||||||
using(var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
Interior interiorAdd = new Interior
|
Interior interiorAdd = new Interior
|
||||||
{
|
{
|
||||||
@@ -2249,15 +2249,15 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
case "remove":
|
case "remove":
|
||||||
using (var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
if(!int.TryParse(option2, out int intId))
|
if (!int.TryParse(option2, out int intId))
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Es muss eine Nummer angegeben werden.");
|
ChatService.Error(player, "Es muss eine Nummer angegeben werden");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Interior interiorRemove = InteriorManager.GetInteriorById(intId, dbContext);
|
Interior interiorRemove = InteriorManager.GetInteriorById(intId, dbContext);
|
||||||
if(interiorRemove == null)
|
if (interiorRemove == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieses Interior existiert nicht.");
|
ChatService.Error(player, "Dieses Interior existiert nicht");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2273,13 +2273,13 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
{
|
{
|
||||||
if (!int.TryParse(option2, out int intIdEnter))
|
if (!int.TryParse(option2, out int intIdEnter))
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Es muss eine Nummer angegeben werden.");
|
ChatService.Error(player, "Es muss eine Nummer angegeben werden");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Interior interior = InteriorManager.GetInteriorById(intIdEnter, dbContext);
|
Interior interior = InteriorManager.GetInteriorById(intIdEnter, dbContext);
|
||||||
if (interior == null)
|
if (interior == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieses Interior existiert nicht.");
|
ChatService.Error(player, "Dieses Interior existiert nicht");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
interior.EnterPosition = player.Position;
|
interior.EnterPosition = player.Position;
|
||||||
@@ -2295,13 +2295,13 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
{
|
{
|
||||||
if (!int.TryParse(option2, out int intIdExit))
|
if (!int.TryParse(option2, out int intIdExit))
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Es muss eine Nummer angegeben werden.");
|
ChatService.Error(player, "Es muss eine Nummer angegeben werden");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Interior interior = InteriorManager.GetInteriorById(intIdExit, dbContext);
|
Interior interior = InteriorManager.GetInteriorById(intIdExit, dbContext);
|
||||||
if (interior == null)
|
if (interior == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieses Interior existiert nicht.");
|
ChatService.Error(player, "Dieses Interior existiert nicht");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
interior.ExitPosition = player.Position;
|
interior.ExitPosition = player.Position;
|
||||||
@@ -2354,7 +2354,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
{
|
{
|
||||||
if (dbContext.WhitelistEntries.Any(w => w.SocialClubName.ToLower() == scName.ToLower()))
|
if (dbContext.WhitelistEntries.Any(w => w.SocialClubName.ToLower() == scName.ToLower()))
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieser Name ist schon auf der Whitelist.");
|
ChatService.Error(player, "Dieser Name ist schon auf der Whitelist");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2367,7 +2367,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
{
|
{
|
||||||
if (!dbContext.WhitelistEntries.Any(w => w.SocialClubName.ToLower() == scName.ToLower()))
|
if (!dbContext.WhitelistEntries.Any(w => w.SocialClubName.ToLower() == scName.ToLower()))
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieser Name ist nicht auf der Whitelist.");
|
ChatService.Error(player, "Dieser Name ist nicht auf der Whitelist");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2391,7 +2391,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
if (!Enum.IsDefined(typeof(AdminLevel), rank))
|
if (!Enum.IsDefined(typeof(AdminLevel), rank))
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieser Adminrang ist nicht definiert.");
|
ChatService.Error(player, "Dieser Adminrang ist nicht definiert");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,36 +71,10 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Leader Commands
|
#region Leader Commands
|
||||||
|
|
||||||
[Command("invite", "~m~Benutzung: ~s~/invite [Name]")]
|
[Command("invite", "~m~Benutzung: ~s~/invite [Name]")]
|
||||||
public void CmdFactionInvite(Client player, string name)
|
public void CmdFactionInvite(Client player, string name)
|
||||||
{
|
{
|
||||||
if (player.GetUser()?.FactionId == null || player.GetUser().FactionLeader == false)
|
|
||||||
{
|
|
||||||
ChatService.NotAuthorized(player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Client target = ClientService.GetClientByNameOrId(name);
|
|
||||||
if (target == null || !target.IsLoggedIn())
|
|
||||||
{
|
|
||||||
ChatService.PlayerNotFound(player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target.GetUser()?.FactionId != null)
|
|
||||||
{
|
|
||||||
ChatService.Error(player, "Dieser Spieler ist schon in einer Fraktion.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
target.SetData("accept_invite", player.Handle);
|
|
||||||
|
|
||||||
player.SendChatMessage("!{02FCFF}Du hast dem Spieler " + target.Name + " eine Einladung in deine Fraktion gesendet.");
|
|
||||||
target.SendChatMessage("!{02FCFF}Du hast von " + player.Name + " eine Einladung in die Fraktion \"" + player.GetUser().Faction.Name + "\" erhalten.");
|
|
||||||
target.SendChatMessage("!{02FCFF}Benutze '/accept invite', um die Einladung anzunehmen");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("giverank", "~m~Benutzung: ~s~/giverank [Name] [Rang]", GreedyArg = true)]
|
[Command("giverank", "~m~Benutzung: ~s~/giverank [Name] [Rang]", GreedyArg = true)]
|
||||||
@@ -121,7 +95,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
if (target.GetUser()?.FactionId != player.GetUser()?.FactionId)
|
if (target.GetUser()?.FactionId != player.GetUser()?.FactionId)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieser Spieler ist nicht in deiner Fraktion.");
|
ChatService.Error(player, "Dieser Spieler ist nicht in deiner Fraktion");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +104,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
FactionRank fr = dbContext.FactionRanks.FirstOrDefault(r => r.RankName == rank && r.FactionId == player.GetUser(dbContext).FactionId);
|
FactionRank fr = dbContext.FactionRanks.FirstOrDefault(r => r.RankName == rank && r.FactionId == player.GetUser(dbContext).FactionId);
|
||||||
if (fr == null)
|
if (fr == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieser Rang existiert nicht.");
|
ChatService.Error(player, "Dieser Rang existiert nicht");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,19 +135,19 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
if (target.GetUser()?.FactionId != player.GetUser()?.FactionId)
|
if (target.GetUser()?.FactionId != player.GetUser()?.FactionId)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Dieser Spieler ist nicht in deiner Fraktion.");
|
ChatService.Error(player, "Dieser Spieler ist nicht in deiner Fraktion");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.Handle == target.Handle)
|
if (player.Handle == target.Handle)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Du kannst dich nicht selber uninviten.");
|
ChatService.Error(player, "Du kannst dich nicht selber uninviten");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.GetUser()?.FactionLeader ?? false)
|
if (target.GetUser()?.FactionLeader ?? false)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Du kannst keinen Leader uninviten.");
|
ChatService.Error(player, "Du kannst keinen Leader uninviten");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,7 +195,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
if (player.IsInVehicle)
|
if (player.IsInVehicle)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Du kannst in einem Auto nicht wiederbeleben!");
|
ChatService.Error(player, "Du kannst in einem Auto nicht wiederbeleben");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,7 +203,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
var deadPlayer = nearPlayers.Where(i => i.GetData("isDead") == true).FirstOrDefault();
|
var deadPlayer = nearPlayers.Where(i => i.GetData("isDead") == true).FirstOrDefault();
|
||||||
if (player == deadPlayer)
|
if (player == deadPlayer)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Du kannst dich nicht selbst wiederbeleben!");
|
ChatService.Error(player, "Du kannst dich nicht selbst wiederbeleben");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.PlayAnimation("amb@medic@standing@kneel@enter", "enter", 0);
|
player.PlayAnimation("amb@medic@standing@kneel@enter", "enter", 0);
|
||||||
@@ -254,7 +228,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
if (player.IsInVehicle)
|
if (player.IsInVehicle)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Du kannst in einem Auto nicht heilen!");
|
ChatService.Error(player, "Du kannst in einem Auto nicht heilen");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Client target = ClientService.GetClientByNameOrId(receiver);
|
Client target = ClientService.GetClientByNameOrId(receiver);
|
||||||
@@ -267,7 +241,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
[Command("duty", "~m~Benutzung: ~s~/duty")]
|
[Command("duty", "~m~Benutzung: ~s~/duty")]
|
||||||
public void CmdFactionDuty(Client player)
|
public void CmdFactionDuty(Client player)
|
||||||
{
|
{
|
||||||
if(player.GetData("duty") == false)
|
if (player.GetData("duty") == false)
|
||||||
{
|
{
|
||||||
player.SetData("duty", true);
|
player.SetData("duty", true);
|
||||||
player.SendNotification("~g~Du bist jetzt im Dienst!", false);
|
player.SendNotification("~g~Du bist jetzt im Dienst!", false);
|
||||||
|
|||||||
31
ReallifeGamemode.Server/Commands/GroupCommands.cs
Normal file
31
ReallifeGamemode.Server/Commands/GroupCommands.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using GTANetworkAPI;
|
||||||
|
using ReallifeGamemode.Server.Extensions;
|
||||||
|
using ReallifeGamemode.Server.Services;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Commands
|
||||||
|
{
|
||||||
|
class GroupCommands : Script
|
||||||
|
{
|
||||||
|
#region Chat Commands
|
||||||
|
[Command("g", "~m~Benutzung: ~s~/g [Nachricht]", GreedyArg = true)]
|
||||||
|
public void CmdGroupG(Client player, string message)
|
||||||
|
{
|
||||||
|
Entities.Group group = player.GetUser().Group;
|
||||||
|
if (group == null)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = Regex.Replace(message, "(~[a-zA-Z]~{1})|(!{(.*)})", "");
|
||||||
|
message = $"{player.Name}: {message}";
|
||||||
|
|
||||||
|
ChatService.BroadcastGroup(message, group);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,44 +17,11 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
option = option.ToLower();
|
option = option.ToLower();
|
||||||
|
|
||||||
switch(option)
|
switch (option)
|
||||||
{
|
{
|
||||||
case "invite":
|
case "invite":
|
||||||
{
|
{
|
||||||
if(!player.HasData("accept_invite"))
|
|
||||||
{
|
|
||||||
ChatService.Error(player, "Du hast keine Einladung in eine Fraktion erhalten.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
player.ResetData("accept_data");
|
|
||||||
|
|
||||||
using(var dbContext = new DatabaseContext())
|
|
||||||
{
|
|
||||||
Client leader = NAPI.Player.GetPlayerFromHandle((NetHandle)player.GetData("accept_invite"));
|
|
||||||
|
|
||||||
if(leader == null)
|
|
||||||
{
|
|
||||||
ChatService.Error(player, "Die Einladung ist abgelaufen.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
User u = leader.GetUser(dbContext);
|
|
||||||
User own = player.GetUser(dbContext);
|
|
||||||
|
|
||||||
own.FactionId = u.FactionId;
|
|
||||||
own.FactionLeader = false;
|
|
||||||
own.FactionRankId = dbContext
|
|
||||||
.FactionRanks
|
|
||||||
.OrderBy(x => x.Order)
|
|
||||||
.Where(r => r.FactionId == own.FactionId)
|
|
||||||
.FirstOrDefault()?.Id ?? null;
|
|
||||||
|
|
||||||
leader.SendChatMessage("!{02FCFF}" + player.Name + " hat die Einladung angenommen.");
|
|
||||||
player.SendChatMessage("!{02FCFF}Du hast die Einladung angenommen.");
|
|
||||||
|
|
||||||
dbContext.SaveChanges();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,21 +35,15 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
Vehicle pVeh = player.Vehicle;
|
Vehicle pVeh = player.Vehicle;
|
||||||
|
|
||||||
if(pVeh.GetServerVehicle() is ServerVehicle veh)
|
if (pVeh.GetServerVehicle() is ServerVehicle veh)
|
||||||
{
|
{
|
||||||
if(player.GetUser().IsAdmin(AdminLevel.SUPPORTER))
|
if (player.GetUser().IsAdmin(AdminLevel.SUPPORTER))
|
||||||
{
|
{
|
||||||
player.SendChatMessage("~m~" + ((VehicleHash)pVeh.Model) + " | " + veh.ToString() + " | Farbe 1: " + pVeh.PrimaryColor + " | Farbe 2: " + pVeh.SecondaryColor + " | ID: " + pVeh.Handle.Value);
|
player.SendChatMessage("~m~" + ((VehicleHash)pVeh.Model) + " | " + veh.ToString() + " | Farbe 1: " + pVeh.PrimaryColor + " | Farbe 2: " + pVeh.SecondaryColor + " | ID: " + pVeh.Handle.Value);
|
||||||
}
|
return;
|
||||||
else
|
|
||||||
{
|
|
||||||
player.SendChatMessage("~m~" + ((VehicleHash)pVeh.Model) + " | Farbe 1: " + pVeh.PrimaryColor + " | Farbe 2: " + pVeh.SecondaryColor + " | ID: " + pVeh.Handle.Value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
player.SendChatMessage("~m~" + ((VehicleHash)pVeh.Model) + " | Farbe 1: " + pVeh.PrimaryColor + " | Farbe 2: " + pVeh.SecondaryColor + " | ID: " + pVeh.Handle.Value);
|
||||||
{
|
|
||||||
player.SendChatMessage("~m~" + ((VehicleHash)pVeh.Model) + " | Farbe 1: " + pVeh.PrimaryColor + " | Farbe 2: " + pVeh.SecondaryColor + " | ID: " + pVeh.Handle.Value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ namespace ReallifeGamemode.Server.Entities
|
|||||||
[Key]
|
[Key]
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int Balance {
|
public int Balance
|
||||||
|
{
|
||||||
get => _balance;
|
get => _balance;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
|||||||
51
ReallifeGamemode.Server/Entities/Group.cs
Normal file
51
ReallifeGamemode.Server/Entities/Group.cs
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using ReallifeGamemode.Server.Models;
|
||||||
|
using ReallifeGamemode.Server.Util;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Entities
|
||||||
|
{
|
||||||
|
public class Group : IBankAccountOwner
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public IBankAccount GetBankAccount(DatabaseContext databaseContext = null)
|
||||||
|
{
|
||||||
|
GroupBankAccount bankAccount = null;
|
||||||
|
if (databaseContext == null)
|
||||||
|
{
|
||||||
|
using (databaseContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
bankAccount = databaseContext.GroupBankAccounts.Include(g => g.Group).Where(g => g.Group == this).FirstOrDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bankAccount = databaseContext.GroupBankAccounts.Include(g => g.Group).Where(g => g.Group == this).FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bankAccount == null)
|
||||||
|
{
|
||||||
|
bankAccount = new GroupBankAccount
|
||||||
|
{
|
||||||
|
Group = this,
|
||||||
|
Balance = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
databaseContext.GroupBankAccounts.Add(bankAccount);
|
||||||
|
databaseContext.SaveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
return bankAccount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
20
ReallifeGamemode.Server/Entities/GroupBankAccount.cs
Normal file
20
ReallifeGamemode.Server/Entities/GroupBankAccount.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using ReallifeGamemode.Server.Util;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Entities
|
||||||
|
{
|
||||||
|
public class GroupBankAccount : IBankAccount
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public Group Group { get; set; }
|
||||||
|
|
||||||
|
public int Balance { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
30
ReallifeGamemode.Server/Entities/GroupVehicle.cs
Normal file
30
ReallifeGamemode.Server/Entities/GroupVehicle.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using ReallifeGamemode.Server.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Entities
|
||||||
|
{
|
||||||
|
public class GroupVehicle : ServerVehicle
|
||||||
|
{
|
||||||
|
public Group Group { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("Group")]
|
||||||
|
public int? GroupId { get; set; }
|
||||||
|
|
||||||
|
public Group GetGroup()
|
||||||
|
{
|
||||||
|
using (var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
return dbContext.Groups.Where(g => g.Id == GroupId).FirstOrDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return "Gruppen Fahrzeug | Gruppe: " + Group.Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -48,7 +48,7 @@ namespace ReallifeGamemode.Server.Entities
|
|||||||
|
|
||||||
string numberplate = $"{this.Id}";
|
string numberplate = $"{this.Id}";
|
||||||
|
|
||||||
if(this is FactionVehicle fV)
|
if (this is FactionVehicle fV)
|
||||||
{
|
{
|
||||||
numberplate = $"F{fV.FactionId} " + numberplate;
|
numberplate = $"F{fV.FactionId} " + numberplate;
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ namespace ReallifeGamemode.Server.Entities
|
|||||||
numberplate = $"U{uV.UserId} " + numberplate;
|
numberplate = $"U{uV.UserId} " + numberplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this is ShopVehicle sV)
|
if (this is ShopVehicle sV)
|
||||||
{
|
{
|
||||||
numberplate = "Shop";
|
numberplate = "Shop";
|
||||||
VehicleStreaming.SetLockStatus(veh, false);
|
VehicleStreaming.SetLockStatus(veh, false);
|
||||||
@@ -66,6 +66,11 @@ namespace ReallifeGamemode.Server.Entities
|
|||||||
veh.Position.Add(new Vector3(0, 0, 1.3)), 10.0f, 1f, 1, new Color(255, 255, 255));
|
veh.Position.Add(new Vector3(0, 0, 1.3)), 10.0f, 1f, 1, new Color(255, 255, 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this is GroupVehicle gV)
|
||||||
|
{
|
||||||
|
numberplate = $"{gV.GroupId}" + numberplate;
|
||||||
|
}
|
||||||
|
|
||||||
veh.NumberPlate = numberplate;
|
veh.NumberPlate = numberplate;
|
||||||
|
|
||||||
return veh;
|
return veh;
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ namespace ReallifeGamemode.Server.Entities
|
|||||||
public int? FactionRankId { get; set; }
|
public int? FactionRankId { get; set; }
|
||||||
public FactionRank FactionRank { get; set; }
|
public FactionRank FactionRank { get; set; }
|
||||||
|
|
||||||
|
public Group Group { get; set; }
|
||||||
|
|
||||||
|
public GroupRank GroupRank { get; set; }
|
||||||
|
|
||||||
public FactionRank GetFactionRank()
|
public FactionRank GetFactionRank()
|
||||||
{
|
{
|
||||||
using (var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
@@ -126,7 +130,7 @@ namespace ReallifeGamemode.Server.Entities
|
|||||||
|
|
||||||
public List<UserItem> GetItems()
|
public List<UserItem> GetItems()
|
||||||
{
|
{
|
||||||
using(var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
return dbContext.UserItems.ToList().FindAll(u => u.UserId == this.Id);
|
return dbContext.UserItems.ToList().FindAll(u => u.UserId == this.Id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,12 +28,13 @@ namespace ReallifeGamemode.Server.Entities
|
|||||||
public string Bic { get; set; }
|
public string Bic { get; set; }
|
||||||
[StringLength(32)]
|
[StringLength(32)]
|
||||||
public string Iban { get; set; }
|
public string Iban { get; set; }
|
||||||
public int Balance {
|
public int Balance
|
||||||
|
{
|
||||||
get => _balance;
|
get => _balance;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_balance = value;
|
_balance = value;
|
||||||
using(var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
ClientService.GetClientByNameOrId(dbContext.Users.First(u => u.Id == UserId).Name).TriggerEvent("updateMoney", value);
|
ClientService.GetClientByNameOrId(dbContext.Users.First(u => u.Id == UserId).Name).TriggerEvent("updateMoney", value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
|
|
||||||
using (var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
if(!dbContext.WhitelistEntries.Any(w => w.SocialClubName.ToLower() == player.SocialClubName.ToLower()))
|
if (!dbContext.WhitelistEntries.Any(w => w.SocialClubName.ToLower() == player.SocialClubName.ToLower()))
|
||||||
{
|
{
|
||||||
string msg2 = "~m~*** " + player.Name + "[" + player.SocialClubName + "] (" + player.Address + ") hat versucht, sich einzuloggen, steht aber nicht auf der Whitelist.";
|
string msg2 = "~m~*** " + player.Name + "[" + player.SocialClubName + "] (" + player.Address + ") hat versucht, sich einzuloggen, steht aber nicht auf der Whitelist.";
|
||||||
ChatService.BroadcastAdmin(msg2, AdminLevel.ADMIN);
|
ChatService.BroadcastAdmin(msg2, AdminLevel.ADMIN);
|
||||||
@@ -69,7 +69,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
var timeStamp = bannedUser.UntilDateTime;
|
var timeStamp = bannedUser.UntilDateTime;
|
||||||
int unixTimestamp = (int)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
|
int unixTimestamp = (int)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
|
||||||
|
|
||||||
if(timeStamp > unixTimestamp)
|
if (timeStamp > unixTimestamp)
|
||||||
{
|
{
|
||||||
player.SendChatMessage("Du bist noch bis zum !{#FF4040}" + dt.AddSeconds(timeStamp).ToLocalTime() + " Uhr ~s~gebannt. [" + bannedUser.Reason + "]");
|
player.SendChatMessage("Du bist noch bis zum !{#FF4040}" + dt.AddSeconds(timeStamp).ToLocalTime() + " Uhr ~s~gebannt. [" + bannedUser.Reason + "]");
|
||||||
player.Kick();
|
player.Kick();
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
killerPosY = killer.Position.Y;
|
killerPosY = killer.Position.Y;
|
||||||
killerPosZ = killer.Position.Z;
|
killerPosZ = killer.Position.Z;
|
||||||
killerHeading = killer.Heading;
|
killerHeading = killer.Heading;
|
||||||
if(player != killer)
|
if (player != killer)
|
||||||
{
|
{
|
||||||
string message = "~y~[HINWEIS]: " + killer.Name + " hat " + player.Name + " getötet (" + NAPI.Player.GetPlayerCurrentWeapon(killer) + ")";
|
string message = "~y~[HINWEIS]: " + killer.Name + " hat " + player.Name + " getötet (" + NAPI.Player.GetPlayerCurrentWeapon(killer) + ")";
|
||||||
ChatService.BroadcastAdmin(message, AdminLevel.ADMIN);
|
ChatService.BroadcastAdmin(message, AdminLevel.ADMIN);
|
||||||
@@ -91,9 +91,20 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
|
|
||||||
using (var userDeath = new DatabaseContext())
|
using (var userDeath = new DatabaseContext())
|
||||||
{
|
{
|
||||||
var dead = new Entities.Logs.Death { VictimId = player.GetUser().Id, KillerId = killerId, KillerPositionX = killerPosX, KillerPositionY = killerPosY,
|
var dead = new Entities.Logs.Death
|
||||||
KillerPositionZ = killerPosZ, KillerHeading = killerHeading, VictimPositionX = player.Position.X, VictimPositionY = player.Position.Y,
|
{
|
||||||
VictimPositionZ = player.Position.Z, VictimHeading = player.Heading, CauseOfDeath = reason.ToString()};
|
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()
|
||||||
|
};
|
||||||
userDeath.DeathLogs.Add(dead);
|
userDeath.DeathLogs.Add(dead);
|
||||||
userDeath.SaveChanges();
|
userDeath.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
var user = player.GetUser(saveUser);
|
var user = player.GetUser(saveUser);
|
||||||
Vector3 pos = player.Position;
|
Vector3 pos = player.Position;
|
||||||
|
|
||||||
if(!float.IsNaN(pos.X) && !float.IsNaN(pos.Y) && !float.IsNaN(pos.Z))
|
if (!float.IsNaN(pos.X) && !float.IsNaN(pos.Y) && !float.IsNaN(pos.Z))
|
||||||
{
|
{
|
||||||
user.PositionX = pos.X;
|
user.PositionX = pos.X;
|
||||||
user.PositionY = pos.Y;
|
user.PositionY = pos.Y;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
|
|
||||||
if (vehicle.GetServerVehicle() is FactionVehicle veh)
|
if (vehicle.GetServerVehicle() is FactionVehicle veh)
|
||||||
{
|
{
|
||||||
if(veh.FactionId != player.GetUser().FactionId)
|
if (veh.FactionId != player.GetUser().FactionId)
|
||||||
{
|
{
|
||||||
player.StopAnimation();
|
player.StopAnimation();
|
||||||
player.SendNotification("~r~Du darfst dieses Fahrzeug nicht benutzen!", true);
|
player.SendNotification("~r~Du darfst dieses Fahrzeug nicht benutzen!", true);
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
public void OnFactionRanksEdit(Client player, string jsonData)
|
public void OnFactionRanksEdit(Client player, string jsonData)
|
||||||
{
|
{
|
||||||
FactionRankHelper helper = JsonConvert.DeserializeObject<FactionRankHelper>(jsonData);
|
FactionRankHelper helper = JsonConvert.DeserializeObject<FactionRankHelper>(jsonData);
|
||||||
using(var context = new DatabaseContext())
|
using (var context = new DatabaseContext())
|
||||||
{
|
{
|
||||||
Entities.Faction f = context.Factions.FirstOrDefault(x => x.Id == helper.FactionId);
|
Entities.Faction f = context.Factions.FirstOrDefault(x => x.Id == helper.FactionId);
|
||||||
if (f == null)
|
if (f == null)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Bei der Bearbeitung der Ränge ist ein Fehler aufgetreten: Die Fraktion existiert nicht.");
|
ChatService.Error(player, "Bei der Bearbeitung der Ränge ist ein Fehler aufgetreten: Die Fraktion existiert nicht");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,10 +31,10 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
|
|
||||||
List<int> found = new List<int>();
|
List<int> found = new List<int>();
|
||||||
|
|
||||||
for(int i = 0; i < ranks.Count; i++)
|
for (int i = 0; i < ranks.Count; i++)
|
||||||
{
|
{
|
||||||
Rank newRank = ranks[i];
|
Rank newRank = ranks[i];
|
||||||
if(newRank.Id == 0)
|
if (newRank.Id == 0)
|
||||||
{
|
{
|
||||||
context.FactionRanks.Add(new FactionRank
|
context.FactionRanks.Add(new FactionRank
|
||||||
{
|
{
|
||||||
@@ -52,9 +52,9 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < factionRanks.Count; i++)
|
for (int i = 0; i < factionRanks.Count; i++)
|
||||||
{
|
{
|
||||||
if(!found.Contains(factionRanks[i].Id))
|
if (!found.Contains(factionRanks[i].Id))
|
||||||
{
|
{
|
||||||
context.FactionRanks.Remove(factionRanks[i]);
|
context.FactionRanks.Remove(factionRanks[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
|
|
||||||
GroundItem.PickUpGroundItem(player);
|
GroundItem.PickUpGroundItem(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
[RemoteEvent("keyPress:UP_ARROW")]
|
[RemoteEvent("keyPress:UP_ARROW")]
|
||||||
public void KeyPressUpArrow(Client player)
|
public void KeyPressUpArrow(Client player)
|
||||||
{
|
{
|
||||||
@@ -58,6 +59,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
ATMManager.ShowAtmUi(player, player.GetData("nearATM"));
|
ATMManager.ShowAtmUi(player, player.GetData("nearATM"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[RemoteEvent("keyPress:LEFT_ARROW")]
|
[RemoteEvent("keyPress:LEFT_ARROW")]
|
||||||
public void KeyPressLeftArrow(Client player)
|
public void KeyPressLeftArrow(Client player)
|
||||||
{
|
{
|
||||||
@@ -81,6 +83,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
player.TriggerEvent("showPlayerInteraction", JsonConvert.SerializeObject(nearbyPlayerList));
|
player.TriggerEvent("showPlayerInteraction", JsonConvert.SerializeObject(nearbyPlayerList));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[RemoteEvent("keyPress:RIGHT_ARROW")]
|
[RemoteEvent("keyPress:RIGHT_ARROW")]
|
||||||
public void KeyPressRightArrow(Client player)
|
public void KeyPressRightArrow(Client player)
|
||||||
{
|
{
|
||||||
@@ -95,85 +98,108 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[RemoteEvent("keyPress:E")]
|
[RemoteEvent("keyPress:DOWN_ARROW")]
|
||||||
|
public void KeyPressDownArrow(Client player)
|
||||||
|
{
|
||||||
|
User u = player.GetUser();
|
||||||
|
if (u == null) return;
|
||||||
|
|
||||||
|
var accountData = new
|
||||||
|
{
|
||||||
|
regDate = u.RegistrationDate.ToShortDateString(),
|
||||||
|
adminLevel = u.AdminLevel.GetName(),
|
||||||
|
faction = u.Faction?.Name ?? "Zivilist",
|
||||||
|
factionRank = u.GetFactionRank().RankName,
|
||||||
|
group = u.Group?.Name ?? "Keine",
|
||||||
|
groupRank = u.GroupRank.GetName()
|
||||||
|
};
|
||||||
|
|
||||||
|
string faction = u.FactionLeader ? u.Faction.Name : null;
|
||||||
|
string group = u.Group?.Name ?? null;
|
||||||
|
bool factionInvite = player.HasData("accept_faction_invite");
|
||||||
|
bool groupInvite = player.HasData("accept_group_invite");
|
||||||
|
|
||||||
|
player.TriggerEvent("SERVER:InteractionMenu_OpenMenu", JsonConvert.SerializeObject(accountData), faction, group, factionInvite, groupInvite);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RemoteEvent("keyPress:E")]
|
||||||
public void KeyPressE(Client player)
|
public void KeyPressE(Client player)
|
||||||
{
|
{
|
||||||
if (!player.IsLoggedIn()) return;
|
if (!player.IsLoggedIn()) return;
|
||||||
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);
|
DutyPoint nearest = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.5 && d.FactionId == user.FactionId);
|
||||||
if (nearest == null) return;
|
if (nearest == null) return;
|
||||||
if (player.Position.DistanceTo(nearest.Position) <= 1.5 && nearest.FactionId == user.FactionId)
|
var nameTagColor = new Color(0, 0, 0);
|
||||||
|
var factionId = user.FactionId;
|
||||||
|
|
||||||
|
if (player.GetData("duty") == false)
|
||||||
{
|
{
|
||||||
var nameTagColor = new Color(0, 0, 0);
|
player.SetData("duty", true);
|
||||||
var factionId = user.FactionId;
|
player.SendNotification("Du bist nun ~g~im Dienst.");
|
||||||
|
if (player.GetUser().FactionId == 2) //Fire Department
|
||||||
if (player.GetData("duty") == false)
|
|
||||||
{
|
{
|
||||||
player.SetData("duty", true);
|
int medicCount = 0;
|
||||||
player.SendNotification("Du bist nun ~g~im Dienst.");
|
foreach (Client c in NAPI.Pools.GetAllPlayers())
|
||||||
if (player.GetUser().FactionId == 2) //Fire Department
|
|
||||||
{
|
{
|
||||||
int medicCount = 0;
|
if ((c.GetUser()?.Faction.Id ?? 0) == 2)
|
||||||
foreach(Client c in NAPI.Pools.GetAllPlayers())
|
|
||||||
{
|
{
|
||||||
if((c.GetUser()?.Faction.Id ?? 0) == 2)
|
medicCount++;
|
||||||
{
|
|
||||||
medicCount++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", medicCount);
|
|
||||||
}
|
}
|
||||||
switch (factionId)
|
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", medicCount);
|
||||||
{
|
}
|
||||||
//LSPD
|
switch (factionId)
|
||||||
case 1:
|
{
|
||||||
nameTagColor = new Color(28, 134, 238);
|
//LSPD
|
||||||
break;
|
case 1:
|
||||||
}
|
nameTagColor = new Color(28, 134, 238);
|
||||||
player.NametagColor = nameTagColor;
|
break;
|
||||||
using (var context = new DatabaseContext())
|
}
|
||||||
{
|
player.NametagColor = nameTagColor;
|
||||||
List<CharacterCloth> clothes = context.CharacterClothes.Where(u => u.UserId == user.Id && u.Duty == true).ToList();
|
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)
|
foreach (var cloth in clothes)
|
||||||
|
{
|
||||||
|
if (cloth.SlotType == 0)
|
||||||
{
|
{
|
||||||
if(cloth.SlotType == 0)
|
player.SetClothes(cloth.SlotId, cloth.ClothId, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (cloth.ClothId != -1)
|
||||||
{
|
{
|
||||||
player.SetClothes(cloth.SlotId, cloth.ClothId, 0);
|
player.SetAccessories(cloth.SlotId, cloth.ClothId, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(cloth.ClothId != -1)
|
player.ClearAccessory(cloth.SlotId);
|
||||||
{
|
|
||||||
player.SetAccessories(cloth.SlotId, cloth.ClothId, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.ClearAccessory(cloth.SlotId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
player.SetData("duty", false);
|
{
|
||||||
player.SendNotification("Du bist nun ~r~außer Dienst.");
|
player.SetData("duty", false);
|
||||||
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", false);
|
player.SendNotification("Du bist nun ~r~außer Dienst.");
|
||||||
player.NametagColor = new Color(255, 255, 255);
|
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", false);
|
||||||
UpdateCharacterCloth.LoadCharacterDefaults(player);
|
player.NametagColor = new Color(255, 255, 255);
|
||||||
}
|
UpdateCharacterCloth.LoadCharacterDefaults(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[RemoteEvent("keyPress:I")]
|
[RemoteEvent("keyPress:I")]
|
||||||
public void KeyPressI(Client player)
|
public void KeyPressI(Client player)
|
||||||
{
|
{
|
||||||
if (!player.IsLoggedIn()) return;
|
if (!player.IsLoggedIn()) return;
|
||||||
InventoryManager.GetUserItems(player);
|
InventoryManager.GetUserItems(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
[RemoteEvent("keyPress:J")]
|
[RemoteEvent("keyPress:J")]
|
||||||
public void KeyPressJ(Client player)
|
public void KeyPressJ(Client player)
|
||||||
{
|
{
|
||||||
@@ -181,7 +207,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
List<Client> players = NAPI.Pools.GetAllPlayers();
|
List<Client> players = NAPI.Pools.GetAllPlayers();
|
||||||
List<ListPlayer> ListPlayers = new List<ListPlayer>();
|
List<ListPlayer> ListPlayers = new List<ListPlayer>();
|
||||||
|
|
||||||
foreach(Client listPlayer in players)
|
foreach (Client listPlayer in players)
|
||||||
{
|
{
|
||||||
var lPlayer = new ListPlayer
|
var lPlayer = new ListPlayer
|
||||||
{
|
{
|
||||||
@@ -194,6 +220,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
}
|
}
|
||||||
player.TriggerEvent("fetchPlayerList", JsonConvert.SerializeObject(ListPlayers));
|
player.TriggerEvent("fetchPlayerList", JsonConvert.SerializeObject(ListPlayers));
|
||||||
}
|
}
|
||||||
|
|
||||||
[RemoteEvent("keyPress:K")]
|
[RemoteEvent("keyPress:K")]
|
||||||
public void KeyPressK(Client player)
|
public void KeyPressK(Client player)
|
||||||
{
|
{
|
||||||
@@ -213,9 +240,9 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
using (var context = new DatabaseContext())
|
using (var context = new DatabaseContext())
|
||||||
{
|
{
|
||||||
List<DutyCloth> clothes = context.DutyClothes.ToList().FindAll(c => c.FactionId == user.FactionId && c.Gender == user.GetCharacter().Gender);
|
List<DutyCloth> clothes = context.DutyClothes.ToList().FindAll(c => c.FactionId == user.FactionId && c.Gender == user.GetCharacter().Gender);
|
||||||
foreach(var cloth in clothes)
|
foreach (var cloth in clothes)
|
||||||
{
|
{
|
||||||
if(cloth.SlotType == 1)
|
if (cloth.SlotType == 1)
|
||||||
{
|
{
|
||||||
if (cloth.ClothId != -1)
|
if (cloth.ClothId != -1)
|
||||||
{
|
{
|
||||||
@@ -247,12 +274,14 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[RemoteEvent("keyPress:L")]
|
[RemoteEvent("keyPress:L")]
|
||||||
public void KeyPressL(Client player)
|
public void KeyPressL(Client player)
|
||||||
{
|
{
|
||||||
if (!player.IsLoggedIn()) return;
|
if (!player.IsLoggedIn()) return;
|
||||||
DoorManager.ChangeDoorState(player);
|
DoorManager.ChangeDoorState(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
[RemoteEvent("keyPress:N")]
|
[RemoteEvent("keyPress:N")]
|
||||||
public void KeyPressN(Client player)
|
public void KeyPressN(Client player)
|
||||||
{
|
{
|
||||||
@@ -266,13 +295,13 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
if (player.IsInVehicle && player.VehicleSeat == -1)
|
if (player.IsInVehicle && player.VehicleSeat == -1)
|
||||||
{
|
{
|
||||||
ServerVehicle veh = player.Vehicle.GetServerVehicle();
|
ServerVehicle veh = player.Vehicle.GetServerVehicle();
|
||||||
if(veh != null)
|
if (veh != null)
|
||||||
{
|
{
|
||||||
if(veh is FactionVehicle fV && fV.FactionId != player.GetUser()?.FactionId && (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN3) ?? false))
|
if (veh is FactionVehicle fV && fV.FactionId != player.GetUser()?.FactionId && (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN3) ?? false))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(veh is ShopVehicle)
|
else if (veh is ShopVehicle)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
{
|
{
|
||||||
var users = NAPI.Pools.GetAllPlayers();
|
var users = NAPI.Pools.GetAllPlayers();
|
||||||
|
|
||||||
foreach(Client user in users)
|
foreach (Client user in users)
|
||||||
{
|
{
|
||||||
using (var saveUsers = new DatabaseContext())
|
using (var saveUsers = new DatabaseContext())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
|
|
||||||
foreach (var cloth in charClothes)
|
foreach (var cloth in charClothes)
|
||||||
{
|
{
|
||||||
if(cloth.SlotType == 1)
|
if (cloth.SlotType == 1)
|
||||||
{
|
{
|
||||||
player.SetAccessories(cloth.SlotId, cloth.ClothId, 0);
|
player.SetAccessories(cloth.SlotId, cloth.ClothId, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(sV is UserVehicle uV)
|
else if (sV is UserVehicle uV)
|
||||||
{
|
{
|
||||||
if(uV.UserId != u.Id && !u.IsAdmin(AdminLevel.ADMIN3))
|
if (uV.UserId != u.Id && !u.IsAdmin(AdminLevel.ADMIN3))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,26 +24,15 @@ namespace ReallifeGamemode.Server.Extensions
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static User GetUser(this Client client, DatabaseContext context = null)
|
public static User GetUser(this Client client, DatabaseContext context = null)
|
||||||
{
|
{
|
||||||
|
context = context ?? new DatabaseContext();
|
||||||
if (!client.IsLoggedIn()) return null;
|
if (!client.IsLoggedIn()) return null;
|
||||||
if(context == null)
|
return context
|
||||||
{
|
.Users
|
||||||
using (context = new DatabaseContext())
|
.Include(u => u.Faction)
|
||||||
{
|
.Include(u => u.FactionRank)
|
||||||
return context
|
.Include(u => u.Group)
|
||||||
.Users
|
.Where(u => u.Name == client.Name)
|
||||||
.Include(u => u.Faction)
|
.FirstOrDefault();
|
||||||
.Include(u => u.FactionRank)
|
|
||||||
.FirstOrDefault(u => u.Name == client.Name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return context
|
|
||||||
.Users
|
|
||||||
.Include(u => u.Faction)
|
|
||||||
.Include(u => u.FactionRank)
|
|
||||||
.FirstOrDefault(u => u.Name == client.Name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Character GetCharacter(this User user, DatabaseContext context = null)
|
public static Character GetCharacter(this User user, DatabaseContext context = null)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace ReallifeGamemode.Server.Extensions
|
namespace ReallifeGamemode.Server.Extensions
|
||||||
{
|
{
|
||||||
public static class AdminLevelExtension
|
public static class EnumExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gibt den richtigen Namen eines Admin Levels zurück
|
/// Gibt den richtigen Namen eines Admin Levels zurück
|
||||||
@@ -15,7 +15,7 @@ namespace ReallifeGamemode.Server.Extensions
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string GetName(this AdminLevel level)
|
public static string GetName(this AdminLevel level)
|
||||||
{
|
{
|
||||||
switch(level)
|
switch (level)
|
||||||
{
|
{
|
||||||
case SUPPORTER:
|
case SUPPORTER:
|
||||||
return "Supporter";
|
return "Supporter";
|
||||||
@@ -31,5 +31,20 @@ namespace ReallifeGamemode.Server.Extensions
|
|||||||
return "Spieler";
|
return "Spieler";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetName(this GroupRank rank)
|
||||||
|
{
|
||||||
|
switch(rank)
|
||||||
|
{
|
||||||
|
case GroupRank.OWNER:
|
||||||
|
return "Besitzer";
|
||||||
|
case GroupRank.MANAGER:
|
||||||
|
return "Manager";
|
||||||
|
case GroupRank.MEMBER:
|
||||||
|
return "Mitglied";
|
||||||
|
default:
|
||||||
|
return "Keiner";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,9 +40,9 @@ namespace ReallifeGamemode.Server.Inventory
|
|||||||
var user = player.GetUser();
|
var user = player.GetUser();
|
||||||
if (nearestItem.Gewicht * nearest.Amount + invWeight > 40000)
|
if (nearestItem.Gewicht * nearest.Amount + invWeight > 40000)
|
||||||
{
|
{
|
||||||
for(var i = 1; i <= nearest.Amount; i++)
|
for (var i = 1; i <= nearest.Amount; i++)
|
||||||
{
|
{
|
||||||
if(invWeight + (i * nearestItem.Gewicht) > 40000)
|
if (invWeight + (i * nearestItem.Gewicht) > 40000)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -51,13 +51,13 @@ namespace ReallifeGamemode.Server.Inventory
|
|||||||
itemsToAdd = i;
|
itemsToAdd = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(itemsToAdd < 1)
|
if (itemsToAdd < 1)
|
||||||
{
|
{
|
||||||
player.SendNotification("~r~Du hast keinen Platz im Inventar!", false);
|
player.SendNotification("~r~Du hast keinen Platz im Inventar!", false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(existingItem != null)
|
if (existingItem != null)
|
||||||
{
|
{
|
||||||
using (var context = new DatabaseContext())
|
using (var context = new DatabaseContext())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace ReallifeGamemode.Server.Inventory.Items
|
|||||||
Client player = uItem.GetUser().Client;
|
Client player = uItem.GetUser().Client;
|
||||||
|
|
||||||
int amountToAdd = HpAmount;
|
int amountToAdd = HpAmount;
|
||||||
if(player.Health + amountToAdd > 100)
|
if (player.Health + amountToAdd > 100)
|
||||||
{
|
{
|
||||||
amountToAdd = 100 - player.Health;
|
amountToAdd = 100 - player.Health;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ namespace ReallifeGamemode.Server
|
|||||||
InteriorManager.LoadInteriors();
|
InteriorManager.LoadInteriors();
|
||||||
DoorManager.LoadDoors();
|
DoorManager.LoadDoors();
|
||||||
ATMManager.InitATMs();
|
ATMManager.InitATMs();
|
||||||
|
CityHallManager.LoadCityHall();
|
||||||
|
|
||||||
|
|
||||||
TempBlip tempBlip = new TempBlip()
|
TempBlip tempBlip = new TempBlip()
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
{
|
{
|
||||||
if (currentATM.Sprite == 500)
|
if (currentATM.Sprite == 500)
|
||||||
{
|
{
|
||||||
if(dbContext.ATMs.FirstOrDefault(a => a.Id == currentATM.Id) == null)
|
if (dbContext.ATMs.FirstOrDefault(a => a.Id == currentATM.Id) == null)
|
||||||
{
|
{
|
||||||
var dataSet = new ATM
|
var dataSet = new ATM
|
||||||
{
|
{
|
||||||
@@ -46,7 +46,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(addedATMs > 0)
|
if (addedATMs > 0)
|
||||||
{
|
{
|
||||||
NAPI.Util.ConsoleOutput(addedATMs + " Geldautomaten hinzugefügt");
|
NAPI.Util.ConsoleOutput(addedATMs + " Geldautomaten hinzugefügt");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using ReallifeGamemode.Server.Business;
|
using ReallifeGamemode.Server.Business;
|
||||||
using ReallifeGamemode.Server.Entities;
|
using ReallifeGamemode.Server.Entities;
|
||||||
using ReallifeGamemode.Server.Extensions;
|
using ReallifeGamemode.Server.Extensions;
|
||||||
@@ -51,7 +52,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
public void BusinessDepositMoney(Client player, int amount)
|
public void BusinessDepositMoney(Client player, int amount)
|
||||||
{
|
{
|
||||||
User user = player.GetUser();
|
User user = player.GetUser();
|
||||||
if(user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -70,7 +71,8 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
player.SendNotification("~r~Du hast nicht genug Geld");
|
player.SendNotification("~r~Du hast nicht genug Geld");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else */if(result == TransactionResult.SUCCESS)
|
else */
|
||||||
|
if (result == TransactionResult.SUCCESS)
|
||||||
{
|
{
|
||||||
player.TriggerEvent("business_updateMoney", playerBusiness.GetBankAccount().Balance.ToMoneyString());
|
player.TriggerEvent("business_updateMoney", playerBusiness.GetBankAccount().Balance.ToMoneyString());
|
||||||
player.SendNotification("~g~Du hast erfolgreich ~s~" + amount.ToMoneyString() + " ~g~ überwiesen");
|
player.SendNotification("~g~Du hast erfolgreich ~s~" + amount.ToMoneyString() + " ~g~ überwiesen");
|
||||||
@@ -114,13 +116,22 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
{
|
{
|
||||||
ServerVehicle sVeh = veh.GetServerVehicle();
|
ServerVehicle sVeh = veh.GetServerVehicle();
|
||||||
if (sVeh == null) return;
|
if (sVeh == null) return;
|
||||||
if(!(sVeh is ShopVehicle)) return;
|
if (!(sVeh is ShopVehicle)) return;
|
||||||
ShopVehicle shopVehicle = (ShopVehicle)sVeh;
|
ShopVehicle shopVehicle = (ShopVehicle)sVeh;
|
||||||
player.TriggerEvent("ShopVehicle_OpenMenu", GetBusiness(shopVehicle.BusinessId).Name, shopVehicle.Price);
|
|
||||||
|
List<string> availableTargets = new List<string>()
|
||||||
|
{
|
||||||
|
"Spieler"
|
||||||
|
};
|
||||||
|
|
||||||
|
if (player.GetUser().FactionLeader && !player.GetUser().Faction.StateOwned) availableTargets.Add("Fraktion");
|
||||||
|
if (player.GetUser().GroupRank == GroupRank.OWNER) availableTargets.Add("Gruppe");
|
||||||
|
|
||||||
|
player.TriggerEvent("ShopVehicle_OpenMenu", GetBusiness(shopVehicle.BusinessId).Name, shopVehicle.Price, availableTargets.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
[RemoteEvent("VehShop_BuyVehicle")]
|
[RemoteEvent("VehShop_BuyVehicle")]
|
||||||
public void CarDealerBusiness_BuyVehicle(Client player)
|
public void CarDealerBusiness_BuyVehicle(Client player, string target)
|
||||||
{
|
{
|
||||||
ServerVehicle sVeh = player.Vehicle?.GetServerVehicle();
|
ServerVehicle sVeh = player.Vehicle?.GetServerVehicle();
|
||||||
if (sVeh == null) return;
|
if (sVeh == null) return;
|
||||||
@@ -129,7 +140,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
int price = shopVehicle.Price;
|
int price = shopVehicle.Price;
|
||||||
CarDealerBusinessBase business = GetBusiness(shopVehicle.BusinessId) as CarDealerBusinessBase;
|
CarDealerBusinessBase business = GetBusiness(shopVehicle.BusinessId) as CarDealerBusinessBase;
|
||||||
TransactionResult result = BankManager.TransferMoney(player.GetUser(), business, price, "Auto gekauft");
|
TransactionResult result = BankManager.TransferMoney(player.GetUser(), business, price, "Auto gekauft");
|
||||||
if(result == TransactionResult.SENDER_NOT_ENOUGH_MONEY)
|
if (result == TransactionResult.SENDER_NOT_ENOUGH_MONEY)
|
||||||
{
|
{
|
||||||
player.SendNotification("~r~Du hast nicht genug Geld: " + price.ToMoneyString());
|
player.SendNotification("~r~Du hast nicht genug Geld: " + price.ToMoneyString());
|
||||||
return;
|
return;
|
||||||
@@ -139,23 +150,60 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
|
|
||||||
player.TriggerEvent("SERVER:Util_setWaypoint", spawnPos.X, spawnPos.Y);
|
player.TriggerEvent("SERVER:Util_setWaypoint", spawnPos.X, spawnPos.Y);
|
||||||
|
|
||||||
UserVehicle newVeh = new UserVehicle
|
ServerVehicle newVeh = null;
|
||||||
{
|
|
||||||
Heading = business.CarSpawnHeading,
|
|
||||||
PositionX = spawnPos.X,
|
|
||||||
PositionY = spawnPos.Y,
|
|
||||||
PositionZ = spawnPos.Z,
|
|
||||||
Locked = false,
|
|
||||||
UserId = player.GetUser().Id,
|
|
||||||
Model = shopVehicle.Model,
|
|
||||||
PrimaryColor = 111,
|
|
||||||
SecondaryColor = 111,
|
|
||||||
Active = true,
|
|
||||||
};
|
|
||||||
|
|
||||||
using(var dbContext = new DatabaseContext())
|
if(target == "Spieler")
|
||||||
{
|
{
|
||||||
dbContext.UserVehicles.Add(newVeh);
|
newVeh = new UserVehicle
|
||||||
|
{
|
||||||
|
Heading = business.CarSpawnHeading,
|
||||||
|
PositionX = spawnPos.X,
|
||||||
|
PositionY = spawnPos.Y,
|
||||||
|
PositionZ = spawnPos.Z,
|
||||||
|
Locked = false,
|
||||||
|
UserId = player.GetUser().Id,
|
||||||
|
Model = shopVehicle.Model,
|
||||||
|
PrimaryColor = 111,
|
||||||
|
SecondaryColor = 111,
|
||||||
|
Active = true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else if(target == "Fraktion")
|
||||||
|
{
|
||||||
|
newVeh = new FactionVehicle
|
||||||
|
{
|
||||||
|
Heading = business.CarSpawnHeading,
|
||||||
|
PositionX = spawnPos.X,
|
||||||
|
PositionY = spawnPos.Y,
|
||||||
|
PositionZ = spawnPos.Z,
|
||||||
|
Locked = false,
|
||||||
|
FactionId = player.GetUser().FactionId,
|
||||||
|
Model = shopVehicle.Model,
|
||||||
|
PrimaryColor = 111,
|
||||||
|
SecondaryColor = 111,
|
||||||
|
Active = true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else if(target == "Gruppe")
|
||||||
|
{
|
||||||
|
newVeh = new GroupVehicle
|
||||||
|
{
|
||||||
|
Heading = business.CarSpawnHeading,
|
||||||
|
PositionX = spawnPos.X,
|
||||||
|
PositionY = spawnPos.Y,
|
||||||
|
PositionZ = spawnPos.Z,
|
||||||
|
Locked = false,
|
||||||
|
GroupId = player.GetUser().Group.Id,
|
||||||
|
Model = shopVehicle.Model,
|
||||||
|
PrimaryColor = 111,
|
||||||
|
SecondaryColor = 111,
|
||||||
|
Active = true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
dbContext.ServerVehicles.Add(newVeh);
|
||||||
dbContext.SaveChanges();
|
dbContext.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
67
ReallifeGamemode.Server/Managers/CityHallManager.cs
Normal file
67
ReallifeGamemode.Server/Managers/CityHallManager.cs
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
using GTANetworkAPI;
|
||||||
|
using ReallifeGamemode.Server.Entities;
|
||||||
|
using ReallifeGamemode.Server.Extensions;
|
||||||
|
using ReallifeGamemode.Server.Models;
|
||||||
|
using ReallifeGamemode.Server.Services;
|
||||||
|
using ReallifeGamemode.Server.Util;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Managers
|
||||||
|
{
|
||||||
|
class CityHallManager : Script
|
||||||
|
{
|
||||||
|
private static readonly Vector3 _cityHallPosition = new Vector3(273.22, -278.14, 53.9);
|
||||||
|
|
||||||
|
public static void LoadCityHall()
|
||||||
|
{
|
||||||
|
NAPI.Marker.CreateMarker(MarkerType.VerticalCylinder, _cityHallPosition.Subtract(new Vector3(0, 0, 1.7)), new Vector3(), new Vector3(), 1.0f, new Color(255, 255, 255));
|
||||||
|
NAPI.TextLabel.CreateTextLabel("~y~Stadthalle~s~\nDrücke ~o~E~s~, um das Menü zu öffnen", _cityHallPosition, 5.0f, 1f, 0, new Color(255, 255, 255));
|
||||||
|
var colShape = NAPI.ColShape.CreateSphereColShape(_cityHallPosition, 1.0f);
|
||||||
|
colShape.OnEntityEnterColShape += (s, c) =>
|
||||||
|
{
|
||||||
|
c.TriggerEvent("SERVER:CityHall_ShowHelpText");
|
||||||
|
};
|
||||||
|
|
||||||
|
colShape.OnEntityExitColShape += (s, c) =>
|
||||||
|
{
|
||||||
|
c.TriggerEvent("SERVER:CityHall_ClearHelpText");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[RemoteEvent("CLIENT:CityHall_CreateGroup")]
|
||||||
|
public void CreateGroup(Client player, string name)
|
||||||
|
{
|
||||||
|
using (var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
User u = player.GetUser(dbContext);
|
||||||
|
if(u.Group != null)
|
||||||
|
{
|
||||||
|
ChatService.Error(player, "Du bist schon in einer Gruppe");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(dbContext.Groups.Any(g => g.Name.ToLower() == name.ToLower()))
|
||||||
|
{
|
||||||
|
ChatService.Error(player, "Dieser Name ist schon vergeben");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Group group = new Group
|
||||||
|
{
|
||||||
|
Name = name
|
||||||
|
};
|
||||||
|
|
||||||
|
dbContext.Groups.Add(group);
|
||||||
|
|
||||||
|
u.Group = group;
|
||||||
|
u.GroupRank = GroupRank.OWNER;
|
||||||
|
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
|
ChatService.BroadcastGroup($"Die Gruppe \"{name}\" wurde erfolgreich erstellt.", group);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,7 +21,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
{
|
{
|
||||||
using (var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
foreach(Door door in dbContext.Doors)
|
foreach (Door door in dbContext.Doors)
|
||||||
{
|
{
|
||||||
_doorColShapes[door.Id] = NAPI.ColShape.CreateSphereColShape(door.Position, 30f);
|
_doorColShapes[door.Id] = NAPI.ColShape.CreateSphereColShape(door.Position, 30f);
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
|
|
||||||
public static void ReloadDoors()
|
public static void ReloadDoors()
|
||||||
{
|
{
|
||||||
foreach(var doorPair in _doorColShapes)
|
foreach (var doorPair in _doorColShapes)
|
||||||
{
|
{
|
||||||
doorPair.Value.Entity<ColShape>().Delete();
|
doorPair.Value.Entity<ColShape>().Delete();
|
||||||
}
|
}
|
||||||
@@ -47,9 +47,9 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
IQueryable<Door> NearDoors = dbContext.Doors.Where(d => d.Position.DistanceTo(player.Position) <= d.Radius);
|
IQueryable<Door> NearDoors = dbContext.Doors.Where(d => d.Position.DistanceTo(player.Position) <= d.Radius);
|
||||||
foreach (Door d in NearDoors)
|
foreach (Door d in NearDoors)
|
||||||
{
|
{
|
||||||
if(!user.IsAdmin(AdminLevel.ADMIN) && (d.FactionId != user.FactionId || d.FactionId == null))
|
if (!user.IsAdmin(AdminLevel.ADMIN) && (d.FactionId != user.FactionId || d.FactionId == null))
|
||||||
{
|
{
|
||||||
string lockState = "~r~Du hast kein Recht diese T\u00fcr " + (d.Locked == true ? "auf" : "ab") + "zuschlie\u00dfen!";
|
string lockState = "~r~Du hast kein Recht diese T\u00fcr " + (d.Locked == true ? "auf" : "ab") + "zuschlie\u00dfen!";
|
||||||
player.SendNotification(lockState, true);
|
player.SendNotification(lockState, true);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -69,11 +69,11 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
[ServerEvent(Event.PlayerEnterColshape)]
|
[ServerEvent(Event.PlayerEnterColshape)]
|
||||||
public void DoorManagerPlayerEnterColShapeEvent(ColShape colShape, Client player)
|
public void DoorManagerPlayerEnterColShapeEvent(ColShape colShape, Client player)
|
||||||
{
|
{
|
||||||
if(_doorColShapes.ContainsValue(colShape.Handle))
|
if (_doorColShapes.ContainsValue(colShape.Handle))
|
||||||
{
|
{
|
||||||
int doorId = _doorColShapes.Where(d => d.Value.Value == colShape.Handle.Value).FirstOrDefault().Key;
|
int doorId = _doorColShapes.Where(d => d.Value.Value == colShape.Handle.Value).FirstOrDefault().Key;
|
||||||
|
|
||||||
using(var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
Door door = dbContext.Doors.Where(d => d.Id == doorId).First();
|
Door door = dbContext.Doors.Where(d => d.Id == doorId).First();
|
||||||
player.TriggerEvent("changeDoorState", door.Model, door.X, door.Y, door.Z, (door.Locked ? 1 : 0), 0.0f, 0.0f, 0.0f);
|
player.TriggerEvent("changeDoorState", door.Model, door.X, door.Y, door.Z, (door.Locked ? 1 : 0), 0.0f, 0.0f, 0.0f);
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using ReallifeGamemode.Server.Entities;
|
||||||
using ReallifeGamemode.Server.Extensions;
|
using ReallifeGamemode.Server.Extensions;
|
||||||
using ReallifeGamemode.Server.Models;
|
using ReallifeGamemode.Server.Models;
|
||||||
using ReallifeGamemode.Server.Services;
|
using ReallifeGamemode.Server.Services;
|
||||||
|
using ReallifeGamemode.Server.Util;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@@ -21,6 +24,108 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
#region Umgebungsinteraktionen PFEILTASTE-HOCH
|
#region Umgebungsinteraktionen PFEILTASTE-HOCH
|
||||||
#endregion
|
#endregion
|
||||||
#region Eigeninteraktionen PFEILTASTE-RUNTER
|
#region Eigeninteraktionen PFEILTASTE-RUNTER
|
||||||
|
[RemoteEvent("CLIENT:InteractionMenu_AcceptInvite")]
|
||||||
|
public void InteractionMenuAcceptInvite(Client player, string type)
|
||||||
|
{
|
||||||
|
if (type != "Fraktion" || type != "Gruppe") return;
|
||||||
|
|
||||||
|
if (type == "Fraktion") // Fraktions Invite annehmen
|
||||||
|
{
|
||||||
|
if (!player.HasData("accept_faction_invite"))
|
||||||
|
{
|
||||||
|
ChatService.Error(player, "Du hast keine Einladung in eine Fraktion erhalten");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Client leader = NAPI.Player.GetPlayerFromHandle((NetHandle)player.GetData("accept_faction_invite"));
|
||||||
|
player.ResetData("accept_faction_invite");
|
||||||
|
|
||||||
|
if (leader == null)
|
||||||
|
{
|
||||||
|
ChatService.Error(player, "Die Einladung ist abgelaufen");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
User u = leader.GetUser(dbContext);
|
||||||
|
User own = player.GetUser(dbContext);
|
||||||
|
|
||||||
|
own.FactionId = u.FactionId;
|
||||||
|
own.FactionLeader = false;
|
||||||
|
own.FactionRankId = dbContext
|
||||||
|
.FactionRanks
|
||||||
|
.OrderBy(x => x.Order)
|
||||||
|
.Where(r => r.FactionId == own.FactionId)
|
||||||
|
.FirstOrDefault()?.Id ?? null;
|
||||||
|
|
||||||
|
leader.SendChatMessage("!{02FCFF}" + player.Name + " hat die Einladung angenommen.");
|
||||||
|
player.SendChatMessage("!{02FCFF}Du hast die Einladung angenommen.");
|
||||||
|
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type == "Gruppe") // Gruppen Einladung annehmen
|
||||||
|
{
|
||||||
|
if (!player.HasData("accept_group_invite"))
|
||||||
|
{
|
||||||
|
ChatService.Error(player, "Du hast keine Einladung in eine Gruppe erhalten");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Client leader = NAPI.Player.GetPlayerFromHandle((NetHandle)player.GetData("accept_group_invite"));
|
||||||
|
player.ResetData("accept_group_invite");
|
||||||
|
|
||||||
|
if (leader == null)
|
||||||
|
{
|
||||||
|
ChatService.Error(player, "Die Einladung ist abgelaufen");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
User u = leader.GetUser(dbContext);
|
||||||
|
User own = player.GetUser(dbContext);
|
||||||
|
|
||||||
|
own.Group = u.Group;
|
||||||
|
own.GroupRank = GroupRank.MEMBER;
|
||||||
|
|
||||||
|
leader.SendChatMessage("!{02FCFF}" + player.Name + " hat die Einladung angenommen.");
|
||||||
|
player.SendChatMessage("!{02FCFF}Du hast die Einladung angenommen.");
|
||||||
|
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[RemoteEvent("CLIENT:InteractionMenu_InviteFaction")]
|
||||||
|
public void InteractionMenuInviteFaction(Client player, string nameOrId)
|
||||||
|
{
|
||||||
|
if (player.GetUser()?.FactionId == null || player.GetUser().FactionLeader == false)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Client target = ClientService.GetClientByNameOrId(nameOrId);
|
||||||
|
if (target == null || !target.IsLoggedIn())
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotFound(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target.GetUser()?.FactionId != null)
|
||||||
|
{
|
||||||
|
ChatService.Error(player, "Dieser Spieler ist schon in einer Fraktion");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
target.SetData("accept_faction_invite", player.Handle);
|
||||||
|
|
||||||
|
player.SendChatMessage("!{02FCFF}Du hast dem Spieler " + target.Name + " eine Einladung in deine Fraktion gesendet.");
|
||||||
|
target.SendChatMessage("!{02FCFF}Du hast von " + player.Name + " eine Einladung in die Fraktion \"" + player.GetUser().Faction.Name + "\" erhalten.");
|
||||||
|
target.SendChatMessage("!{02FCFF}Benutze das Interaktionsmenü, um die Einladung anzunehmen");
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Spielerinteraktionen PFEILTASTE-LINKS
|
#region Spielerinteraktionen PFEILTASTE-LINKS
|
||||||
[RemoteEvent("openTradeInventory")]
|
[RemoteEvent("openTradeInventory")]
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
|
|
||||||
public static Interior GetInteriorByName(string name, DatabaseContext dbContext = null)
|
public static Interior GetInteriorByName(string name, DatabaseContext dbContext = null)
|
||||||
{
|
{
|
||||||
if(dbContext == null)
|
if (dbContext == null)
|
||||||
{
|
{
|
||||||
using (dbContext = new DatabaseContext())
|
using (dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
@@ -61,7 +61,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
if (interior.EnterPosition != null)
|
if (interior.EnterPosition != null)
|
||||||
{
|
{
|
||||||
_interiorEnterTextLabels[interior.Id] = NAPI.TextLabel.CreateTextLabel("~y~" + interior.Name + "\n~s~Eingang", interior.EnterPosition, 10f, 1f, 0, new Color(255, 255, 255));
|
_interiorEnterTextLabels[interior.Id] = NAPI.TextLabel.CreateTextLabel("~y~" + interior.Name + "\n~s~Eingang", interior.EnterPosition, 10f, 1f, 0, new Color(255, 255, 255));
|
||||||
_interiorEnterMarkers[interior.Id] = NAPI.Marker.CreateMarker(MarkerType.VerticalCylinder, interior.EnterPosition.Subtract(new Vector3(0, 0, 1.7)), new Vector3(), new Vector3(), 2.0f, new Color(255, 255, 255, 100));
|
_interiorEnterMarkers[interior.Id] = NAPI.Marker.CreateMarker(MarkerType.VerticalCylinder, interior.EnterPosition.Subtract(new Vector3(0, 0, 1.7)), new Vector3(), new Vector3(), 1.6f, new Color(255, 255, 255, 100));
|
||||||
_interiorEnterColShapes[interior.Id] = NAPI.ColShape.CreateSphereColShape(interior.EnterPosition, 1.5f);
|
_interiorEnterColShapes[interior.Id] = NAPI.ColShape.CreateSphereColShape(interior.EnterPosition, 1.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
{
|
{
|
||||||
_interiorExitTextLabels[interior.Id] = NAPI.TextLabel.CreateTextLabel("~y~" + interior.Name + "\n~s~Ausgang", interior.ExitPosition, 10f, 1f, 0, new Color(255, 255, 255));
|
_interiorExitTextLabels[interior.Id] = NAPI.TextLabel.CreateTextLabel("~y~" + interior.Name + "\n~s~Ausgang", interior.ExitPosition, 10f, 1f, 0, new Color(255, 255, 255));
|
||||||
_interiorExitMarkers[interior.Id] = NAPI.Marker.CreateMarker(MarkerType.VerticalCylinder, interior.ExitPosition.Subtract(new Vector3(0, 0, 1.7)), new Vector3(), new Vector3(), 1.6f, new Color(255, 255, 255, 100));
|
_interiorExitMarkers[interior.Id] = NAPI.Marker.CreateMarker(MarkerType.VerticalCylinder, interior.ExitPosition.Subtract(new Vector3(0, 0, 1.7)), new Vector3(), new Vector3(), 1.6f, new Color(255, 255, 255, 100));
|
||||||
_interiorExitColShapes[interior.Id] = NAPI.ColShape.CreateSphereColShape(interior.ExitPosition, 1.3f);
|
_interiorExitColShapes[interior.Id] = NAPI.ColShape.CreateSphereColShape(interior.ExitPosition, 1.5f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,12 +114,12 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
{
|
{
|
||||||
int enterId = GetInteriorIdFromEnterColShape(colShape);
|
int enterId = GetInteriorIdFromEnterColShape(colShape);
|
||||||
int exitId = GetInteriorIdFromExitColShape(colShape);
|
int exitId = GetInteriorIdFromExitColShape(colShape);
|
||||||
if(enterId != 0)
|
if (enterId != 0)
|
||||||
{
|
{
|
||||||
Interior interior = GetInteriorById(enterId);
|
Interior interior = GetInteriorById(enterId);
|
||||||
player.TriggerEvent("InteriorManager_ShowHelpText", interior.Name, interior.Id, 0);
|
player.TriggerEvent("InteriorManager_ShowHelpText", interior.Name, interior.Id, 0);
|
||||||
}
|
}
|
||||||
else if(exitId != 0)
|
else if (exitId != 0)
|
||||||
{
|
{
|
||||||
Interior interior = GetInteriorById(exitId);
|
Interior interior = GetInteriorById(exitId);
|
||||||
player.TriggerEvent("InteriorManager_ShowHelpText", interior.Name, interior.Id, 1);
|
player.TriggerEvent("InteriorManager_ShowHelpText", interior.Name, interior.Id, 1);
|
||||||
@@ -129,7 +129,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
[ServerEvent(Event.PlayerExitColshape)]
|
[ServerEvent(Event.PlayerExitColshape)]
|
||||||
public void InteriorManagerPlayerExitColshapeEvent(ColShape colShape, Client player)
|
public void InteriorManagerPlayerExitColshapeEvent(ColShape colShape, Client player)
|
||||||
{
|
{
|
||||||
if(GetInteriorIdFromEnterColShape(colShape) != 0 || GetInteriorIdFromExitColShape(colShape) != 0)
|
if (GetInteriorIdFromEnterColShape(colShape) != 0 || GetInteriorIdFromExitColShape(colShape) != 0)
|
||||||
{
|
{
|
||||||
player.TriggerEvent("InteriorManager_ClearHelpText");
|
player.TriggerEvent("InteriorManager_ClearHelpText");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -303,10 +303,10 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
{
|
{
|
||||||
Vector3 dropPosition = ClientExtension.GetPositionFromPlayer(player, 0.6f, 0);
|
Vector3 dropPosition = ClientExtension.GetPositionFromPlayer(player, 0.6f, 0);
|
||||||
dropPosition.Z -= 0.8f;
|
dropPosition.Z -= 0.8f;
|
||||||
//new Vector3(player.Position.X, player.Position.Y, player.Position.Z - 0.8f);
|
//new Vector3(player.Position.X, player.Position.Y, player.Position.Z - 0.8f);
|
||||||
Random r = new Random();
|
Random r = new Random();
|
||||||
GTANetworkAPI.Object grndObject = NAPI.Object.CreateObject(3777723516, dropPosition, new Vector3(0, 0, r.Next(0, 360)), 0);
|
GTANetworkAPI.Object grndObject = NAPI.Object.CreateObject(3777723516, dropPosition, new Vector3(0, 0, r.Next(0, 360)), 0);
|
||||||
GroundItem grndItem = new GroundItem { ItemId = iItem.Id, Amount = amount, Position = dropPosition};
|
GroundItem grndItem = new GroundItem { ItemId = iItem.Id, Amount = amount, Position = dropPosition };
|
||||||
TextLabel grndTxtLbl = NAPI.TextLabel.CreateTextLabel(iItem.Name + " ~s~(~y~" + amount + "~s~)", dropPosition, 5, 0.5f, 4, new Color(255, 255, 255), false, 0);
|
TextLabel grndTxtLbl = NAPI.TextLabel.CreateTextLabel(iItem.Name + " ~s~(~y~" + amount + "~s~)", dropPosition, 5, 0.5f, 4, new Color(255, 255, 255), false, 0);
|
||||||
GroundItem.AddGroundItem(grndItem, grndObject, grndTxtLbl);
|
GroundItem.AddGroundItem(grndItem, grndObject, grndTxtLbl);
|
||||||
fItem.Amount -= amount;
|
fItem.Amount -= amount;
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
{
|
{
|
||||||
foreach (SavedBlip b in loadData.Blips)
|
foreach (SavedBlip b in loadData.Blips)
|
||||||
{
|
{
|
||||||
if(b.Active == true)
|
if (b.Active == true)
|
||||||
{
|
{
|
||||||
NAPI.Blip.CreateBlip((uint) b.Sprite, new Vector3(b.PositionX, b.PositionY, b.PositionZ), b.Scale,
|
NAPI.Blip.CreateBlip((uint)b.Sprite, new Vector3(b.PositionX, b.PositionY, b.PositionZ), b.Scale,
|
||||||
b.Color, b.Name, b.Alpha, b.DrawDistance, b.ShortRange, (short) b.Rotation, b.Dimension);
|
b.Color, b.Name, b.Alpha, b.DrawDistance, b.ShortRange, (short)b.Rotation, b.Dimension);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(ServerVehicle veh in loadData.ServerVehicles)
|
foreach (ServerVehicle veh in loadData.ServerVehicles)
|
||||||
{
|
{
|
||||||
if (!veh.Active) continue;
|
if (!veh.Active) continue;
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
foreach (DutyPoint d in DutyPoints)
|
foreach (DutyPoint d in DutyPoints)
|
||||||
{
|
{
|
||||||
NAPI.Marker.CreateMarker(1, new Vector3(d.Position.X, d.Position.Y, d.Position.Z - 2), new Vector3(d.Position.X, d.Position.Y, d.Position.Z + 1),
|
NAPI.Marker.CreateMarker(1, new Vector3(d.Position.X, d.Position.Y, d.Position.Z - 2), new Vector3(d.Position.X, d.Position.Y, d.Position.Z + 1),
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
float rotation = float.Parse(blipRotation);
|
float rotation = float.Parse(blipRotation);
|
||||||
byte dimension = Convert.ToByte(blipDimension);
|
byte dimension = Convert.ToByte(blipDimension);
|
||||||
|
|
||||||
NAPI.Blip.CreateBlip(uint.Parse(blipSprite), new Vector3(x,y,z), scale, color, name, alpha, drawDistance, shortRange, short.Parse(blipRotation), dimension);
|
NAPI.Blip.CreateBlip(uint.Parse(blipSprite), new Vector3(x, y, z), scale, color, name, alpha, drawDistance, shortRange, short.Parse(blipRotation), dimension);
|
||||||
|
|
||||||
using (var saveData = new DatabaseContext())
|
using (var saveData = new DatabaseContext())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
|
|
||||||
public static void StartTimeManager()
|
public static void StartTimeManager()
|
||||||
{
|
{
|
||||||
if(realTimeTimer == null)
|
if (realTimeTimer == null)
|
||||||
{
|
{
|
||||||
realTimeTimer = new Timer(1000);
|
realTimeTimer = new Timer(1000);
|
||||||
realTimeTimer.Elapsed += SetTime;
|
realTimeTimer.Elapsed += SetTime;
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
|
|
||||||
colShape.OnEntityEnterColShape += (cs, c) =>
|
colShape.OnEntityEnterColShape += (cs, c) =>
|
||||||
{
|
{
|
||||||
if(c.IsInVehicle)
|
if (c.IsInVehicle)
|
||||||
{
|
{
|
||||||
Vehicle v = c.Vehicle;
|
Vehicle v = c.Vehicle;
|
||||||
if(v.GetServerVehicle() is FactionVehicle fV && fV.GetFaction().StateOwned)
|
if (v.GetServerVehicle() is FactionVehicle fV && fV.GetFaction().StateOwned)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -60,13 +60,13 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
|
|
||||||
using (var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
foreach(VehicleMod vMod in dbContext.VehicleMods.ToList().FindAll(vM => vM.ServerVehicleId == sVeh.Id))
|
foreach (VehicleMod vMod in dbContext.VehicleMods.ToList().FindAll(vM => vM.ServerVehicleId == sVeh.Id))
|
||||||
{
|
{
|
||||||
if(vMod.Slot == 18)
|
if (vMod.Slot == 18)
|
||||||
{
|
{
|
||||||
veh.SetSharedData("mod" + vMod.Slot, true);
|
veh.SetSharedData("mod" + vMod.Slot, true);
|
||||||
}
|
}
|
||||||
else if(vMod.Slot == 22)
|
else if (vMod.Slot == 22)
|
||||||
{
|
{
|
||||||
int color = vMod.ModId - 2;
|
int color = vMod.ModId - 2;
|
||||||
if (vMod.ModId == 0) color = -1;
|
if (vMod.ModId == 0) color = -1;
|
||||||
@@ -99,9 +99,9 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
Vehicle pV = player.Vehicle;
|
Vehicle pV = player.Vehicle;
|
||||||
if (index == 0) index--;
|
if (index == 0) index--;
|
||||||
|
|
||||||
if(slot != 18)
|
if (slot != 18)
|
||||||
{
|
{
|
||||||
if(slot == 22)
|
if (slot == 22)
|
||||||
{
|
{
|
||||||
int color = index - 2;
|
int color = index - 2;
|
||||||
if (index == 0) color = -1;
|
if (index == 0) color = -1;
|
||||||
@@ -126,7 +126,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
using (var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
VehicleMod vMod = dbContext.VehicleMods.FirstOrDefault(m => m.ServerVehicleId == sV.Id && m.Slot == slot);
|
VehicleMod vMod = dbContext.VehicleMods.FirstOrDefault(m => m.ServerVehicleId == sV.Id && m.Slot == slot);
|
||||||
if(vMod == null && index != -1)
|
if (vMod == null && index != -1)
|
||||||
{
|
{
|
||||||
vMod = new VehicleMod
|
vMod = new VehicleMod
|
||||||
{
|
{
|
||||||
@@ -136,7 +136,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
};
|
};
|
||||||
dbContext.VehicleMods.Add(vMod);
|
dbContext.VehicleMods.Add(vMod);
|
||||||
}
|
}
|
||||||
else if(vMod != null && index == -1)
|
else if (vMod != null && index == -1)
|
||||||
{
|
{
|
||||||
dbContext.VehicleMods.Remove(vMod);
|
dbContext.VehicleMods.Remove(vMod);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
|
|
||||||
public static void AddVehicle(ServerVehicle serverVehicle, Vehicle vehicle)
|
public static void AddVehicle(ServerVehicle serverVehicle, Vehicle vehicle)
|
||||||
{
|
{
|
||||||
if(_serverVehicles.ContainsKey(serverVehicle.Id))
|
if (_serverVehicles.ContainsKey(serverVehicle.Id))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
|
|
||||||
public static Vehicle GetVehicleFromServerVehicle(ServerVehicle serverVehicle)
|
public static Vehicle GetVehicleFromServerVehicle(ServerVehicle serverVehicle)
|
||||||
{
|
{
|
||||||
if(!_serverVehicles.ContainsKey(serverVehicle.Id))
|
if (!_serverVehicles.ContainsKey(serverVehicle.Id))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
|
|
||||||
public static ServerVehicle GetServerVehicleFromVehicle(Vehicle veh, DatabaseContext dbContext = null)
|
public static ServerVehicle GetServerVehicleFromVehicle(Vehicle veh, DatabaseContext dbContext = null)
|
||||||
{
|
{
|
||||||
if(dbContext == null)
|
if (dbContext == null)
|
||||||
{
|
{
|
||||||
using (dbContext = new DatabaseContext())
|
using (dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
@@ -191,12 +191,12 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
|
|
||||||
public static bool IsValidHash(uint hash)
|
public static bool IsValidHash(uint hash)
|
||||||
{
|
{
|
||||||
foreach(VehicleHash vh in Enum.GetValues(typeof(VehicleHash)))
|
foreach (VehicleHash vh in Enum.GetValues(typeof(VehicleHash)))
|
||||||
{
|
{
|
||||||
if ((uint)vh == hash) return true;
|
if ((uint)vh == hash) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(string mod in _enabledMods)
|
foreach (string mod in _enabledMods)
|
||||||
{
|
{
|
||||||
if (NAPI.Util.GetHashKey(mod) == hash) return true;
|
if (NAPI.Util.GetHashKey(mod) == hash) return true;
|
||||||
}
|
}
|
||||||
|
|||||||
1107
ReallifeGamemode.Server/Migrations/20190505154643_Groups.Designer.cs
generated
Normal file
1107
ReallifeGamemode.Server/Migrations/20190505154643_Groups.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
128
ReallifeGamemode.Server/Migrations/20190505154643_Groups.cs
Normal file
128
ReallifeGamemode.Server/Migrations/20190505154643_Groups.cs
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Migrations
|
||||||
|
{
|
||||||
|
public partial class Groups : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "GroupId",
|
||||||
|
table: "Users",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "GroupRank",
|
||||||
|
table: "Users",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "GroupId",
|
||||||
|
table: "ServerVehicles",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Groups",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
Name = table.Column<string>(nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Groups", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "GroupBankAccounts",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
GroupId = table.Column<int>(nullable: true),
|
||||||
|
Balance = table.Column<int>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_GroupBankAccounts", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_GroupBankAccounts_Groups_GroupId",
|
||||||
|
column: x => x.GroupId,
|
||||||
|
principalTable: "Groups",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Users_GroupId",
|
||||||
|
table: "Users",
|
||||||
|
column: "GroupId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ServerVehicles_GroupId",
|
||||||
|
table: "ServerVehicles",
|
||||||
|
column: "GroupId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_GroupBankAccounts_GroupId",
|
||||||
|
table: "GroupBankAccounts",
|
||||||
|
column: "GroupId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ServerVehicles_Groups_GroupId",
|
||||||
|
table: "ServerVehicles",
|
||||||
|
column: "GroupId",
|
||||||
|
principalTable: "Groups",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Users_Groups_GroupId",
|
||||||
|
table: "Users",
|
||||||
|
column: "GroupId",
|
||||||
|
principalTable: "Groups",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ServerVehicles_Groups_GroupId",
|
||||||
|
table: "ServerVehicles");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Users_Groups_GroupId",
|
||||||
|
table: "Users");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "GroupBankAccounts");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Groups");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Users_GroupId",
|
||||||
|
table: "Users");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_ServerVehicles_GroupId",
|
||||||
|
table: "ServerVehicles");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "GroupId",
|
||||||
|
table: "Users");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "GroupRank",
|
||||||
|
table: "Users");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "GroupId",
|
||||||
|
table: "ServerVehicles");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -374,6 +374,34 @@ namespace ReallifeGamemode.Migrations
|
|||||||
b.ToTable("GotoPoints");
|
b.ToTable("GotoPoints");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Group", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("Name");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Groups");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupBankAccount", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<int>("Balance");
|
||||||
|
|
||||||
|
b.Property<int?>("GroupId");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("GroupId");
|
||||||
|
|
||||||
|
b.ToTable("GroupBankAccounts");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Interior", b =>
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Interior", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@@ -744,6 +772,10 @@ namespace ReallifeGamemode.Migrations
|
|||||||
|
|
||||||
b.Property<int?>("FactionRankId");
|
b.Property<int?>("FactionRankId");
|
||||||
|
|
||||||
|
b.Property<int?>("GroupId");
|
||||||
|
|
||||||
|
b.Property<int>("GroupRank");
|
||||||
|
|
||||||
b.Property<int>("Handmoney");
|
b.Property<int>("Handmoney");
|
||||||
|
|
||||||
b.Property<int>("LogUserId");
|
b.Property<int>("LogUserId");
|
||||||
@@ -779,6 +811,8 @@ namespace ReallifeGamemode.Migrations
|
|||||||
|
|
||||||
b.HasIndex("FactionRankId");
|
b.HasIndex("FactionRankId");
|
||||||
|
|
||||||
|
b.HasIndex("GroupId");
|
||||||
|
|
||||||
b.ToTable("Users");
|
b.ToTable("Users");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -870,6 +904,17 @@ namespace ReallifeGamemode.Migrations
|
|||||||
b.HasDiscriminator().HasValue("FactionVehicle");
|
b.HasDiscriminator().HasValue("FactionVehicle");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupVehicle", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle");
|
||||||
|
|
||||||
|
b.Property<int?>("GroupId");
|
||||||
|
|
||||||
|
b.HasIndex("GroupId");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("GroupVehicle");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Saves.SavedVehicle", b =>
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Saves.SavedVehicle", b =>
|
||||||
{
|
{
|
||||||
b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle");
|
b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle");
|
||||||
@@ -960,6 +1005,13 @@ namespace ReallifeGamemode.Migrations
|
|||||||
.OnDelete(DeleteBehavior.Cascade);
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupBankAccount", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GroupId");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Logs.Death", b =>
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Logs.Death", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("ReallifeGamemode.Server.Entities.User", "Killer")
|
b.HasOne("ReallifeGamemode.Server.Entities.User", "Killer")
|
||||||
@@ -996,6 +1048,10 @@ namespace ReallifeGamemode.Migrations
|
|||||||
b.HasOne("ReallifeGamemode.Server.Entities.FactionRank", "FactionRank")
|
b.HasOne("ReallifeGamemode.Server.Entities.FactionRank", "FactionRank")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("FactionRankId");
|
.HasForeignKey("FactionRankId");
|
||||||
|
|
||||||
|
b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GroupId");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserBankAccount", b =>
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserBankAccount", b =>
|
||||||
@@ -1029,6 +1085,13 @@ namespace ReallifeGamemode.Migrations
|
|||||||
.HasForeignKey("FactionId");
|
.HasForeignKey("FactionId");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupVehicle", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GroupId");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserVehicle", b =>
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserVehicle", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("ReallifeGamemode.Server.Entities.User", "User")
|
b.HasOne("ReallifeGamemode.Server.Entities.User", "User")
|
||||||
|
|||||||
@@ -94,5 +94,10 @@ namespace ReallifeGamemode.Server.Models
|
|||||||
|
|
||||||
// Tuning Garages
|
// Tuning Garages
|
||||||
public DbSet<Entities.TuningGarage> TuningGarages { get; set; }
|
public DbSet<Entities.TuningGarage> TuningGarages { get; set; }
|
||||||
|
|
||||||
|
// Gruppen
|
||||||
|
public DbSet<Entities.Group> Groups { get; set; }
|
||||||
|
public DbSet<Entities.GroupBankAccount> GroupBankAccounts { get; set; }
|
||||||
|
public DbSet<Entities.GroupVehicle> GroupVehicles { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,17 +16,17 @@ namespace ReallifeGamemode.Server.Services
|
|||||||
{
|
{
|
||||||
public static void NotAuthorized(Client player)
|
public static void NotAuthorized(Client player)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Du kannst diesen Befehl nicht ausführen.");
|
ChatService.Error(player, "Du kannst diesen Befehl nicht ausführen");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PlayerNotFound(Client player)
|
public static void PlayerNotFound(Client player)
|
||||||
{
|
{
|
||||||
ChatService.Error(player, "Der Spieler wurde nicht gefunden.");
|
ChatService.Error(player, "Der Spieler wurde nicht gefunden");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Error(Client player, string message)
|
public static void Error(Client player, string message)
|
||||||
{
|
{
|
||||||
player.SendChatMessage($"~r~[FEHLER]~s~ {message}.");
|
player.SendChatMessage($"~r~[FEHLER]~s~ {message}~s~.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -68,7 +68,21 @@ namespace ReallifeGamemode.Server.Services
|
|||||||
{
|
{
|
||||||
NAPI.Pools.GetAllPlayers().ForEach(p =>
|
NAPI.Pools.GetAllPlayers().ForEach(p =>
|
||||||
{
|
{
|
||||||
if(p.GetUser()?.IsAdmin(minLevel) ?? false)
|
if (p.GetUser()?.IsAdmin(minLevel) ?? false)
|
||||||
|
{
|
||||||
|
p.SendChatMessage(message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void BroadcastGroup(string message, Group group)
|
||||||
|
{
|
||||||
|
message = $"!{{FF8080}}** Gruppe: {message}";
|
||||||
|
|
||||||
|
NAPI.Pools.GetAllPlayers().ForEach(p =>
|
||||||
|
{
|
||||||
|
Group pGroup = p.GetUser()?.Group;
|
||||||
|
if (pGroup?.Id == group.Id)
|
||||||
{
|
{
|
||||||
p.SendChatMessage(message);
|
p.SendChatMessage(message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace ReallifeGamemode.Server.Services
|
|||||||
|
|
||||||
List<Client> playerList = NAPI.Pools.GetAllPlayers();
|
List<Client> playerList = NAPI.Pools.GetAllPlayers();
|
||||||
|
|
||||||
if(int.TryParse(nameOrId, out int id))
|
if (int.TryParse(nameOrId, out int id))
|
||||||
{
|
{
|
||||||
toReturn = playerList.Find(p => p.Handle.Value == id);
|
toReturn = playerList.Find(p => p.Handle.Value == id);
|
||||||
return toReturn;
|
return toReturn;
|
||||||
@@ -33,7 +33,7 @@ namespace ReallifeGamemode.Server.Services
|
|||||||
|
|
||||||
toReturn = playerList.Find(p => p.Name.ToLower() == nameOrId);
|
toReturn = playerList.Find(p => p.Name.ToLower() == nameOrId);
|
||||||
|
|
||||||
if(toReturn == null)
|
if (toReturn == null)
|
||||||
{
|
{
|
||||||
toReturn = playerList.Find(p => p.Name.ToLower().StartsWith(nameOrId));
|
toReturn = playerList.Find(p => p.Name.ToLower().StartsWith(nameOrId));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace ReallifeGamemode.Server.Util
|
|||||||
public static void InitDatabaseFirstTime()
|
public static void InitDatabaseFirstTime()
|
||||||
{
|
{
|
||||||
NAPI.Util.ConsoleOutput("Initializing database...");
|
NAPI.Util.ConsoleOutput("Initializing database...");
|
||||||
using(var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
dbContext.Users.FirstOrDefault();
|
dbContext.Users.FirstOrDefault();
|
||||||
dbContext.SaveChanges();
|
dbContext.SaveChanges();
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ namespace ReallifeGamemode.Server.Util
|
|||||||
public static void CheckFactionBankAccounts()
|
public static void CheckFactionBankAccounts()
|
||||||
{
|
{
|
||||||
NAPI.Util.ConsoleOutput("Checking faction bank accounts...");
|
NAPI.Util.ConsoleOutput("Checking faction bank accounts...");
|
||||||
using(var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
foreach(Faction faction in dbContext.Factions)
|
foreach (Faction faction in dbContext.Factions)
|
||||||
{
|
{
|
||||||
if(faction.GetBankAccount(dbContext) == null)
|
if (faction.GetBankAccount(dbContext) == null)
|
||||||
{
|
{
|
||||||
NAPI.Util.ConsoleOutput("Adding bank account for faction: " + faction.Name);
|
NAPI.Util.ConsoleOutput("Adding bank account for faction: " + faction.Name);
|
||||||
FactionBankAccount factionBankAccount = new FactionBankAccount()
|
FactionBankAccount factionBankAccount = new FactionBankAccount()
|
||||||
|
|||||||
14
ReallifeGamemode.Server/Util/GroupRanks.cs
Normal file
14
ReallifeGamemode.Server/Util/GroupRanks.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Util
|
||||||
|
{
|
||||||
|
public enum GroupRank
|
||||||
|
{
|
||||||
|
NONE,
|
||||||
|
MEMBER,
|
||||||
|
MANAGER,
|
||||||
|
OWNER
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -207,7 +207,7 @@ namespace ReallifeGamemode.Server.Util
|
|||||||
NAPI.ClientEvent.TriggerClientEventInDimension(veh.Dimension, "VehStream_SetLockStatus", veh, status);
|
NAPI.ClientEvent.TriggerClientEventInDimension(veh.Dimension, "VehStream_SetLockStatus", veh, status);
|
||||||
NAPI.Pools.GetAllPlayers().ForEach(p =>
|
NAPI.Pools.GetAllPlayers().ForEach(p =>
|
||||||
{
|
{
|
||||||
if(p.IsInVehicle && p.Vehicle.Handle == veh.Handle)
|
if (p.IsInVehicle && p.Vehicle.Handle == veh.Handle)
|
||||||
{
|
{
|
||||||
p.TriggerEvent("Vehicle_setLockStatus", status);
|
p.TriggerEvent("Vehicle_setLockStatus", status);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user