Merge branch 'develop' into 'master'
No commit message See merge request log-gtav/reallife-gamemode!40
This commit is contained in:
File diff suppressed because it is too large
Load Diff
1144
ReallifeGamemode.Client/Gui/Inventory/inventory_old.ts
Normal file
1144
ReallifeGamemode.Client/Gui/Inventory/inventory_old.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -202,7 +202,7 @@ export default function (globalData: IGlobalData): void {
|
||||
centre: false
|
||||
})
|
||||
|
||||
mp.game.graphics.drawText(dateString + "\n" + timeString, [0.938, 0.381],
|
||||
mp.game.graphics.drawText(timeString + "\n" + dateString, [0.938, 0.381],
|
||||
{
|
||||
font: 4,
|
||||
color: [255, 255, 255, 255],
|
||||
@@ -219,7 +219,7 @@ export default function (globalData: IGlobalData): void {
|
||||
outline: true,
|
||||
centre: false
|
||||
})
|
||||
mp.game.graphics.drawText("~r~Datum: ", [0.89, 0.381],
|
||||
mp.game.graphics.drawText("~r~Datum: ", [0.891, 0.411],
|
||||
{
|
||||
font: 4,
|
||||
color: [255, 255, 255, 255],
|
||||
@@ -227,7 +227,7 @@ export default function (globalData: IGlobalData): void {
|
||||
outline: true,
|
||||
centre: false
|
||||
})
|
||||
mp.game.graphics.drawText("~r~Uhrzeit: ", [0.891, 0.411],
|
||||
mp.game.graphics.drawText("~r~Uhrzeit: ", [0.89, 0.381],
|
||||
{
|
||||
font: 4,
|
||||
color: [255, 255, 255, 255],
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { IGame, IEntity } from "../game";
|
||||
import game from "..";
|
||||
|
||||
|
||||
const maxDistance = 40 * 40;
|
||||
const width = 0.03;
|
||||
const height = 0.0065;
|
||||
@@ -27,9 +26,7 @@ const colors = [
|
||||
{ id: 9, color: [0, 166, 133, alpha] }, //news
|
||||
];
|
||||
|
||||
|
||||
export default function customNametags() {
|
||||
|
||||
mp.nametags.enabled = false;
|
||||
|
||||
mp.events.add('render', (nametags) => {
|
||||
@@ -68,18 +65,18 @@ export default function customNametags() {
|
||||
|
||||
if (armour > 0) {
|
||||
graphics.drawRect(x, y2, width + border * 2, height + border * 2, 0, 0, 0, 200);
|
||||
graphics.drawRect(x, y2, width, height, 150, 150, 150, 255);
|
||||
graphics.drawRect(x, y2, width, height, 50, 0, 0, 255);
|
||||
graphics.drawRect(x - width / 2 * (1 - health), y2, width * health, height, 200, 0, 0, 200);
|
||||
|
||||
var x2 = x + width / 2 + border / 2;
|
||||
|
||||
graphics.drawRect(x, y2 + height, width + border * 2, height + border * 2, 0, 0, 0, 200);
|
||||
graphics.drawRect(x, y2 + height, width, height, 200, 200, 200, 255);
|
||||
graphics.drawRect(x, y2 + height, width, height, 80, 80, 80, 255);
|
||||
graphics.drawRect(x - width / 2 * (1 - armour), y2 + height, width * armour, height, 255, 255, 255, 200);
|
||||
}
|
||||
else {
|
||||
graphics.drawRect(x, y2, width + border * 2, height + border * 2, 0, 0, 0, 200);
|
||||
graphics.drawRect(x, y2, width, height, 150, 150, 150, 255);
|
||||
graphics.drawRect(x, y2, width, height, 50, 0, 0, 255);
|
||||
graphics.drawRect(x - width / 2 * (1 - health), y2, width * health, height, 200, 0, 0, 200);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
} else {
|
||||
if (tasks[index].MedicName === "none") {
|
||||
mp.game.graphics.requestStreamedTextureDict("medicimages", true);
|
||||
mp.events.callRemote("updateMedicTask", 0, index);
|
||||
mp.events.callRemote("updateMedicTask", 0, tasks[index].Victim);
|
||||
mp.game.ui.setNewWaypoint(tasks[index].Position.x, tasks[index].Position.y);
|
||||
activeCheckpoint = mp.checkpoints.new(1, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 2), 3.0,
|
||||
{
|
||||
@@ -367,7 +367,7 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
} else {
|
||||
if (tasks[index].MedicName === "none") {
|
||||
mp.game.graphics.requestStreamedTextureDict("medicimages", true);
|
||||
mp.events.callRemote("updateMedicTask", 1, index);
|
||||
mp.events.callRemote("updateMedicTask", 1, tasks[index].Victim);
|
||||
mp.game.ui.setNewWaypoint(tasks[index].Position.x, tasks[index].Position.y);
|
||||
activeCheckpoint = mp.checkpoints.new(1, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 2), 3.0,
|
||||
{
|
||||
|
||||
@@ -27,6 +27,8 @@ export default function (globalData: IGlobalData) {
|
||||
|
||||
var groupItem = new UIMenuItem("Gruppe", "Verwalte deine Gruppe");
|
||||
|
||||
var jobItem = new UIMenuItem("Job", "Infos zu deinem Job");
|
||||
|
||||
var paycheckItem = new UIMenuItem("Gehaltsscheck", "Schaue dir deinen Verdienst der letzten Stunde an");
|
||||
|
||||
var licenseItem = new UIMenuItem("Lizenzen", "Lizenzen Informationen");
|
||||
@@ -41,10 +43,11 @@ export default function (globalData: IGlobalData) {
|
||||
|
||||
var groupRank = null;
|
||||
|
||||
mp.events.add("SERVER:InteractionMenu_OpenMenu", (accountDataJson: string, factionleader: string, faction: string, group: string, factionInvite: boolean, groupInvite: boolean, ticket_boolean: boolean, ticket_amount, house: boolean) => {
|
||||
mp.events.add("SERVER:InteractionMenu_OpenMenu", (accountDataJson: string, factionleader: string, jobDataJson: string, faction: string, group: string, factionInvite: boolean, groupInvite: boolean, ticket_boolean: boolean, ticket_amount, house: boolean) => {
|
||||
|
||||
|
||||
var accountData: AccountData = JSON.parse(accountDataJson);
|
||||
var jobData: JobData = JSON.parse(jobDataJson);
|
||||
//var ticket_amount = JSON.parse(ticket_amountJson);
|
||||
|
||||
var menu = getInteractionMenu();
|
||||
@@ -77,6 +80,8 @@ export default function (globalData: IGlobalData) {
|
||||
menu.AddItem(factionleaderItem);
|
||||
menu.BindMenuToItem(getFactionLeaderMenu(faction, accountData.factionVehicles, accountData.stateFaction, menu), factionleaderItem);
|
||||
}
|
||||
menu.AddItem(jobItem);
|
||||
menu.BindMenuToItem(getJobMenu(jobData, menu), jobItem);
|
||||
|
||||
if (group) {
|
||||
groupItem.SetRightLabel(group);
|
||||
@@ -208,10 +213,6 @@ export default function (globalData: IGlobalData) {
|
||||
accountMenu.AddItem(menuItem);
|
||||
}
|
||||
|
||||
menuItem = new UIMenuItem("Job");
|
||||
menuItem.SetRightLabel(data.job);
|
||||
accountMenu.AddItem(menuItem);
|
||||
|
||||
if (data.group != null) {
|
||||
menuItem = new UIMenuItem("Gruppe");
|
||||
menuItem.SetRightLabel(data.group);
|
||||
@@ -365,6 +366,67 @@ export default function (globalData: IGlobalData) {
|
||||
return factionMenu;
|
||||
}
|
||||
|
||||
function getJobMenu(jobdata: JobData, parentMenu: NativeUI.Menu): NativeUI.Menu {
|
||||
var jobMenu = new NativeUI.Menu("Job", "Job Infos / Skillpunkte", new Point(0, screenRes.y / 3), null, null);
|
||||
|
||||
var pilotLevel;
|
||||
var busLevel;
|
||||
|
||||
if (jobdata.pilotskill >= 300) {
|
||||
pilotLevel = 2;
|
||||
} else {
|
||||
pilotLevel = 1;
|
||||
}
|
||||
|
||||
if (jobdata.busskill >= 800) {
|
||||
busLevel = 3;
|
||||
} else if (jobdata.busskill >= 300) {
|
||||
busLevel = 2;
|
||||
} else {
|
||||
busLevel = 1;
|
||||
}
|
||||
|
||||
var actJobItem = new UIMenuItem("Aktueller Job:");
|
||||
actJobItem.SetRightLabel(jobdata.job)
|
||||
jobMenu.AddItem(actJobItem);
|
||||
|
||||
var pilotSkillItem = new UIMenuItem("Pilot Skill (LVL " + pilotLevel + ")");
|
||||
switch (pilotLevel) {
|
||||
case 1:
|
||||
pilotSkillItem.SetRightLabel(jobdata.pilotskill + "/300")
|
||||
break;
|
||||
case 2:
|
||||
pilotSkillItem.SetRightLabel(jobdata.pilotskill + "/MAX")
|
||||
break;
|
||||
}
|
||||
jobMenu.AddItem(pilotSkillItem);
|
||||
|
||||
var busSkillItem = new UIMenuItem("Bus Skill (LVL " + busLevel + ")");
|
||||
switch (busLevel) {
|
||||
case 1:
|
||||
busSkillItem.SetRightLabel(jobdata.busskill + "/300")
|
||||
break;
|
||||
case 2:
|
||||
busSkillItem.SetRightLabel(jobdata.busskill + "/800")
|
||||
break;
|
||||
case 3:
|
||||
busSkillItem.SetRightLabel(jobdata.busskill + "/MAX")
|
||||
break;
|
||||
}
|
||||
jobMenu.AddItem(busSkillItem);
|
||||
|
||||
var wageItem = new UIMenuItem("Verdienst");
|
||||
if (jobdata.wage > 0) {
|
||||
wageItem.SetRightLabel("~g~$" + jobdata.wage.toString())
|
||||
} else {
|
||||
wageItem.SetRightLabel("$" + jobdata.wage.toString())
|
||||
}
|
||||
jobMenu.AddItem(wageItem);
|
||||
jobMenu.Visible = false;
|
||||
mp.gui.chat.show(false);
|
||||
return jobMenu;
|
||||
}
|
||||
|
||||
function getGroupMenu(group: string, parentMenu: NativeUI.Menu): NativeUI.Menu {
|
||||
var groupMenu = new NativeUI.Menu("Gruppe", group, new Point(0, screenRes.y / 3), null, null);
|
||||
if (groupRank == "Manager" || groupRank == "Besitzer") groupMenu.AddItem(new UIMenuItem("Spieler einladen"));
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
|
||||
//https://docs.microsoft.com/de-de/windows/desktop/inputdev/virtual-key-codes
|
||||
|
||||
|
||||
const player = mp.players.local;
|
||||
import { Key } from '../game';
|
||||
import KeyBinder from 'ragemp-better-bindings';
|
||||
|
||||
export default function keys(globalData: IGlobalData) {
|
||||
|
||||
var showGui = true;
|
||||
|
||||
//ENTER
|
||||
@@ -73,7 +72,6 @@ export default function keys(globalData: IGlobalData) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//I //Inventar
|
||||
mp.keys.bind(0x49, false, function () {
|
||||
if (!globalData.InChat && !globalData.InTuning) {
|
||||
@@ -143,9 +141,13 @@ export default function keys(globalData: IGlobalData) {
|
||||
mp.gui.takeScreenshot(new Date().toLocaleDateString(), 1, 100, 80);
|
||||
});
|
||||
|
||||
KeyBinder.bind("ctrl+h", () => {
|
||||
mp.events.callRemote("keyPress:ControllH"); //hup
|
||||
return;
|
||||
});
|
||||
|
||||
//F2 //Noclip
|
||||
mp.keys.bind(0x71, false, () => {
|
||||
mp.events.callRemote("Noclip");
|
||||
|
||||
});
|
||||
}
|
||||
@@ -249,6 +249,13 @@ class RageVehicle extends RageEntity implements IVehicle {
|
||||
|
||||
this.vehicle.setDoorShut(door, instantly);
|
||||
}
|
||||
|
||||
get class(): number {
|
||||
if (mp.vehicles.exists(this.vehicle)) {
|
||||
return this.vehicle.getClass();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ interface IVehicle extends IEntity {
|
||||
setDoorsLocked(state: boolean);
|
||||
setDoorShut(door: number, instantly: boolean);
|
||||
setDoorOpen(door: number, loose: boolean, instantly: boolean);
|
||||
class: number;
|
||||
}
|
||||
|
||||
interface IEntityPool<TEntity> {
|
||||
|
||||
10
ReallifeGamemode.Client/global.d.ts
vendored
10
ReallifeGamemode.Client/global.d.ts
vendored
@@ -14,7 +14,6 @@ declare type AccountData = {
|
||||
factionRank: string;
|
||||
group: string;
|
||||
groupRank: string;
|
||||
job: string;
|
||||
paycheck: Paycheck;
|
||||
licenses: Licenses;
|
||||
vehicles: VehicleData[];
|
||||
@@ -25,6 +24,13 @@ declare type AccountData = {
|
||||
userWarn: number;
|
||||
}
|
||||
|
||||
declare type JobData = {
|
||||
job: string;
|
||||
busskill: number;
|
||||
pilotskill: number;
|
||||
wage: number;
|
||||
}
|
||||
|
||||
declare type VehicleData = {
|
||||
Id: number;
|
||||
Model: number;
|
||||
@@ -44,6 +50,8 @@ declare type Paycheck = {
|
||||
otheramount: number;
|
||||
}
|
||||
|
||||
|
||||
|
||||
declare type Licenses = {
|
||||
drivingLicenseCar: boolean;
|
||||
drivingLicenseBike: boolean;
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
import { IGame } from './game';
|
||||
import RageGame from './core/rage-mp/game';
|
||||
|
||||
|
||||
var inMenu: boolean = false;
|
||||
|
||||
let globalData: IGlobalData = {
|
||||
@@ -224,7 +223,6 @@ refuseCollector();
|
||||
import PedCreator from './Ped/PedCreator';
|
||||
PedCreator();
|
||||
|
||||
|
||||
import attachmentManager from './util/attachmentMngr';
|
||||
attachmentManager(game);
|
||||
|
||||
@@ -235,14 +233,12 @@ import bankMenuHandle from './Interaction/bankmenu';
|
||||
import InputHelper from './inputhelper';
|
||||
bankMenuHandle(globalData);
|
||||
|
||||
|
||||
import ahelp from './Gui/ahelp';
|
||||
ahelp(globalData);
|
||||
|
||||
import Introduction from './Gui/introduction';
|
||||
Introduction(globalData);
|
||||
|
||||
|
||||
import userhelp from './Gui/userhelp';
|
||||
userhelp(globalData);
|
||||
|
||||
@@ -252,6 +248,9 @@ drivingschool(globalData);
|
||||
import gangwarHandle from './util/Gangwar';
|
||||
gangwarHandle(globalData);
|
||||
|
||||
import animationSync from './util/animationSync';
|
||||
animationSync();
|
||||
|
||||
require('./Gui/policedepartment');
|
||||
require('./Gui/helptext');
|
||||
|
||||
@@ -263,5 +262,3 @@ interface VehicleData {
|
||||
export {
|
||||
VehicleData
|
||||
}
|
||||
|
||||
|
||||
|
||||
5
ReallifeGamemode.Client/package-lock.json
generated
5
ReallifeGamemode.Client/package-lock.json
generated
@@ -2879,6 +2879,11 @@
|
||||
"integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=",
|
||||
"dev": true
|
||||
},
|
||||
"ragemp-better-bindings": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/ragemp-better-bindings/-/ragemp-better-bindings-1.0.4.tgz",
|
||||
"integrity": "sha512-mev0UT74EmBen1rdg8FP9bKFsxUtDH56X2SM2JQQsWWzCzVvRP0HIt1Wqn1DuomszgSt/uzxZaufwCFbeOU+/Q=="
|
||||
},
|
||||
"randombytes": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
|
||||
|
||||
@@ -22,5 +22,8 @@
|
||||
"ProjectOpened": [
|
||||
"watch"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"ragemp-better-bindings": "^1.0.4"
|
||||
}
|
||||
}
|
||||
|
||||
155
ReallifeGamemode.Client/util/animationSync.ts
Normal file
155
ReallifeGamemode.Client/util/animationSync.ts
Normal file
@@ -0,0 +1,155 @@
|
||||
import { debug } from "util";
|
||||
|
||||
export default function animationSync() {
|
||||
let blockInput = false;
|
||||
let animationBreakTimer;
|
||||
|
||||
mp.events.add("SERVER:LoadAnimations", () => {
|
||||
animationSyncData.register("Cuffed", "mp_arresting", "idle", -1, true, 50, false);
|
||||
animationSyncData.register("doArrest", "mp_arrest_paired", "cop_p2_back_right", 3760, false, 0, false);
|
||||
animationSyncData.register("getArrest", "mp_arrest_paired", "crook_p2_back_right", 3760, false, 0, false);
|
||||
animationSyncData.register("doUncuff", "mp_arresting", "a_uncuff", 5500, false, 0, false);
|
||||
animationSyncData.register("getUncuff", "mp_arresting", "b_uncuff", 5500, false, 0, false);
|
||||
animationSyncData.register("hup", "mp_am_hold_up", "handsup_base", -1, true, 50, true);
|
||||
animationSyncData.register("carryBox", "anim@heists@box_carry@", "idle", -1, true, 50, true);
|
||||
});
|
||||
|
||||
const animationBreakMessage = [
|
||||
{ animName: "Cuffed", msg: "Handschellen gebrochen." }
|
||||
];
|
||||
|
||||
const animationSyncData =
|
||||
{
|
||||
animations: [],
|
||||
|
||||
register: function (name, animDict, animName, duration, loop, flag, endless) {
|
||||
let id = mp.game.joaat(name);
|
||||
|
||||
if (!this.animations.hasOwnProperty(id)) {
|
||||
this.animations[id] =
|
||||
{
|
||||
id: id,
|
||||
name: name,
|
||||
animDict: animDict,
|
||||
animName: animName,
|
||||
duration: duration,
|
||||
loop: loop,
|
||||
flag: flag,
|
||||
endless: endless
|
||||
};
|
||||
} else {
|
||||
mp.game.graphics.notify("Animation Sync Error: ~r~Duplicate Entry");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
mp.events.add("entityStreamIn", (entity) => {
|
||||
if (entity.type === "player" && entity.animationData) {
|
||||
if (!entity.animationData.playOnStream)
|
||||
return;
|
||||
animationSync.playAnim(entity, mp.game.joaat(entity.animationData.name));
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
setInterval(() => {
|
||||
if (mp.players.local.getVariable("AnimationData")) {
|
||||
let index = mp.game.joaat(mp.players.local.getVariable("AnimationData"));
|
||||
let currentAnim = animationSyncData.animations[index];
|
||||
let { id, name, animDict, animName, duration, loop, flag } = currentAnim;
|
||||
if (loop) {
|
||||
blockInput = true;
|
||||
} else {
|
||||
blockInput = false;
|
||||
}
|
||||
}
|
||||
|
||||
mp.players.forEachInStreamRange(
|
||||
(player) => {
|
||||
if (!player.getVariable("AnimationData")) {
|
||||
return;
|
||||
}
|
||||
|
||||
let index = mp.game.joaat(player.getVariable("AnimationData"));
|
||||
|
||||
let currentAnim = animationSyncData.animations[index];
|
||||
let { id, name, animDict, animName, duration, loop, flag } = currentAnim;
|
||||
|
||||
if (loop == true && !player.isPlayingAnim(animDict, animName, 3)) {
|
||||
loadAnimDict(animDict, function () {
|
||||
mp.players.exists(player) && 0 !== player.handle && player.taskPlayAnim(animDict, animName, 1, 0, duration, parseInt(flag), 0, !1, !1, !1)
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
|
||||
mp.events.addDataHandler("AnimationData", (entity, string) => {
|
||||
entity.clearTasksImmediately();
|
||||
if (animationBreakTimer) {
|
||||
clearInterval(animationBreakTimer);
|
||||
animationBreakTimer = null;
|
||||
}
|
||||
if (string == null) {
|
||||
blockInput = false;
|
||||
return;
|
||||
}
|
||||
|
||||
let index = mp.game.joaat(string);
|
||||
|
||||
if (!animationSyncData.animations.hasOwnProperty(index)) return;
|
||||
|
||||
let animData = animationSyncData.animations[index];
|
||||
|
||||
let { id, name, animDict, animName, duration, loop, flag, endless } = animData;
|
||||
|
||||
loadAnimDict(animDict, function () {
|
||||
mp.players.exists(entity) && 0 !== entity.handle && entity.taskPlayAnim(animDict, animName, 1, 0, duration, parseInt(flag), 0, !1, !1, !1)
|
||||
});
|
||||
|
||||
if (mp.players.local == entity) {
|
||||
if (!endless) {
|
||||
animationBreakTimer = setInterval(() => breakAnimation(name), 120000);
|
||||
}
|
||||
|
||||
if (!loop) {
|
||||
let a = setInterval(function () {
|
||||
clearInterval(a);
|
||||
mp.game.wait(500);
|
||||
mp.events.callRemote("CLIENT:ClearAnimationData", true);
|
||||
}, duration);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function breakAnimation(name) {
|
||||
let { animName, msg } = animationBreakMessage.find(c => c.animName == name)
|
||||
|
||||
if (msg)
|
||||
mp.events.call("renderTextOnScreen", msg);
|
||||
|
||||
clearInterval(animationBreakTimer);
|
||||
animationBreakTimer = null;
|
||||
mp.events.callRemote("CLIENT:ClearAnimationData", false);
|
||||
}
|
||||
|
||||
mp.events.add("render", () => {
|
||||
if (blockInput) {
|
||||
mp.game.controls.disableControlAction(32, 25, true);
|
||||
mp.game.controls.disableControlAction(32, 24, true);
|
||||
mp.game.controls.disableControlAction(32, 22, true);
|
||||
}
|
||||
});
|
||||
|
||||
function loadAnimDict(animDict, callback) {
|
||||
if (mp.game.streaming.hasAnimDictLoaded(animDict)) return void callback();
|
||||
mp.game.streaming.requestAnimDict(animDict);
|
||||
let c = setInterval(function () {
|
||||
mp.game.streaming.hasAnimDictLoaded(animDict) && (clearInterval(c), callback())
|
||||
}, 100)
|
||||
}
|
||||
|
||||
mp.events.add("SERVER:SetInFrontPosition", (entity) => {
|
||||
mp.events.callRemote("CLIENT:SET_InFrontOfPos", entity.getOffsetFromInWorldCoords(0, 1, 0));
|
||||
});
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import { IGame, IEntity } from "../game";
|
||||
|
||||
|
||||
export default function attachmentManager(game: IGame) {
|
||||
mp.events.add("SERVER:LoadAttachments", () => {
|
||||
attachmentMngr.register("char_creator_1", "prop_beggers_sign_04", 28422, new mp.Vector3(0, 0, 0), new mp.Vector3(0, 0, 0));
|
||||
@@ -9,10 +8,9 @@ export default function attachmentManager(game: IGame) {
|
||||
attachmentMngr.register("weapondeal", "ex_prop_crate_ammo_bc", "chassis_dummy", new mp.Vector3(0.08, -0.9, -0.2), new mp.Vector3(0, 0, 0));
|
||||
attachmentMngr.register("weapondeal1", "ex_office_swag_guns02", "chassis_dummy", new mp.Vector3(0, 0.8, 0), new mp.Vector3(0, 0, 0));
|
||||
attachmentMngr.register("weapondeal2", "w_sg_pumpshotgun", "chassis_dummy", new mp.Vector3(0.4, 1.6, 0.62), new mp.Vector3(90, 0, 180));
|
||||
attachmentMngr.register("handcuffs", "p_cs_cuffs_02_s", 28422, new mp.Vector3(-0.05, 0, 0), new mp.Vector3(90, 90, 0));
|
||||
});
|
||||
|
||||
|
||||
|
||||
const attachmentMngr =
|
||||
{
|
||||
attachments: {},
|
||||
|
||||
@@ -21,86 +21,74 @@
|
||||
let modifier = 1;
|
||||
let meelemodifier = 1;
|
||||
|
||||
blockInput = (mp.game.weapon.getWeapontypeGroup(player.weapon) != 2685387236);
|
||||
|
||||
switch (player.weapon) {
|
||||
case 0x1B06D571: //Pistol
|
||||
modifier = 0.4;
|
||||
meelemodifier = 1;
|
||||
blockInput = true;
|
||||
//mp.gui.chat.push("PistolModifier: " + modifier);
|
||||
break;
|
||||
case 0xBFE256D4: //Pistol_MK2
|
||||
modifier = 0.4;
|
||||
meelemodifier = 1;
|
||||
blockInput = true;
|
||||
break;
|
||||
case 0x5EF9FEC4: //Combatpistol
|
||||
modifier = 0.5;
|
||||
meelemodifier = 1;
|
||||
blockInput = true;
|
||||
break;
|
||||
case 0x99AEEB3B: //Pistol50
|
||||
modifier = 0.35;
|
||||
meelemodifier = 1;
|
||||
blockInput = true;
|
||||
break;
|
||||
case 0x2BE6766B: //SMG
|
||||
modifier = 0.25;
|
||||
meelemodifier = 1;
|
||||
blockInput = true;
|
||||
break;
|
||||
case 0x1D073A89: //Pumpshotgun
|
||||
modifier = 0.2;
|
||||
meelemodifier = 1;
|
||||
blockInput = true;
|
||||
break;
|
||||
case 0x83BF0278: //Cabinerifle
|
||||
modifier = 0.2;
|
||||
meelemodifier = 1;
|
||||
blockInput = true;
|
||||
break;
|
||||
case 0x624FE830: //Compactrifle
|
||||
modifier = 0.2;
|
||||
meelemodifier = 0.1;
|
||||
blockInput = true;
|
||||
break;
|
||||
case 0x05FC3C11: //Sniperrifle
|
||||
modifier = 0.5;
|
||||
meelemodifier = 1;
|
||||
blockInput = true;
|
||||
break;
|
||||
case 0xA2719263: //Meele Umarmed Fist
|
||||
meelemodifier = 0.1;
|
||||
modifier = 1;
|
||||
blockInput = false;
|
||||
//mp.gui.chat.push("FistModifier: " + meelemodifier);
|
||||
break;
|
||||
case 0x958A4A8F: //Meele Baseball Bat
|
||||
meelemodifier = 0.15;
|
||||
modifier = 1;
|
||||
blockInput = false;
|
||||
break;
|
||||
case 0x8BB05FD7: //Meele Flashlight
|
||||
meelemodifier = 0.1;
|
||||
modifier = 1;
|
||||
blockInput = false;
|
||||
|
||||
break;
|
||||
case 0xD8DF3C3C: //Meele Knuckle
|
||||
meelemodifier = 0.1;
|
||||
modifier = 1;
|
||||
blockInput = false;
|
||||
|
||||
//mp.gui.chat.push("KnuckleModifier: " + meelemodifier);
|
||||
break;
|
||||
case 0x678B81B1: //Meele Nightstick
|
||||
meelemodifier = 0.1;
|
||||
modifier = 1;
|
||||
blockInput = false;
|
||||
|
||||
break;
|
||||
default:
|
||||
modifier = 1;
|
||||
meelemodifier = 1;
|
||||
blockInput = false;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
export default function smoothThrottle() {
|
||||
let GlobalDisable = false;
|
||||
let DisableAntiReverse = true;
|
||||
let DisableAntiReverse = false;
|
||||
let DisableSmoothThrottle = false;
|
||||
|
||||
let BrakeSystem = false;
|
||||
@@ -47,7 +47,7 @@ export default function smoothThrottle() {
|
||||
return;
|
||||
|
||||
if (BrakeSystem) {
|
||||
if (mp.players.local.vehicle !== null) {
|
||||
if (mp.players.local.vehicle && mp.vehicles.exists(mp.players.local.vehicle)) {
|
||||
if (!mp.players.local.vehicle.isSeatFree(-1)) //only do this if the vehicle has a driver (doesn't have to be the player who is rendering this)
|
||||
{
|
||||
//Optimize function calls to variables (probably doesn't make a difference)
|
||||
|
||||
@@ -17,8 +17,8 @@ game.events.onPlayerEnterVehicle(async (vehicle, seat) => {
|
||||
|
||||
if (vehicle) {
|
||||
var data: VehicleData = vehicle.getSharedData("VehicleData");
|
||||
|
||||
setVehicleData(vehicle, data);
|
||||
if (vehicle.class == 16) mp.game.vehicle.defaultEngineBehaviour = true;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -31,8 +31,8 @@ game.events.onPlayerExitVehicle(async () => {
|
||||
|
||||
if (veh) {
|
||||
var data: VehicleData = veh.getSharedData("VehicleData");
|
||||
|
||||
setVehicleData(veh, data);
|
||||
if (veh.class == 16) mp.game.vehicle.defaultEngineBehaviour = false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
1885
ReallifeGamemode.Database/Migrations/20210405190220_UserNameUniqueIndex.Designer.cs
generated
Normal file
1885
ReallifeGamemode.Database/Migrations/20210405190220_UserNameUniqueIndex.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ReallifeGamemode.Database.Migrations
|
||||
{
|
||||
public partial class UserNameUniqueIndex : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Users_Name",
|
||||
table: "Users",
|
||||
column: "Name",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Users_Name",
|
||||
table: "Users");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1463,6 +1463,9 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
|
||||
b.HasIndex("HouseId");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@@ -43,10 +45,16 @@ namespace ReallifeGamemode.Database.Models
|
||||
.HasIndex(b => b.BusinessId)
|
||||
.IsUnique(true);
|
||||
|
||||
modelBuilder.Entity<Entities.User>()
|
||||
.HasIndex(u => u.BusinessId)
|
||||
modelBuilder.Entity<Entities.User>(e =>
|
||||
{
|
||||
e.HasIndex(u => u.BusinessId)
|
||||
.IsUnique(true);
|
||||
|
||||
e.HasIndex(u => u.Name)
|
||||
.IsUnique(true);
|
||||
});
|
||||
|
||||
|
||||
modelBuilder.Entity<Entities.ServerVehicle>()
|
||||
.Property(sv => sv.Active)
|
||||
.HasDefaultValue(true);
|
||||
|
||||
@@ -34,6 +34,17 @@ namespace ReallifeGamemode.Server.Commands
|
||||
{
|
||||
#region Todo
|
||||
|
||||
[Command("syncanim", "~m~Benutzung: ~s~/syncanim [animName]")]
|
||||
public void CmdSyncAnim(Player player, string animName = null)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
player.SyncAnimation(animName);
|
||||
}
|
||||
|
||||
[Command("anim", "~m~Benutzung: ~s~/anim [animDict] [animName]")]
|
||||
public void CmdAnim(Player player, string animDict, string animName)
|
||||
{
|
||||
@@ -43,11 +54,8 @@ namespace ReallifeGamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
NAPI.Player.PlayPlayerAnimation(player, (int)(AnimationFlags.Loop | AnimationFlags.AllowPlayerControl | AnimationFlags.Cancellable), animDict, animName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Command("eat", "~m~Benutzung: ~s~/eat [Item]")]
|
||||
public void CmdAdminEat(Player player, string item)
|
||||
{
|
||||
@@ -171,9 +179,11 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#endregion ahelp
|
||||
|
||||
#region Mapping / Entwicklung
|
||||
|
||||
[Command("team", "~m~Benutzung: ~s~/team")]
|
||||
public void CmdAdminTeam(Player player)
|
||||
{
|
||||
@@ -258,6 +268,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
player.SendNotification("~g~[Info]~w~ Deathlogs werden nun angezeigt.");
|
||||
}
|
||||
break;
|
||||
|
||||
case "lc":
|
||||
if (player.HasData("toglc"))
|
||||
{
|
||||
@@ -299,6 +310,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
user.SetBlipAndNametagColor();
|
||||
}
|
||||
|
||||
[Command("aduty", "~m~Benutzung: ~s~/aduty")]
|
||||
public void CmdAdminAduty(Player player)
|
||||
{
|
||||
@@ -314,7 +326,6 @@ namespace ReallifeGamemode.Server.Commands
|
||||
ChatService.Broadcast("~g~[SUPPORT] " + player.Name + " hat sich zum Support angemeldet");
|
||||
|
||||
player.TriggerEvent("toggleADutyMode", true);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -467,8 +478,6 @@ namespace ReallifeGamemode.Server.Commands
|
||||
target.Kick();
|
||||
|
||||
ChatService.BroadcastAdmin("~y~SKICK: ~w~" + targetPlayername + " wurde von " + player.GetUser().AdminLevel.GetName() + " " + adminPlayername + " gekickt: " + reason, AdminLevel.SUPPORTER);
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Command("clearchat", "~m~Benutzung: ~s~/clearchat")]
|
||||
@@ -784,8 +793,6 @@ namespace ReallifeGamemode.Server.Commands
|
||||
target.Kick();
|
||||
|
||||
ChatService.Broadcast("~y~INFO: ~w~" + targetPlayername + " wurde von " + player.GetUser().AdminLevel.GetName() + " " + adminPlayername + " gekickt: " + reason);
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Command("warn", "~m~Benutzung: ~s~/warn [Player] [Grund]", GreedyArg = true)]
|
||||
@@ -949,6 +956,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
else player.Position = new Vector3(p.X, p.Y, p.Z);
|
||||
}
|
||||
}
|
||||
|
||||
[Command("destroyped", "~m~Benutzung: ~s~/destroyped [PedNr]")]
|
||||
public void CmdAdminAddPPed(Player player, int PedNr)
|
||||
{
|
||||
@@ -960,6 +968,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
player.TriggerEvent("CLIENT:DestroyPed", PedNr);
|
||||
//NAPI.Ped.CreatePed(PedHash.Bankman, new Vector3(player.Position.X, player.Position.Y, player.Position.Z), player.Heading, dimension);
|
||||
}
|
||||
|
||||
[Command("addpped", "~m~Benutzung: ~s~/addpped [PedNr] [model] [dimension] [Dynamic] [Freezed] [Collision(0-3)] [Weapon] [AttackProof] [Fire/Explosion-Proof] [DrownProof]")]
|
||||
public void CmdAdminAddPPed(Player player, Array PedNr, string model, uint dimension = 0, bool dynamic = false, bool freeze = false, int collision = 0, string weapon = "none", bool attackproof = false, bool fireexplosionproof = false, bool drownproof = false)
|
||||
{
|
||||
@@ -971,6 +980,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
player.TriggerEvent("CLIENT:AddPed", PedNr, model, player.Position.X, player.Position.Y, player.Position.Z, player.Heading, dimension, dynamic, freeze, collision, weapon, attackproof, fireexplosionproof, drownproof);
|
||||
//NAPI.Ped.CreatePed(PedHash.Bankman, new Vector3(player.Position.X, player.Position.Y, player.Position.Z), player.Heading, dimension);
|
||||
}
|
||||
|
||||
[Command("addmped", "~m~Benutzung: ~s~/addmped [model] [dimension]")]
|
||||
public void CmdAdminAddMPed(Player player, int model, uint dimension = 0)
|
||||
{
|
||||
@@ -982,6 +992,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
player.TriggerEvent("CLIENT:AddPedModel", model, player.Position.X, player.Position.Y, player.Position.Z, player.Heading, dimension);
|
||||
//NAPI.Ped.CreatePed(PedHash.Bankman, new Vector3(player.Position.X, player.Position.Y, player.Position.Z), player.Heading, dimension);
|
||||
}
|
||||
|
||||
[Command("addgped", "~m~Benutzung: ~s~/addgped")]
|
||||
public void CmdAdminAddGPed(Player player, int model, uint dimension = 0)
|
||||
{
|
||||
@@ -995,6 +1006,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
//Peter.freezePosition(true);
|
||||
}
|
||||
|
||||
[Command("addgpedmore", "~m~Benutzung: ~s~/addgpedMore")]
|
||||
public void CmdAdminAddGPedMore(Player player, int model, uint dimension = 0)
|
||||
{
|
||||
@@ -1193,7 +1205,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
[Command("respawnvehicle", "~m~Benutzung: ~s~/respawnvehicle (Db ID)", Alias = "rveh")]
|
||||
public void CmdAdminRespawnVehicle(Player player, int id = -1)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true) //change back to Admin
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
@@ -1687,6 +1699,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
#endregion Admin
|
||||
|
||||
#region ALevel1337
|
||||
|
||||
/*NUR ZUM TESTEN
|
||||
[Command("fakedeath", "~m~Benutzung:~s~ /fakedeath")]
|
||||
public void CmdAdmFakeDeath(Player player)
|
||||
@@ -2130,12 +2143,14 @@ namespace ReallifeGamemode.Server.Commands
|
||||
player.SendChatMessage("Modifier steht auf" + modifier);
|
||||
player.TriggerEvent("SERVER:WeaponModifier2", player, modifier, 1);
|
||||
}
|
||||
|
||||
[Command("wepmmod", "~m~Benutzung: ~s~/wepmmod [Variable]")]
|
||||
public void CmdWeaponMeeleModifier(Player player, float modifier)
|
||||
{
|
||||
player.SendChatMessage("MeeleModifier steht auf" + modifier);
|
||||
player.TriggerEvent("SERVER:WeaponModifier2", player, 1, modifier);
|
||||
}
|
||||
|
||||
[Command("gotocp", "~m~Benutzung: ~s~/gotocp")]
|
||||
public void CmdAdminGotocp(Player admin)
|
||||
{
|
||||
@@ -2663,6 +2678,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
player.SetIntoVehicle(vehicle, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case "noobvehicle":
|
||||
if (player.IsInVehicle)
|
||||
{
|
||||
@@ -3056,6 +3072,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
player.TriggerEvent("manageFactionRanks", json);
|
||||
}
|
||||
}
|
||||
|
||||
[Command("setdoor", "~m~Benutzung: ~s~/setdoor [open/shut] [Tür] [Boolean:Permanet] [Boolean:Lose]")]
|
||||
public void CmdAdminSetDoorOpen(Player player, string status, int door, bool permanent = false, bool lose = true)
|
||||
{
|
||||
@@ -3080,6 +3097,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Command("aplaysound", "~m~Benutzung: ~s~/aplaysound [Dateiname] [mp3/wav] [volume 0.0 - 100.0]", Alias = "aps")]
|
||||
public void CmdAdminPlaySound(Player player, string sound, string typ, double volume = 100)
|
||||
{
|
||||
@@ -3090,6 +3108,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
player.TriggerEvent("CLIENT:PlaySound", sound, typ, volume);
|
||||
}
|
||||
|
||||
[Command("astopsound", "~m~Benutzung: ~s~/astopsound", Alias = "ass")]
|
||||
public void CmdAdminStopSound(Player player)
|
||||
{
|
||||
@@ -3100,6 +3119,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
player.TriggerEvent("CLIENT:StopSound");
|
||||
}
|
||||
|
||||
[Command("aspeed", "~m~Benutzung: ~s~/aspeed [Modifier1] [Modifier2]")] //TODO: Überarbeiten ?? SetPlayerVelocity ??
|
||||
public void CmdAdminAspeed(Player player, int modifier, int modifier2 = 1)
|
||||
{
|
||||
@@ -3543,7 +3563,6 @@ namespace ReallifeGamemode.Server.Commands
|
||||
ChatService.SendMessage(player, $"Stats von {target.Name} - HandMoney: {handmoney.ToMoneyString()}, BankMoney: {bankmoney.ToMoneyString()}, DriverLicense: {driverLicense.ToString()}, BikeLicense: {bikeLicense.ToString()}, FlyingLicense: {flyingLicense.ToString()}, WeaponLicense: {weaponLicense.ToString()}");
|
||||
}
|
||||
|
||||
|
||||
#endregion ALevel1337
|
||||
|
||||
#region ALevel1338
|
||||
@@ -3665,6 +3684,5 @@ namespace ReallifeGamemode.Server.Commands
|
||||
if (player.HasData("Adminduty") && player.GetData<bool>("Adminduty"))
|
||||
player.TriggerEvent("ADMIN:NoClip");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ using ReallifeGamemode.Server.Factions.Medic;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
using ReallifeGamemode.Server.Types;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
using ReallifeGamemode.Services;
|
||||
|
||||
/**
|
||||
@@ -127,7 +128,6 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
#endregion Chat Commands
|
||||
|
||||
|
||||
#region NewsReporter commands
|
||||
|
||||
[Command("news", "~m~Benutzung: ~s~/news [Nachricht]", GreedyArg = true)]
|
||||
@@ -152,11 +152,8 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion NewsReporter commands
|
||||
|
||||
#region Leader Commands
|
||||
|
||||
[Command("giverank", "~m~Benutzung: ~s~/giverank [Name] [Rang]", GreedyArg = true)]
|
||||
@@ -226,7 +223,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
NAPI.Pools.GetAllPlayers().ForEach(p =>
|
||||
{
|
||||
User pUser = p.GetUser();
|
||||
if (pUser.FactionLeader || pUser.IsAdmin(AdminLevel.ADMIN))
|
||||
if ((pUser?.FactionLeader ?? false) || pUser.IsAdmin(AdminLevel.ADMIN))
|
||||
{
|
||||
ChatService.SendMessage(p, broadcastMsg);
|
||||
}
|
||||
@@ -408,6 +405,30 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
#region Staatsfraktionen (LSPD / FBI) Commands
|
||||
|
||||
[Command("cuff", "~m~Benutzung: ~s~/cuff")]
|
||||
public void CmdFactionCuff(Player player)
|
||||
{
|
||||
User user = player.GetUser();
|
||||
if (user == null || (user.FactionId != 1 && user.FactionId != 3))
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.IsDuty())
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Du bist nicht im Dienst");
|
||||
return;
|
||||
}
|
||||
|
||||
Player nearestCuffPlayer = PositionManager.cuffPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6 && user.GetData<bool>("duty"));
|
||||
|
||||
if (nearestCuffPlayer is null)
|
||||
return;
|
||||
|
||||
player.CuffPlayer(nearestCuffPlayer);
|
||||
}
|
||||
|
||||
[Command("wanted", "~m~Benutzung: ~s~/wa(nted) [Spieler] [Anzahl] [Grund]", Alias = "wa", GreedyArg = true)]
|
||||
public void CmdFactionWanted(Player player, string nameOrId, int amount, string reason)
|
||||
{
|
||||
@@ -491,11 +512,12 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
|
||||
#endregion Staatsfraktionen (LSPD / FBI) Commands
|
||||
|
||||
#region Weazel News
|
||||
|
||||
[Command("eventchat", "~m~Benutzung: ~s~/eventchat [Typ = ~g~on~s~, ~g~off~s~]", GreedyArg = true)]
|
||||
public void CmdFactionNREventchat(Player player, string onoff)
|
||||
{
|
||||
|
||||
switch (onoff.ToLower())
|
||||
{
|
||||
case "on":
|
||||
@@ -513,14 +535,9 @@ namespace ReallifeGamemode.Server.Commands
|
||||
});
|
||||
player.SendNotification("Der Eventchat ist nun aus.");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion Weazel News
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,14 +16,12 @@ namespace ReallifeGamemode.Server.Commands
|
||||
{
|
||||
internal class UserCommands : Script
|
||||
{
|
||||
|
||||
[Command("skill")]
|
||||
public void CmdUserSkill(Player player)
|
||||
{
|
||||
User user = player.GetUser(new DatabaseContext());
|
||||
|
||||
player.SendChatMessage($"~c~BusSkill = {user.BusSkill}/800, PilotSkill = {user.PilotSkill}/300.");
|
||||
|
||||
}
|
||||
|
||||
[Command("id", "~m~Benutzung: ~s~/id [Name]")]
|
||||
@@ -34,7 +32,8 @@ namespace ReallifeGamemode.Server.Commands
|
||||
if (target == null)
|
||||
{
|
||||
player.SendChatMessage("~c~Spieler ist nicht online.");
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendChatMessage("~c~ID: (" + target.Id + ") " + target.Name);
|
||||
}
|
||||
@@ -90,6 +89,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
ChatService.SendMessage(player, "~m~" + ((VehicleHash)pVeh.Model) + " | Farbe 1: " + pVeh.PrimaryColor + " | Farbe 2: " + pVeh.SecondaryColor + " | ID: " + pVeh.Handle.Value);
|
||||
}
|
||||
}
|
||||
|
||||
[Command("help", "~m~Benutzung: ~s~/help")]
|
||||
public void CmdHelp(Player player)
|
||||
{
|
||||
@@ -106,8 +106,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
[Command("hup")]
|
||||
public void CmdAnim(Player player)
|
||||
{
|
||||
player.StopAnimation();
|
||||
player.PlayAnimation("mp_am_hold_up", "handsup_base", (int)(AnimationFlags.Loop | AnimationFlags.OnlyAnimateUpperBody | AnimationFlags.AllowPlayerControl | AnimationFlags.Cancellable));
|
||||
player.ToggleSurrender();
|
||||
}
|
||||
|
||||
[Command("event", "~m~Benutzung: ~s~/event [Nachricht]", GreedyArg = true)]
|
||||
@@ -119,8 +118,6 @@ namespace ReallifeGamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
ChatService.BroadcastFaction("~b~[Event] " + player.Name + ": " + msg, new List<int>() { 9 });
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,41 +33,28 @@ namespace ReallifeGamemode.Server.Events
|
||||
return;
|
||||
}
|
||||
|
||||
player.SetData("isDead", true);
|
||||
using var dbContext = new DatabaseContext();
|
||||
|
||||
User user = player.GetUser(dbContext);
|
||||
|
||||
using (var userDeath = new DatabaseContext())
|
||||
{
|
||||
User userisdead = player.GetUser(userDeath);
|
||||
userisdead.Dead = true;
|
||||
userDeath.SaveChanges();
|
||||
}
|
||||
PositionManager.cuffPoints.Remove(player);
|
||||
|
||||
//TODO: Zum Full Release entfernen
|
||||
if (player.HasData("togdeath")) {
|
||||
if (player.HasData("togdeath"))
|
||||
{
|
||||
ChatService.SendMessage(player, "Du bist durch " + (killer?.Name ?? "Niemanden") + " gestorben: " + reason.ToString());
|
||||
}
|
||||
int? killerId;
|
||||
float killerPosX;
|
||||
float killerPosY;
|
||||
float killerPosZ;
|
||||
float killerHeading;
|
||||
int? killerId = null;
|
||||
float killerPosX = -1;
|
||||
float killerPosY = -1;
|
||||
float killerPosZ = -1;
|
||||
float killerHeading = -1;
|
||||
|
||||
if (killer == null || killer.IsNull)
|
||||
if (killer.IsLoggedIn())
|
||||
{
|
||||
killerId = null;
|
||||
killerPosX = -1;
|
||||
killerPosY = -1;
|
||||
killerPosZ = -1;
|
||||
killerHeading = -1;
|
||||
}
|
||||
else
|
||||
var killerUser = killer.GetUser(dbContext);
|
||||
if (killerUser != null)
|
||||
{
|
||||
var killerUser = killer.GetUser();
|
||||
if (killerUser == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
killerId = killerUser.Id;
|
||||
killerPosX = killer.Position.X;
|
||||
killerPosY = killer.Position.Y;
|
||||
@@ -85,11 +72,27 @@ namespace ReallifeGamemode.Server.Events
|
||||
ChatService.BroadcastAdmin(message, AdminLevel.ADMIN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
User user = player.GetUser();
|
||||
bool copNearby = NAPI.Pools.GetAllPlayers().Any(u => u.IsDuty() && u.IsAlive() && u.Position.DistanceToSquared(player.Position) <= 200 * 200);
|
||||
|
||||
if (copNearby)
|
||||
{
|
||||
user.SetJailTime(true);
|
||||
Jail.Check_PutBehindBars(user);
|
||||
ChatService.HQMessage(user.Name + " wurde ins Gefängnis eingeliefert.");
|
||||
}
|
||||
else
|
||||
{
|
||||
ChatService.HQMessage(user.Name + " wurde soeben ins Krankenhaus eingeliefert.");
|
||||
}
|
||||
|
||||
if (user.JailTime <= 0)
|
||||
{
|
||||
player.SetData("isDead", true);
|
||||
|
||||
user.Dead = true;
|
||||
|
||||
if (!player.HasData("reviveSperre"))
|
||||
{
|
||||
//MEDIC AUFTRAG
|
||||
@@ -109,8 +112,6 @@ namespace ReallifeGamemode.Server.Events
|
||||
ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " ist soeben verstorben.", new List<int>() { 2 });
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (player.GetUser().IsAdmin(AdminLevel.ADMIN) == true)
|
||||
{
|
||||
player.TriggerEvent("startDeathTimer", true);
|
||||
@@ -123,10 +124,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
//TODO PICTURE NOTIFICATION + SOUND für Medics
|
||||
|
||||
player.ClearAttachments();
|
||||
|
||||
using (var userDeath = new DatabaseContext())
|
||||
{
|
||||
List<UserItem> fItem = userDeath.UserItems.Where(u => u.UserId == user.Id).ToList();
|
||||
List<UserItem> fItem = dbContext.UserItems.Where(u => u.UserId == user.Id).ToList();
|
||||
foreach (var item in fItem)
|
||||
{
|
||||
IItem iItem = InventoryManager.GetItemById(item.ItemId);
|
||||
@@ -147,8 +145,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
TextLabel grndTxtLbl = NAPI.TextLabel.CreateTextLabel(iItem.Name + " ~s~(~y~" + amount + "~s~)", textPos, 5, 0.5f, 4, new Color(255, 255, 255), false, 0);
|
||||
GroundItem.AddGroundItem(grndItem, grndObject, grndTxtLbl);
|
||||
|
||||
userDeath.Remove(item);
|
||||
}
|
||||
dbContext.Remove(item);
|
||||
}
|
||||
|
||||
var dead = new Database.Entities.Logs.Death
|
||||
@@ -165,8 +162,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
VictimHeading = player.Heading,
|
||||
CauseOfDeath = reason.ToString()
|
||||
};
|
||||
userDeath.DeathLogs.Add(dead);
|
||||
userDeath.SaveChanges();
|
||||
dbContext.DeathLogs.Add(dead);
|
||||
}
|
||||
}
|
||||
Job.JobBase job = Managers.JobManager.GetJob(player.GetUser().JobId ?? -1);
|
||||
@@ -219,9 +215,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
//ChatService.SendMessage(player, "Debug10");
|
||||
}
|
||||
}
|
||||
|
||||
//JailTime.cs
|
||||
Jail.Check_PutBehindBars(player);
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
[RemoteEvent("RespawnPlayerAtHospital")]
|
||||
|
||||
@@ -15,17 +15,15 @@ namespace ReallifeGamemode.Server.Events
|
||||
public class EnterVehicleAttempt : Script
|
||||
{
|
||||
public static GTANetworkAPI.Vehicle Roller;
|
||||
|
||||
[ServerEvent(Event.PlayerEnterVehicleAttempt)]
|
||||
public void OnPlayerEnterVehicleAttempt(Player player, GTANetworkAPI.Vehicle vehicle, sbyte seat)
|
||||
{
|
||||
if ((VehicleHash)vehicle.Model == VehicleHash.Dune3)
|
||||
{
|
||||
if (seat == 1) seat = 0;
|
||||
else if (seat == 0) seat = 1;
|
||||
}
|
||||
|
||||
if (seat != 0) return;
|
||||
|
||||
if (player.HasAnimation())
|
||||
player.StopAnimation();
|
||||
|
||||
User u = player.GetUser();
|
||||
|
||||
if (vehicle.GetServerVehicle() is FactionVehicle veh)
|
||||
@@ -84,7 +82,6 @@ namespace ReallifeGamemode.Server.Events
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (vehicle.GetServerVehicle() is SchoolVehicle sVeh)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ using ReallifeGamemode.Server.WeaponDeal;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Event Key (Key.cs)
|
||||
* @author VegaZ
|
||||
* @author VegaZ, balbo
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
public class Key : Script
|
||||
{
|
||||
#region User Key
|
||||
|
||||
[RemoteEvent("keyPress:NUM2")]
|
||||
public void KeyPressNUM2(Player player)
|
||||
{
|
||||
@@ -60,6 +61,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
|
||||
GroundItem.PickUpGroundItem(player);
|
||||
}
|
||||
|
||||
/*
|
||||
[RemoteEvent("keyPress:LEFT_ARROW")]
|
||||
public void KeyPressLeftArrow(Player player)
|
||||
@@ -85,6 +87,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
[RemoteEvent("keyPress:RIGHT_ARROW")]
|
||||
public void KeyPressRightArrow(Player player)
|
||||
{
|
||||
@@ -116,6 +119,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
using var dbContext = new DatabaseContext();
|
||||
User u = player.GetUser(dbContext);
|
||||
if (u == null) return;
|
||||
if (player.GetData<bool>("isDead")) return;
|
||||
|
||||
var vehicles = dbContext.UserVehicles.Where(veh => veh.UserId == u.Id).OrderBy(veh => veh.Id).Select(v => new
|
||||
{
|
||||
@@ -148,7 +152,6 @@ namespace ReallifeGamemode.Server.Events
|
||||
factionRank = u.GetFactionRank().RankName,
|
||||
group = u.Group?.Name ?? "Keine",
|
||||
groupRank = u.GroupRank.GetName(),
|
||||
job = JobManager.GetJob(u.JobId ?? 0)?.Name ?? "Keiner",
|
||||
paycheck,
|
||||
licenses,
|
||||
vehicles,
|
||||
@@ -158,6 +161,14 @@ namespace ReallifeGamemode.Server.Events
|
||||
userWarn = u.warn,
|
||||
};
|
||||
|
||||
var jobData = new
|
||||
{
|
||||
job = JobManager.GetJob(u.JobId ?? 0)?.Name ?? "Keiner",
|
||||
busskill = u.BusSkill,
|
||||
pilotskill = u.PilotSkill,
|
||||
wage = u.Wage,
|
||||
};
|
||||
|
||||
string faction = u.Faction?.Name ?? "Zivilist";
|
||||
string factionleader = u.FactionLeader ? u.Faction.Name : null;
|
||||
string group = u.Group != null ? u.Group.Name : null;
|
||||
@@ -183,8 +194,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
pay_amount = player.GetData<int>("pay_amount");
|
||||
}
|
||||
|
||||
player.TriggerEvent("SERVER:InteractionMenu_OpenMenu", JsonConvert.SerializeObject(accountData), factionleader, faction, group, factionInvite, groupInvite, ticket_boolean, ticket_amount, pay_amount, house);
|
||||
|
||||
player.TriggerEvent("SERVER:InteractionMenu_OpenMenu", JsonConvert.SerializeObject(accountData), factionleader, JsonConvert.SerializeObject(jobData), faction, group, factionInvite, groupInvite, ticket_boolean, ticket_amount, pay_amount, house);
|
||||
}
|
||||
|
||||
[RemoteEvent("keyPress:E")]
|
||||
@@ -193,7 +203,6 @@ namespace ReallifeGamemode.Server.Events
|
||||
if (!player.IsLoggedIn()) return;
|
||||
var user = player.GetUser();
|
||||
|
||||
|
||||
if (player.HasData("nearATM"))
|
||||
{
|
||||
ATMManager.ShowAtmUi(player, player.GetData<int>("nearATM"));
|
||||
@@ -216,6 +225,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
FriseurPoint nearestFriseurPoint = PositionManager.friseurPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5 && (!user.GetData<bool>("duty")));
|
||||
ItemshopPoint nearestItemShopPoint = PositionManager.itemshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
|
||||
JobPoint nearestJobPoint = PositionManager.JobPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6);
|
||||
Player nearestCuffPlayer = PositionManager.cuffPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6 && user.GetData<bool>("duty"));
|
||||
|
||||
if (user?.FactionId != null)
|
||||
{
|
||||
@@ -228,7 +238,6 @@ namespace ReallifeGamemode.Server.Events
|
||||
List<VehicleItem> vehicleItems = dbContext.VehicleItems.ToList().Where(f => f.GetVehicle().GetVehicle() == nearestBehindVehiclePoint.vehicle && InventoryManager.GetItemById(f.ItemId) is IWeaponDealItem).ToList();
|
||||
if (vehicleItems.Count == 0)
|
||||
{
|
||||
|
||||
GTANetworkAPI.Vehicle vehicle = nearestBehindVehiclePoint.vehicle;
|
||||
|
||||
if (vehicle.HasAttachment("weapondeal"))
|
||||
@@ -366,7 +375,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
if (player.HasAttachment("ammobox"))
|
||||
{
|
||||
player.AddAttachment("ammobox", true);
|
||||
player.StopAnimation();
|
||||
player.ClearAnimation();
|
||||
}
|
||||
bool unloadedWeaponPackage = false;
|
||||
|
||||
@@ -429,13 +438,12 @@ namespace ReallifeGamemode.Server.Events
|
||||
if (user.FactionRank.Order >= weapon.Rank)
|
||||
specials.Add(weapon.WeaponModel.ToString());
|
||||
break;
|
||||
|
||||
case 5:
|
||||
if (user.FactionRank.Order >= weapon.Rank)
|
||||
armor.Add(weapon.WeaponModel.ToString());
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
foreach (var weapon in weapons)
|
||||
{
|
||||
@@ -507,6 +515,10 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
player.TriggerEvent("showJailMenu", JsonConvert.SerializeObject(criminals.ToArray()));
|
||||
}
|
||||
if (nearestCuffPlayer != null)
|
||||
{
|
||||
player.CuffPlayer(nearestCuffPlayer);
|
||||
}
|
||||
}
|
||||
if (nearestElevatorPoint != null)
|
||||
{
|
||||
@@ -607,6 +619,8 @@ namespace ReallifeGamemode.Server.Events
|
||||
public void KeyPressI(Player player)
|
||||
{
|
||||
if (!player.IsLoggedIn()) return;
|
||||
if (player.GetData<bool>("isDead")) return;
|
||||
|
||||
player.TriggerEvent("inventoryShow");
|
||||
InventoryManager.SetBackpackItems(player);
|
||||
}
|
||||
@@ -676,11 +690,11 @@ namespace ReallifeGamemode.Server.Events
|
||||
player.TriggerEvent("SERVER:Job_ShowJobMenu", job.Name, json);
|
||||
}
|
||||
|
||||
|
||||
[RemoteEvent("keyPress:O")]
|
||||
public void KeyPressO(Player player)
|
||||
{
|
||||
if (!player.IsLoggedIn()) return;
|
||||
|
||||
List<Player> players = NAPI.Pools.GetAllPlayers().Where(p => p.IsLoggedIn() == true).OrderBy(o => o.Handle.Value).ToList();
|
||||
|
||||
var listPlayers = players.Select(p => new
|
||||
@@ -963,8 +977,13 @@ namespace ReallifeGamemode.Server.Events
|
||||
player.TriggerEvent("ToggleVehicleMenu");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Faction Key
|
||||
#endregion
|
||||
|
||||
[RemoteEvent("keyPress:ControllH")]
|
||||
public void KeyPressControllH(Player player)
|
||||
{
|
||||
player.ToggleSurrender();
|
||||
}
|
||||
|
||||
#endregion User Key
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SetData("dbId", user.Id);
|
||||
player.Name = username;
|
||||
player.TriggerEvent("SERVER:Login_Success");
|
||||
player.TriggerEvent("CLIENT:StopSound");
|
||||
@@ -122,7 +123,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
else
|
||||
{
|
||||
Jail.Check_PutBehindBars(player);
|
||||
Jail.Check_PutBehindBars(user);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
16
ReallifeGamemode.Server/Events/PlayerEvent.cs
Normal file
16
ReallifeGamemode.Server/Events/PlayerEvent.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
|
||||
namespace ReallifeGamemode.Server.Events
|
||||
{
|
||||
internal class PlayerEvent : Script
|
||||
{
|
||||
[RemoteEvent("CLIENT:SET_InFrontOfPos")]
|
||||
public void SetFrontOfPos(Player player, Vector3 pos)
|
||||
{
|
||||
player.Position = pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using ReallifeGamemode.Database.Models;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Event Register (Register.cs)
|
||||
* @author VegaZ
|
||||
* @author VegaZ, balbo
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
@@ -20,11 +20,18 @@ namespace ReallifeGamemode.Server.Events
|
||||
string username = player.Name;
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
if (password.Length < 6)
|
||||
{
|
||||
player.TriggerEvent("SERVER:Login_Error", "Das Passwort muss aus mindestens 6 Zeichen bestehen.");
|
||||
return;
|
||||
}
|
||||
if (dbContext.Users.Where(u => u.SocialClubName == player.SocialClubName).Count() >= 3)
|
||||
{
|
||||
player.TriggerEvent("SERVER:Login_Error", "Es sind schon 3 Konten mit dieser Socialclub-ID registriert.");
|
||||
return;
|
||||
}
|
||||
else if (!dbContext.Users.Any(u => u.Name.ToLower() == username.ToLower().Trim()))
|
||||
|
||||
if (!dbContext.Users.Any(u => u.Name.ToLower() == username.ToLower().Trim()))
|
||||
{
|
||||
var user = new User
|
||||
{
|
||||
@@ -44,6 +51,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
dbContext.Users.Add(user);
|
||||
dbContext.SaveChanges();
|
||||
|
||||
player.SetData("dbId", user.Id);
|
||||
player.TriggerEvent("SERVER:Login_Success");
|
||||
player.TriggerEvent("CLIENT:StopSound");
|
||||
player.SetData("isLoggedIn", true);
|
||||
|
||||
@@ -6,8 +6,10 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
using ReallifeGamemode.Server.Types;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Player Extension (PlayerExtension.cs)
|
||||
@@ -57,6 +59,34 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetJailTime(this User user, bool killed)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int time = 26 * user.Wanteds;
|
||||
if (killed)
|
||||
{
|
||||
time *= 2;
|
||||
}
|
||||
|
||||
user.Wanteds = 0;
|
||||
user.JailTime = time;
|
||||
}
|
||||
|
||||
public static void AnnouncePlayerJailedIn(this User user)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string message = user.Name + " wurde ins Gefängnis geliefert";
|
||||
|
||||
ChatService.HQMessage(message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gibt zurück, ob ein Player eingeloggt ist
|
||||
/// </summary>
|
||||
@@ -74,13 +104,42 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
|
||||
public static bool IsDuty(this Player player)
|
||||
{
|
||||
var user = player.GetUser();
|
||||
return user.GetData("duty", false);
|
||||
return player.GetServerData("duty", false);
|
||||
}
|
||||
|
||||
public static bool IsAlive(this Player player)
|
||||
{
|
||||
return !player.HasData("isDead") || player.GetData<bool>("isDead") == false;
|
||||
}
|
||||
|
||||
public static T GetServerData<T>(this Player player, string key, T defaultValue = default)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
key += "data_";
|
||||
if (!player.HasData(key)) return defaultValue;
|
||||
return JsonConvert.DeserializeObject<T>(player.GetData<dynamic>(key));
|
||||
}
|
||||
|
||||
public static void SetServerData(this Player player, string key, object value)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
key += "data_";
|
||||
player.SetData(key, JsonConvert.SerializeObject(value));
|
||||
}
|
||||
|
||||
public static bool IsAdminDuty(this Player player)
|
||||
{
|
||||
return player.HasData("Adminduty") ? player.GetData<bool>("Adminduty") : false;
|
||||
}
|
||||
|
||||
public static Vector3 GetPositionFromPlayer(Player player, float distance, int offset = 0)
|
||||
{
|
||||
var pos = player.Position;
|
||||
@@ -94,27 +153,14 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
|
||||
internal static T GetData<T>(this User user, string key, T nullValue)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
key += "data_";
|
||||
if (!user.Player.HasData(key)) return nullValue;
|
||||
return JsonConvert.DeserializeObject<T>(user.Player.GetData<dynamic>(key));
|
||||
return user.Player.GetServerData(key, nullValue);
|
||||
}
|
||||
|
||||
internal static T GetData<T>(this User user, string key) => user.GetData<T>(key, default);
|
||||
|
||||
internal static void SetData(this User user, string key, object value)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
key += "data_";
|
||||
user.Player.SetData(key, JsonConvert.SerializeObject(value));
|
||||
user.Player.SetServerData(key, value);
|
||||
}
|
||||
|
||||
internal static void GiveWanteds(this User user, Player cop, int amount, string reason)
|
||||
@@ -314,5 +360,48 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
user.Player.SetSharedData("nameTagColor", nameTagColor);
|
||||
user.Player.SetSharedData("blipColor", blipColor);
|
||||
}
|
||||
|
||||
public static void SetInFrontOf(this Player player, Entity entity)
|
||||
{
|
||||
player.TriggerEvent("SERVER:SetInFrontPosition", entity);
|
||||
}
|
||||
|
||||
public static void CuffPlayer(this Player player, Player nearestCuffPlayer)
|
||||
{
|
||||
nearestCuffPlayer.SetInFrontOf(player);
|
||||
nearestCuffPlayer.Heading = player.Heading;
|
||||
|
||||
if (!nearestCuffPlayer.HasAnimation("Cuffed"))
|
||||
{
|
||||
player.SyncAnimation("doArrest");
|
||||
nearestCuffPlayer.SyncAnimation(new List<string>() { "getArrest", "Cuffed" });
|
||||
nearestCuffPlayer.AddAttachment("handcuffs", false);
|
||||
nearestCuffPlayer.RemoveAllWeapons();
|
||||
}
|
||||
else
|
||||
{
|
||||
nearestCuffPlayer.AddAttachment("handcuffs", true);
|
||||
player.SyncAnimation("doUncuff");
|
||||
nearestCuffPlayer.SyncAnimation("getUncuff");
|
||||
PositionManager.cuffPoints.Remove(nearestCuffPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ToggleSurrender(this Player player)
|
||||
{
|
||||
if (player.HasAnimation("hup"))
|
||||
{
|
||||
PositionManager.cuffPoints.Remove(player);
|
||||
player.ClearAnimation();
|
||||
return;
|
||||
}
|
||||
if (player.HasAnimation())
|
||||
return;
|
||||
|
||||
player.SyncAnimation("hup");
|
||||
|
||||
if (player.GetUser().Wanteds > 0)
|
||||
PositionManager.cuffPoints.Add(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,27 +192,27 @@ namespace ReallifeGamemode.Server.Factions.Medic
|
||||
}
|
||||
|
||||
[RemoteEvent("updateMedicTask")]
|
||||
public void UpdateMedicTasks(Player player, int type, int index)
|
||||
public void UpdateMedicTasks(Player player, int type, string victim)
|
||||
{
|
||||
Player target = PlayerService.GetPlayerByNameOrId(ReviveTasks[index].Victim);
|
||||
Player target = PlayerService.GetPlayerByNameOrId(victim);
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
|
||||
ReviveTasks[index].MedicName = player.Name;
|
||||
ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " hat den Reviveauftrag von " + ReviveTasks[index].Victim + " angenommen.", new List<int>() { 2 });
|
||||
var reviveTask = ReviveTasks.FirstOrDefault(t => t.Victim == victim);
|
||||
reviveTask.MedicName = player.Name;
|
||||
ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " hat den Reviveauftrag von " + victim + " angenommen.", new List<int>() { 2 });
|
||||
target.SendNotification("~w~Sanitäter~g~ " + player.Name + "~w~ eilt zur Rettung.");
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
HealTasks[index].MedicName = player.Name;
|
||||
ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " hat den Healauftrag von " + ReviveTasks[index].Victim + " angenommen.", new List<int>() { 2 });
|
||||
var healTask = ReviveTasks.FirstOrDefault(t => t.Victim == victim);
|
||||
healTask.MedicName = player.Name;
|
||||
ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " hat den Healauftrag von " + victim + " angenommen.", new List<int>() { 2 });
|
||||
target.SendNotification("~w~Sanitäter~g~ " + player.Name + "~w~ hat deinen Auftrag angenommen.");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
FireTasks[index].MedicName = player.Name;
|
||||
//FireTasks[index].MedicName = player.Name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -258,8 +258,8 @@ namespace ReallifeGamemode.Server.Factions.Medic
|
||||
{
|
||||
using var dbContext = new DatabaseContext();
|
||||
{
|
||||
dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 2).First().BankAccount.Balance += Medic.ReviveIncome / 2;
|
||||
player.SendNotification($"Du hast den Einsatzort erreicht und ~g~{Medic.ReviveIncome / 2}$ ~s~für die Fraktion verdient.");
|
||||
dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 2).First().BankAccount.Balance += Medic.ReviveIncome / 4;
|
||||
player.SendNotification($"Du hast den Einsatzort erreicht und ~g~{Medic.ReviveIncome / 4}$ ~s~für die Fraktion verdient.");
|
||||
Medic.delReviveTaskMedic(player);
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace ReallifeGamemode.Server.Finance
|
||||
|
||||
if (putInJail != 0 && minusJail)
|
||||
{
|
||||
Jail.Check_PutBehindBars(client, false);
|
||||
Jail.Check_PutBehindBars(u);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -114,16 +114,13 @@ namespace ReallifeGamemode.Server.Gangwar
|
||||
this.timerCount = 0;
|
||||
}
|
||||
|
||||
private void reloadGangTurfs()
|
||||
private void ReloadGangTurfs()
|
||||
{
|
||||
var t = Task.Factory.StartNew(() =>
|
||||
NAPI.Task.Run(() =>
|
||||
{
|
||||
Task.Delay(10000).Wait();
|
||||
Gangwar.loadTurfs();
|
||||
Gangwar.loadTurfs_ToAllPlayers();
|
||||
});
|
||||
t.Wait();
|
||||
|
||||
}, delayTime: 2000);
|
||||
}
|
||||
|
||||
private void Tick(object sender, System.Timers.ElapsedEventArgs e)
|
||||
@@ -303,7 +300,7 @@ namespace ReallifeGamemode.Server.Gangwar
|
||||
NAPI.ClientEvent.TriggerClientEventForAll("CLIENT:Turf_Conquered", JsonConvert.SerializeObject(this.TurfID), JsonConvert.SerializeObject(this.status), JsonConvert.SerializeObject(this.Owner));
|
||||
Gangwar.loadTurfs();
|
||||
Gangwar.loadTurfs_ToAllPlayers();
|
||||
reloadGangTurfs();
|
||||
ReloadGangTurfs();
|
||||
}
|
||||
|
||||
public void attack(string attacker)
|
||||
|
||||
@@ -6,6 +6,7 @@ using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Inventory.Interfaces;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
|
||||
namespace ReallifeGamemode.Server.Inventory
|
||||
{
|
||||
@@ -99,9 +100,9 @@ namespace ReallifeGamemode.Server.Inventory
|
||||
}
|
||||
if (nearestItem is IWeaponDealItem obj)
|
||||
{
|
||||
if (!player.HasAttachment("ammobox"))
|
||||
if (!player.HasAttachment("ammobox") && !player.HasAnimation())
|
||||
{
|
||||
player.PlayAnimation("anim@heists@box_carry@", "idle", 49);
|
||||
player.SyncAnimation("carryBox");
|
||||
player.AddAttachment("ammobox", false);
|
||||
NAPI.Player.SetPlayerCurrentWeapon(player, WeaponHash.Unarmed);
|
||||
}
|
||||
|
||||
@@ -129,6 +129,11 @@ namespace ReallifeGamemode.Server.Managers
|
||||
[ServerEvent(Event.PlayerEnterVehicle)]
|
||||
public void CarDealerBusiness_PlayerEnterVehicle(Player player, Vehicle veh, int seat)
|
||||
{
|
||||
if(player.IsAdminDuty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ServerVehicle sVeh = veh.GetServerVehicle();
|
||||
if (sVeh == null) return;
|
||||
if (!(sVeh is ShopVehicle)) return;
|
||||
|
||||
@@ -19,7 +19,7 @@ using ReallifeGamemode.Server.Factions.Medic;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Managers Interaction (InteractionManager.cs)
|
||||
* @author VegaZ
|
||||
* @author VegaZ, balbo
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
@@ -772,13 +772,13 @@ namespace ReallifeGamemode.Server.Managers
|
||||
if (!player.IsLoggedIn()) return;
|
||||
List<Player> players = NAPI.Pools.GetAllPlayers();
|
||||
|
||||
var listPlayers = players.Where(p => p.GetUser().Wanteds > 0)
|
||||
var listPlayers = players
|
||||
.Select(p => new
|
||||
{
|
||||
Id = p.Handle.Value,
|
||||
p.Name,
|
||||
wanted = p.GetUser().Wanteds,
|
||||
});
|
||||
wanted = p.GetUser()?.Wanteds,
|
||||
}).Where(u => u.wanted > 0).ToList();
|
||||
|
||||
if (listPlayers.Count() > 0)
|
||||
player.TriggerEvent("showWantedlist", JsonConvert.SerializeObject(listPlayers));
|
||||
@@ -809,6 +809,12 @@ namespace ReallifeGamemode.Server.Managers
|
||||
[RemoteEvent("CLIENT:InteractionMenu_CallService_Sani")]
|
||||
public void CallServiceSani(Player player)
|
||||
{
|
||||
if (player.GetUser().FactionId == 2 && player.IsDuty())
|
||||
{
|
||||
player.SendNotification("~r~[Fehler] ~w~Du kannst keinen Sanitäter rufen.");
|
||||
return;
|
||||
}
|
||||
|
||||
//MEDIC AUFTRAG
|
||||
MedicTask healTask = new MedicTask()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ using ReallifeGamemode.Server.Types;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Managers InventoryManager (InventoryManager.cs)
|
||||
* @author hydrant, VegaZ
|
||||
* @author hydrant, VegaZ, balbo
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
if (player.IsInVehicle)
|
||||
{
|
||||
player.TriggerEvent("Error", "Du kannst dein Kofferraum nicht betätigen.");
|
||||
player.TriggerEvent("Error", "Du kannst deinen Kofferraum gerade nicht öffnen.");
|
||||
}
|
||||
Vehicle veh = NAPI.Pools.GetAllVehicles().ToList().Where(v => v.Position.DistanceTo(player.Position) <= 2).FirstOrDefault();
|
||||
if (veh == null)
|
||||
|
||||
@@ -4,6 +4,7 @@ using GTANetworkAPI;
|
||||
using ReallifeGamemode.Server.Shop.Clothing;
|
||||
using ReallifeGamemode.Server.Shop.SevenEleven;
|
||||
using ReallifeGamemode.Server.Shop.Friseur;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
|
||||
namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
@@ -25,6 +26,8 @@ namespace ReallifeGamemode.Server.Managers
|
||||
|
||||
public static List<JobPoint> JobPoints = new List<JobPoint>();
|
||||
|
||||
public static List<Player> cuffPoints = new List<Player>();
|
||||
|
||||
public static void LoadPositionManager()
|
||||
{
|
||||
#region DutyPoints
|
||||
@@ -213,6 +216,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
NAPI.Blip.CreateBlip(513, p.Position, 1f, 16, "Busfahrer", 255, 0, true);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion JobPoints
|
||||
|
||||
#region Shops
|
||||
@@ -285,7 +289,6 @@ namespace ReallifeGamemode.Server.Managers
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
player.Position = ElevatorPoints.Where(e => e.Stage == level).First().Position;
|
||||
}
|
||||
}
|
||||
@@ -347,7 +350,7 @@ public class BehindVehiclePoint
|
||||
{
|
||||
if (!player.HasAttachment("ammobox"))
|
||||
{
|
||||
player.PlayAnimation("anim@heists@box_carry@", "idle", 49);
|
||||
player.SyncAnimation("carryBox");
|
||||
player.AddAttachment("ammobox", false);
|
||||
NAPI.Player.SetPlayerCurrentWeapon(player, WeaponHash.Unarmed);
|
||||
}
|
||||
@@ -389,7 +392,6 @@ public class JobPoint
|
||||
public Vector3 Position { get; set; }
|
||||
public int jobId { get; set; }
|
||||
public int Skill { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class ElevatorPoint
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
@@ -115,6 +116,17 @@ namespace ReallifeGamemode.Server.Services
|
||||
});
|
||||
}
|
||||
|
||||
internal static void SendInRange(Vector3 position, int range, string message)
|
||||
{
|
||||
foreach(Player player in NAPI.Pools.GetAllPlayers())
|
||||
{
|
||||
if(player.Position.DistanceTo(position) <= range)
|
||||
{
|
||||
SendMessage(player, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void BroadcastGroup(string message, Group group)
|
||||
{
|
||||
message = $"!{{FF8080}}** Gruppe: {message}";
|
||||
|
||||
128
ReallifeGamemode.Server/Util/AnimationSync.cs
Normal file
128
ReallifeGamemode.Server/Util/AnimationSync.cs
Normal file
@@ -0,0 +1,128 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using Newtonsoft.Json;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
|
||||
namespace ReallifeGamemode.Server.Util
|
||||
{
|
||||
public static class AnimationSync
|
||||
{
|
||||
public static Dictionary<Player, List<string>> animationPair = new Dictionary<Player, List<string>>();
|
||||
|
||||
public static void SyncAnimation(this Player player, dynamic animationName)
|
||||
{
|
||||
if (player.IsInVehicle)
|
||||
return;
|
||||
|
||||
if (!player.HasData("Animation"))
|
||||
player.SetData("Animation", String.Empty);
|
||||
|
||||
string currentAnimation = player.GetData<string>("Animation");
|
||||
string newAnimation = animationName;
|
||||
|
||||
if (currentAnimation.Equals(newAnimation))
|
||||
return;
|
||||
|
||||
player.SetSharedData("AnimationData", newAnimation);
|
||||
player.SetData<string>("Animation", newAnimation);
|
||||
}
|
||||
|
||||
public static void SyncAnimation(this Player player, List<string> animations)
|
||||
{
|
||||
if (animations.Count is 0)
|
||||
return;
|
||||
|
||||
string animationName = animations.ElementAt(0);
|
||||
List<string> nextAnimations = animations.Skip(1).ToList();
|
||||
player.SyncAnimation(animationName);
|
||||
|
||||
if (nextAnimations.Count is 0)
|
||||
{
|
||||
animationPair.Remove(player);
|
||||
return;
|
||||
}
|
||||
|
||||
player.TriggerEvent("SERVER:QueueAnimation", animationName);
|
||||
if (animationPair.ContainsKey(player))
|
||||
animationPair[player] = nextAnimations;
|
||||
else
|
||||
animationPair.Add(player, nextAnimations);
|
||||
}
|
||||
|
||||
/// <summary>Check if Player has any Animation playing.
|
||||
/// </summary>
|
||||
/// <param name="player"></param>
|
||||
public static bool HasAnimation(this Player player)
|
||||
{
|
||||
return player.HasData("Animation");
|
||||
}
|
||||
|
||||
/// <summary>Check if Player has a specific Animation playing.
|
||||
/// </summary>
|
||||
/// <param name="animationName">Name of requested animation</param>
|
||||
public static bool HasAnimation(this Player player, dynamic animationName)
|
||||
{
|
||||
return player.HasData("Animation") && (player.GetData<string>("Animation") == animationName);
|
||||
}
|
||||
|
||||
public static void ClearAnimation(this Player player)
|
||||
{
|
||||
if (!player.HasData("Animation"))
|
||||
return;
|
||||
|
||||
player.ResetData("Animation");
|
||||
player.ResetSharedData("AnimationData");
|
||||
}
|
||||
}
|
||||
|
||||
public class AnimationSyncEvents : Script
|
||||
{
|
||||
[RemoteEvent("CLIENT:AnimPairTransition")]
|
||||
public void AnimPairTransition(Player player)
|
||||
{
|
||||
if (!AnimationSync.animationPair.ContainsKey(player))
|
||||
return;
|
||||
|
||||
List<string> animationPairs = AnimationSync.animationPair[player];
|
||||
|
||||
player.SyncAnimation(animationPairs);
|
||||
}
|
||||
|
||||
[RemoteEvent("CLIENT:ClearAnimationData")]
|
||||
public void ClearAnimationData(Player player, bool checkTransition)
|
||||
{
|
||||
player.ClearAnimation();
|
||||
if (checkTransition)
|
||||
{
|
||||
AnimPairTransition(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.ClearAttachments();
|
||||
PositionManager.cuffPoints.Remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
[ServerEvent(Event.PlayerWeaponSwitch)]
|
||||
public void OnPlayerWeaponSwitch(Player player, WeaponHash oldWeapon, WeaponHash newWeapon)
|
||||
{
|
||||
if (!player.HasAnimation()) return;
|
||||
NAPI.Player.SetPlayerCurrentWeapon(player, WeaponHash.Unarmed);
|
||||
}
|
||||
|
||||
[ServerEvent(Event.PlayerConnected)]
|
||||
public void OnPlayerConnected(Player player)
|
||||
{
|
||||
player.TriggerEvent("SERVER:LoadAnimations");
|
||||
}
|
||||
|
||||
[ServerEvent(Event.PlayerDeath)]
|
||||
public void OnPlayerDeath(Player player, Player killer, uint reason)
|
||||
{
|
||||
player.ClearAnimation();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using GTANetworkAPI;
|
||||
@@ -143,18 +142,13 @@ public class AttachmentSyncExample : Script
|
||||
if (!player.HasAttachment("ammobox"))
|
||||
{
|
||||
player.AddAttachment("ammobox", false);
|
||||
player.PlayAnimation("anim@heists@box_carry@", "idle", 49);
|
||||
//player.SyncAnimation("carryBox");
|
||||
//veh.AddAttachment("weapondeal1", false);
|
||||
//veh.AddAttachment("weapondeal2", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.StopAnimation();
|
||||
|
||||
player.ClearAttachments();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ using ReallifeGamemode.Server.Services;
|
||||
using ReallifeGamemode.Services;
|
||||
using System.Diagnostics;
|
||||
using Newtonsoft.Json;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
|
||||
namespace ReallifeGamemode.Server.Wanted
|
||||
{
|
||||
@@ -18,104 +19,36 @@ namespace ReallifeGamemode.Server.Wanted
|
||||
private static Dictionary<int, int> Jailtime { get; set; } = new Dictionary<int, int>(); //time in seconds
|
||||
|
||||
|
||||
public static void Check_PutBehindBars(Player client, bool announceHq = true)
|
||||
public static void Check_PutBehindBars(User user)
|
||||
{
|
||||
User user = client.GetUser();
|
||||
user.SetBlipAndNametagColor();
|
||||
Player player = user.Player;
|
||||
PositionManager.cuffPoints.Remove(player);
|
||||
if (user.JailTime > 0)
|
||||
{
|
||||
client.RemoveAllWeapons();
|
||||
client.Health = 100;
|
||||
client.Armor = 0;
|
||||
player.RemoveAllWeapons();
|
||||
player.Health = 100;
|
||||
player.Armor = 0;
|
||||
Random rnd = new Random();
|
||||
int rndInt = rnd.Next(1, 3);
|
||||
if (rndInt == 1)
|
||||
NAPI.Player.SpawnPlayer(client, new Vector3(458.9842, -997.2126, 24.91485)); //send client to jail
|
||||
NAPI.Player.SpawnPlayer(player, new Vector3(458.9842, -997.2126, 24.91485)); //send client to jail
|
||||
if (rndInt == 2)
|
||||
NAPI.Player.SpawnPlayer(client, new Vector3(459.696, -994.3766, 24.91486)); //send client to jail
|
||||
NAPI.Player.SpawnPlayer(player, new Vector3(459.696, -994.3766, 24.91486)); //send client to jail
|
||||
if (rndInt == 3)
|
||||
NAPI.Player.SpawnPlayer(client, new Vector3(458.3372, -1001.258, 24.91485)); //send client to jail
|
||||
NAPI.Player.SpawnPlayer(player, new Vector3(458.3372, -1001.258, 24.91485)); //send client to jail
|
||||
Jailtime[user.Id] = user.JailTime; // 54 sec for each wanted star -> in total 45min for 50 Wanteds
|
||||
int timeMinutes = 0;
|
||||
int timeMinutes;
|
||||
|
||||
if (((int)(user.JailTime / 60)) <= 1 && user.JailTime != 0)
|
||||
if ((user.JailTime / 60) <= 1 && user.JailTime != 0)
|
||||
{
|
||||
timeMinutes = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
timeMinutes = (int)(user.JailTime / 60);
|
||||
timeMinutes = user.JailTime / 60;
|
||||
}
|
||||
client.TriggerEvent("jailTime", timeMinutes);
|
||||
return;
|
||||
}
|
||||
if (user.Wanteds <= 0)
|
||||
return;
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
foreach (var copPlayer in NAPI.Pools.GetAllPlayers())
|
||||
{
|
||||
if (!copPlayer.IsLoggedIn()) continue;
|
||||
User cop = copPlayer.GetUser();
|
||||
if (cop?.FactionId == 1 || cop?.FactionId == 3)
|
||||
{
|
||||
int jailTime = user.Wanteds * 54;
|
||||
if (cop.GetData<bool>("duty") && copPlayer.Position.DistanceTo2D(client.Position) <= 200 && (!copPlayer.HasData("isDead") || copPlayer.GetData<bool>("isDead") != true))
|
||||
{
|
||||
if (!client.HasData("isDead") || client.GetData<bool>("isDead") == false)
|
||||
{
|
||||
jailTime /= 2;
|
||||
}
|
||||
|
||||
User clientUser = client.GetUser(dbContext);
|
||||
|
||||
clientUser.JailTime = jailTime;
|
||||
Jailtime[user.Id] = jailTime; // 54 sec for each wanted star -> in total 45min for 50 Wanteds
|
||||
|
||||
clientUser.Wanteds = 0;
|
||||
client.SetData("isDead", false);
|
||||
client.RemoveAllWeapons();
|
||||
client.SetSharedData("blipColor", 0);
|
||||
Random rnd = new Random();
|
||||
int rndInt = rnd.Next(1, 3);
|
||||
if (rndInt == 1)
|
||||
NAPI.Player.SpawnPlayer(client, new Vector3(458.9842, -997.2126, 24.91485)); //send client to jail
|
||||
if (rndInt == 2)
|
||||
NAPI.Player.SpawnPlayer(client, new Vector3(459.696, -994.3766, 24.91486)); //send client to jail
|
||||
if (rndInt == 3)
|
||||
NAPI.Player.SpawnPlayer(client, new Vector3(458.3372, -1001.258, 24.91485)); //send client to jail
|
||||
|
||||
client.TriggerEvent("onPlayerRevived");
|
||||
MedicTask task = Medic.ReviveTasks.FirstOrDefault(t => t.Victim == client.Name);
|
||||
Medic.RemoveTaskFromList(task);
|
||||
client.Health = 100;
|
||||
|
||||
int timeMinutes = 0;
|
||||
|
||||
if (((int)(Jailtime[user.Id] / 60)) <= 1 && Jailtime[user.Id] != 0)
|
||||
{
|
||||
timeMinutes = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
timeMinutes = (int)(Jailtime[user.Id] / 60);
|
||||
}
|
||||
|
||||
client.TriggerEvent("jailTime", JsonConvert.SerializeObject(timeMinutes));
|
||||
|
||||
clientUser.SetBlipAndNametagColor();
|
||||
|
||||
if (announceHq)
|
||||
{
|
||||
ChatService.BroadcastFaction("!{#8181E9}HQ: " + user.Name + " wurde ins Gefängnis geliefert.", new List<int>() { 1, 3 });
|
||||
}
|
||||
}
|
||||
else if (user.Wanteds > 0 && user.JailTime <= 0)
|
||||
{
|
||||
ChatService.BroadcastFaction("!{#8181E9}HQ: Der Verdächtigte " + user.Name + " wurde soeben ins Krankenhaus eingeliefert.", new System.Collections.Generic.List<int>() { 1, 3 });
|
||||
}
|
||||
}
|
||||
}
|
||||
dbContext.SaveChanges();
|
||||
player.TriggerEvent("jailTime", timeMinutes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,23 +69,31 @@ namespace ReallifeGamemode.Server.Wanted
|
||||
|
||||
public static void JailIn_Elapsed()
|
||||
{
|
||||
using var dbContext = new DatabaseContext();
|
||||
foreach (var player in NAPI.Pools.GetAllPlayers())
|
||||
{
|
||||
User user = player.GetUser();
|
||||
if (user != null && !Jailtime.ContainsKey(user.Id))
|
||||
if (player.Position.DistanceTo(new Vector3(458.9842, -997.2126, 24.91485)) > 7)
|
||||
{
|
||||
foreach (var copPlayer in NAPI.Pools.GetAllPlayers())
|
||||
{
|
||||
if (!copPlayer.IsLoggedIn()) return;
|
||||
User cop = copPlayer.GetUser();
|
||||
if (cop.GetData<bool>("duty") && copPlayer.Position.DistanceTo2D(player.Position) <= 500 && (!copPlayer.HasData("isDead") || copPlayer.GetData<bool>("isDead") != true))
|
||||
{
|
||||
if (player.Position.DistanceTo2D(new Vector3(458.9842, -997.2126, 24.91485)) <= 7)
|
||||
{
|
||||
if (player.Position.DistanceTo2D(copPlayer.Position) < 5)
|
||||
{
|
||||
Check_PutBehindBars(player);
|
||||
continue;
|
||||
}
|
||||
|
||||
User user = player.GetUser(dbContext);
|
||||
|
||||
if (user != null && user.Wanteds > 0 && !Jailtime.ContainsKey(user.Id))
|
||||
{
|
||||
foreach (var copPlayer in NAPI.Pools.GetAllPlayers().Where(u => u.IsLoggedIn() && u.IsDuty() && u.IsAlive()))
|
||||
{
|
||||
User copUser = copPlayer.GetUser(dbContext);
|
||||
if (copUser.FactionId == 1 || copUser.FactionId == 3)
|
||||
{
|
||||
if (player.Position.DistanceTo(copPlayer.Position) < 5)
|
||||
{
|
||||
user.SetJailTime(false);
|
||||
user.SetBlipAndNametagColor();
|
||||
user.AnnouncePlayerJailedIn();
|
||||
dbContext.SaveChanges();
|
||||
Check_PutBehindBars(user);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -183,9 +124,10 @@ namespace ReallifeGamemode.Server.Wanted
|
||||
|
||||
public static void JailOut_Elapsed()
|
||||
{
|
||||
using var dbContext = new DatabaseContext();
|
||||
foreach (var player in NAPI.Pools.GetAllPlayers())
|
||||
{
|
||||
User user = player.GetUser();
|
||||
User user = player.GetUser(dbContext);
|
||||
if (user != null && Jailtime.ContainsKey(user.Id))
|
||||
{
|
||||
if (user.JailTime <= 0)
|
||||
@@ -197,11 +139,7 @@ namespace ReallifeGamemode.Server.Wanted
|
||||
}
|
||||
if (user.JailTime > 0)
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
player.GetUser(dbContext).JailTime -= 60;
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
user.JailTime -= 60;
|
||||
|
||||
int timeMinutes = 0;
|
||||
|
||||
@@ -219,6 +157,7 @@ namespace ReallifeGamemode.Server.Wanted
|
||||
}
|
||||
}
|
||||
}
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
[RemoteEvent("setPrisonerFree")]
|
||||
@@ -248,15 +187,15 @@ namespace ReallifeGamemode.Server.Wanted
|
||||
|
||||
public static void Release_Jail_Admin(Player admin, Player target)
|
||||
{
|
||||
User user = target.GetUser();
|
||||
using var dbContext = new DatabaseContext();
|
||||
User user = target.GetUser(dbContext);
|
||||
if (Jailtime.ContainsKey(user.Id))
|
||||
{
|
||||
Jailtime.Remove(user.Id);
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
target.GetUser(dbContext).JailTime = 0;
|
||||
|
||||
user.JailTime = 0;
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
target.Health = 100;
|
||||
target.Position = new Vector3(427.879, -984.65, 30.71);
|
||||
|
||||
|
||||
@@ -35,9 +35,10 @@ namespace ReallifeGamemode.Server.Wanted
|
||||
|
||||
public static void Timer_Elapsed()
|
||||
{
|
||||
using var dbContext = new DatabaseContext();
|
||||
foreach (var player in NAPI.Pools.GetAllPlayers())
|
||||
{
|
||||
User user = player.GetUser();
|
||||
User user = player.GetUser(dbContext);
|
||||
if (user != null && user.Wanteds > 0)
|
||||
{
|
||||
if (!waTimer.ContainsKey(user.Id))
|
||||
@@ -68,30 +69,10 @@ namespace ReallifeGamemode.Server.Wanted
|
||||
{
|
||||
ResetWantedTimeToElapse(player);
|
||||
player.SendChatMessage("~y~Du hast erfolgtreich einen Wanted abgetaucht.");
|
||||
using (var dbContext = new DatabaseContext())
|
||||
user.Wanteds -= 1;
|
||||
if (user.Wanteds == 0)
|
||||
{
|
||||
player.GetUser(dbContext).Wanteds -= 1;
|
||||
if (player.GetUser(dbContext).Wanteds == 0)
|
||||
{
|
||||
switch (player.GetUser(dbContext).FactionId)
|
||||
{
|
||||
case null:
|
||||
player.SetSharedData("blipColor", 0);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
player.SetSharedData("blipColor", 83);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
player.SetSharedData("blipColor", 52);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
player.SetSharedData("blipColor", 5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
user.SetBlipAndNametagColor();
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
4071
package-lock.json
generated
4071
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -25,7 +25,7 @@ Set-Variable resourcesDir -option Constant -value "dotnet\resources"
|
||||
Set-Variable gamemodeDir -option Constant -value "reallife-gamemode"
|
||||
Set-Variable assetsDir -option Constant -value "client_packages\assets"
|
||||
Set-Variable indexJsDir -option Constant -value "client_packages"
|
||||
Set-Variable dlcPacksDir -option Constant -value "source_dlcpacks"
|
||||
Set-Variable dlcPacksDir -option Constant -value "client_packages\game_resources\dlcpacks"
|
||||
Set-Variable fullBuildDir -option Constant -value "$serverProjectPath\$buildDirectory"
|
||||
|
||||
# create default config file if not exist
|
||||
|
||||
Reference in New Issue
Block a user