Add RefuseCollector Job and other misc
This commit is contained in:
@@ -1,5 +1,12 @@
|
|||||||
{
|
{
|
||||||
"combination": [
|
"combination": [
|
||||||
|
{
|
||||||
|
"_id": 0,
|
||||||
|
"Top": 0,
|
||||||
|
"Torso": 0,
|
||||||
|
"Undershirt": 2
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"_id": 1,
|
"_id": 1,
|
||||||
"Top": 1,
|
"Top": 1,
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
{
|
{
|
||||||
"combination": [
|
"combination": [
|
||||||
|
|
||||||
{
|
|
||||||
"_id": 0,
|
|
||||||
"Top": 0,
|
|
||||||
"Torso": 0,
|
|
||||||
"Undershirt": 15
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"_id": 1,
|
"_id": 1,
|
||||||
"Top": 1,
|
"Top": 1,
|
||||||
|
|||||||
155
ReallifeGamemode.Client/Jobs/RefuseCollector.ts
Normal file
155
ReallifeGamemode.Client/Jobs/RefuseCollector.ts
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
export default function RefuseCollector() {
|
||||||
|
|
||||||
|
var State = false;
|
||||||
|
var Traegt = false;
|
||||||
|
var HintenVoll = false;
|
||||||
|
var MuellSack = null;
|
||||||
|
var BlipTonneHinten = null;
|
||||||
|
var CheckpointTonneHinten = null;
|
||||||
|
var ShapeTonneHinten = null;
|
||||||
|
var BlipTonneBase = null;
|
||||||
|
var CheckpointTonneBase = null;
|
||||||
|
var ShapeTonneBase = null;
|
||||||
|
var vehicle = null;
|
||||||
|
|
||||||
|
var BlipTonne = [];
|
||||||
|
var ShapeTonne = [];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
mp.events.add('SERVER:MuellmannStatusTrue', () => {
|
||||||
|
State = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
mp.events.add('SERVER:MuellmannStatusFalse', () => {
|
||||||
|
State = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
mp.events.add('SERVER:MuellmannBCSErstellen', (jsonPosArr, veh) => {
|
||||||
|
|
||||||
|
let posArr = JSON.parse(jsonPosArr);
|
||||||
|
vehicle = veh;
|
||||||
|
for (var i = 0; i < posArr.length; i++) {
|
||||||
|
let pos = new mp.Vector3(posArr[i].x, posArr[i].y, posArr[i].z - 1)
|
||||||
|
BlipTonne.push(mp.blips.new(1, pos, { name: 'Müllmann', color: 45, shortRange: false }));
|
||||||
|
ShapeTonne.push(mp.colshapes.newSphere(posArr[i].x, posArr[i].y, posArr[i].z +0.5, 1.75));
|
||||||
|
}
|
||||||
|
|
||||||
|
BlipTonneBase = mp.blips.new(1, new mp.Vector3(-535.1912, -1713.742, 19.23861 - 1), { name: 'Müllmann', color: 5, shortRange: false });
|
||||||
|
CheckpointTonneBase = mp.markers.new(1, new mp.Vector3(-535.1912, -1713.742, 19.23861 - 1), 10, { direction: new mp.Vector3(-235.5747, -1685.475, 32.7207), color: [255, 255, 0, 150], visible: true, dimension: 0 });
|
||||||
|
ShapeTonneBase = mp.colshapes.newSphere(-535.1912, -1713.742, 19.23861 - 1, 10);
|
||||||
|
});
|
||||||
|
mp.events.add('SERVER:MuellmannBCSEntfernen', () => {
|
||||||
|
|
||||||
|
for (var i = 0; i < BlipTonne.length; i++) {
|
||||||
|
if (BlipTonne[i] == null) continue;
|
||||||
|
BlipTonne[i].destroy();
|
||||||
|
ShapeTonne[i].destroy();
|
||||||
|
}
|
||||||
|
BlipTonne = [];
|
||||||
|
ShapeTonne = [];
|
||||||
|
|
||||||
|
if (BlipTonneHinten) BlipTonneHinten.destroy();
|
||||||
|
BlipTonneHinten = null;
|
||||||
|
if (CheckpointTonneHinten) CheckpointTonneHinten.destroy();
|
||||||
|
CheckpointTonneHinten = null;
|
||||||
|
if (ShapeTonneHinten) ShapeTonneHinten.destroy();
|
||||||
|
ShapeTonneHinten = null;
|
||||||
|
if (BlipTonneBase) BlipTonneBase.destroy();
|
||||||
|
BlipTonneBase = null;
|
||||||
|
if (CheckpointTonneBase) CheckpointTonneBase.destroy();
|
||||||
|
CheckpointTonneBase = null;
|
||||||
|
if (ShapeTonneBase) ShapeTonneBase.destroy();
|
||||||
|
ShapeTonneBase = null;
|
||||||
|
Traegt = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
mp.events.add("playerEnterColshape", (Shape, player) => {
|
||||||
|
//mp.events.callRemote('CLIENT:ImShape', JSON.stringify(Shape));
|
||||||
|
for (var i = 0; i < ShapeTonne.length; i++) {
|
||||||
|
if (Shape != ShapeTonne[i]) continue;
|
||||||
|
if (!Traegt) {
|
||||||
|
if (!HintenVoll) {
|
||||||
|
mp.events.callRemote('CLIENT:MuellmannImShape', JSON.stringify(Shape));
|
||||||
|
Traegt = true;
|
||||||
|
BlipTonne[i].destroy();
|
||||||
|
BlipTonne[i] = null;
|
||||||
|
ShapeTonne[i].destroy();
|
||||||
|
ShapeTonne[i] = null;
|
||||||
|
MuellSack = mp.objects.new(600967813, mp.players.local.position, { rotation: new mp.Vector3(0.0, 0.0, 0.0), alpha: 255, dimension: 0 });
|
||||||
|
MuellSack.attachTo(mp.players.local.handle, mp.players.local.getBoneIndex(6286), 0.45, -0.9, -0.075, 270.0, 0.0, 25.0, true, true, false, false, 0, true);
|
||||||
|
|
||||||
|
createMarker();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mp.gui.chat.push("Der Müllwagen ist bereits voll! Fahre zur Base und lade ab!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mp.gui.chat.push(`Du trägst bereits einen Müllsack!`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Shape == ShapeTonneHinten) {
|
||||||
|
if (Traegt) {
|
||||||
|
|
||||||
|
Traegt = false;
|
||||||
|
mp.events.callRemote('CLIENT:MuellmannAddSack');
|
||||||
|
|
||||||
|
if (BlipTonneHinten) BlipTonneHinten.destroy();
|
||||||
|
BlipTonneHinten = null;
|
||||||
|
if (CheckpointTonneHinten) CheckpointTonneHinten.destroy();
|
||||||
|
CheckpointTonneHinten = null;
|
||||||
|
if (ShapeTonneHinten) ShapeTonneHinten.destroy();
|
||||||
|
ShapeTonneHinten = null;
|
||||||
|
MuellSack.destroy();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (Shape == ShapeTonneBase) {
|
||||||
|
BlipTonneBase.setRoute(false);
|
||||||
|
mp.events.callRemote('CLIENT:MuellmannBaseSack');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mp.events.add("MuellmannUpdateColshape", (jsonColShape) => {
|
||||||
|
let ColShape = JSON.parse(jsonColShape);
|
||||||
|
for (var i = 0; i < ShapeTonne.length; i++) {
|
||||||
|
if (ColShape != ShapeTonne[i]) continue;
|
||||||
|
BlipTonne[i].destroy();
|
||||||
|
BlipTonne[i] = null;
|
||||||
|
ShapeTonne[i].destroy();
|
||||||
|
ShapeTonne[i] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
mp.events.add("SERVER:MuellmannZuBase", () => {
|
||||||
|
BlipTonneBase.setRoute(true);
|
||||||
|
BlipTonneBase.setRouteColour(5);
|
||||||
|
HintenVoll = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
mp.events.add("SERVER:MuellmannWiederLeer", () => {
|
||||||
|
HintenVoll = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
function createMarker() {
|
||||||
|
if (vehicle != null) {
|
||||||
|
const playerPos = vehicle.position;
|
||||||
|
let pos = new mp.Vector3(vehicle.position.x, vehicle.position.y - 5.5, vehicle.position.z - 1);
|
||||||
|
if (BlipTonneHinten) BlipTonneHinten.destroy();
|
||||||
|
BlipTonneHinten = null;
|
||||||
|
if (CheckpointTonneHinten) CheckpointTonneHinten.destroy();
|
||||||
|
CheckpointTonneHinten = null;
|
||||||
|
if (ShapeTonneHinten) ShapeTonneHinten.destroy();
|
||||||
|
ShapeTonneHinten = null;
|
||||||
|
BlipTonneHinten = mp.blips.new(1, pos, { name: 'Müllmann', color: 24, shortRange: false });
|
||||||
|
CheckpointTonneHinten = mp.markers.new(1, pos, 1, { direction: new mp.Vector3(-235.5747, -1685.475, 32.7207), color: [0, 255, 0, 255], visible: true, dimension: 0 });
|
||||||
|
ShapeTonneHinten = mp.colshapes.newSphere(vehicle.position.x, vehicle.position.y - 5.5, vehicle.position.z - 1, 2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -203,6 +203,9 @@ itemShopList(globalData);
|
|||||||
import taximeterInput from './Gui/taximeter';
|
import taximeterInput from './Gui/taximeter';
|
||||||
taximeterInput(globalData);
|
taximeterInput(globalData);
|
||||||
|
|
||||||
|
import refuseCollector from './Jobs/RefuseCollector';
|
||||||
|
refuseCollector();
|
||||||
|
|
||||||
require('./Gui/policedepartment');
|
require('./Gui/policedepartment');
|
||||||
|
|
||||||
interface VehicleData {
|
interface VehicleData {
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default function gangwarHandle(globalData: IGlobalData) {
|
|
||||||
|
|
||||||
|
export default function gangwarHandle(globalData: IGlobalData) {
|
||||||
|
|
||||||
function inside(point, vs) {
|
function inside(point, vs) {
|
||||||
let x = point[0],
|
let x = point[0],
|
||||||
@@ -48,7 +50,10 @@
|
|||||||
attacker: string;
|
attacker: string;
|
||||||
blip: BlipMp;
|
blip: BlipMp;
|
||||||
_colshape: ColshapeMp;
|
_colshape: ColshapeMp;
|
||||||
|
_marker: MarkerMp;
|
||||||
vector: Vector3Mp;
|
vector: Vector3Mp;
|
||||||
|
value: number;
|
||||||
|
|
||||||
_status: string;
|
_status: string;
|
||||||
_entered: boolean;
|
_entered: boolean;
|
||||||
_isEntering: boolean;
|
_isEntering: boolean;
|
||||||
@@ -60,11 +65,11 @@
|
|||||||
leaderBlipVector: Vector3Mp;
|
leaderBlipVector: Vector3Mp;
|
||||||
leaderColShape: MarkerMp;
|
leaderColShape: MarkerMp;
|
||||||
|
|
||||||
constructor(name, id, x, y, range, color, rot, owner, edit, vector) {
|
constructor(name, id, x, y, range, color, rot, owner, edit, vector, value) {
|
||||||
this._setup(name, id, x, y, range, color, rot, owner, edit, vector);
|
this._setup(name, id, x, y, range, color, rot, owner, edit, vector, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
_setup(name, id, x, y, range, color, rot, owner, edit, vector) {
|
_setup(name, id, x, y, range, color, rot, owner, edit, vector, value) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
self.name = name;
|
self.name = name;
|
||||||
@@ -86,6 +91,7 @@
|
|||||||
self.loadArea();
|
self.loadArea();
|
||||||
self.attackBlip = null;
|
self.attackBlip = null;
|
||||||
self.leaderBlip = null;
|
self.leaderBlip = null;
|
||||||
|
self.value = value;
|
||||||
if (vector != null) {
|
if (vector != null) {
|
||||||
self.leaderBlipVector = JSON.parse(vector);
|
self.leaderBlipVector = JSON.parse(vector);
|
||||||
} else {
|
} else {
|
||||||
@@ -123,6 +129,7 @@
|
|||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.blip = mp.game.ui.addBlipForRadius(self.x, self.y, 1, self.range);
|
self.blip = mp.game.ui.addBlipForRadius(self.x, self.y, 1, self.range);
|
||||||
|
|
||||||
mp.game.invoke(Natives.SET_BLIP_SPRITE, self.blip, 5);
|
mp.game.invoke(Natives.SET_BLIP_SPRITE, self.blip, 5);
|
||||||
mp.game.invoke(Natives.SET_BLIP_ALPHA, self.blip, 70);
|
mp.game.invoke(Natives.SET_BLIP_ALPHA, self.blip, 70);
|
||||||
mp.game.invoke(Natives.SET_BLIP_COLOUR, self.blip, self.color);
|
mp.game.invoke(Natives.SET_BLIP_COLOUR, self.blip, self.color);
|
||||||
@@ -136,10 +143,13 @@
|
|||||||
if (self.edit == true) {
|
if (self.edit == true) {
|
||||||
let vector3 = mp.players.local.getRotation(2);
|
let vector3 = mp.players.local.getRotation(2);
|
||||||
self.rotation = Math.round(vector3.z);
|
self.rotation = Math.round(vector3.z);
|
||||||
|
//self.blip.setPosition(mp.players.local.position.x, mp.players.local.position.y, 1);
|
||||||
|
|
||||||
mp.game.invoke(Natives.SET_BLIP_COORDS, self.blip, mp.players.local.position.x, mp.players.local.position.y, 1);
|
mp.game.invoke(Natives.SET_BLIP_COORDS, self.blip, mp.players.local.position.x, mp.players.local.position.y, 1);
|
||||||
self.x = mp.players.local.position.x;
|
self.x = mp.players.local.position.x;
|
||||||
self.y = mp.players.local.position.y;
|
self.y = mp.players.local.position.y;
|
||||||
}
|
}
|
||||||
|
//self.blip.setRotation(self.rotation);
|
||||||
mp.game.invoke(Natives.SET_BLIP_ROTATION, self.blip, self.rotation);
|
mp.game.invoke(Natives.SET_BLIP_ROTATION, self.blip, self.rotation);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -192,7 +202,7 @@
|
|||||||
a += 0.001
|
a += 0.001
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,7 +223,7 @@
|
|||||||
let dist = mp.game.gameplay.getDistanceBetweenCoords(mp.players.local.position.x, mp.players.local.position.y, mp.players.local.position.z, self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z, false);
|
let dist = mp.game.gameplay.getDistanceBetweenCoords(mp.players.local.position.x, mp.players.local.position.y, mp.players.local.position.z, self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z, false);
|
||||||
if (self.isInsideArea() && self._status != "attack" && dist <= 6) {
|
if (self.isInsideArea() && self._status != "attack" && dist <= 6) {
|
||||||
if (self.leaderBlipVector != null) {
|
if (self.leaderBlipVector != null) {
|
||||||
mp.game.graphics.drawText(self.name + "\n~y~Gang: ~s~" + self.owner + "\n~y~Wert: ~s~$~g~187", [self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z], {
|
mp.game.graphics.drawText(self.name + "\n~y~Gang: ~s~" + self.owner + "\n~y~Wert: ~s~$~g~" + self.value, [self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z], {
|
||||||
font: 7,
|
font: 7,
|
||||||
color: [255, 255, 255, 185],
|
color: [255, 255, 255, 185],
|
||||||
scale: [0.4, 0.4],
|
scale: [0.4, 0.4],
|
||||||
@@ -227,7 +237,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
startGangWar() {
|
startGangWar() {
|
||||||
var self = this;
|
var self = this;
|
||||||
if (self._status == "normal") {
|
if (self._status == "normal") {
|
||||||
let dist = mp.game.gameplay.getDistanceBetweenCoords(mp.players.local.position.x, mp.players.local.position.y, 0, self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z, false);
|
let dist = mp.game.gameplay.getDistanceBetweenCoords(mp.players.local.position.x, mp.players.local.position.y, 0, self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z, false);
|
||||||
@@ -246,11 +256,13 @@
|
|||||||
}
|
}
|
||||||
self._status = "attack";
|
self._status = "attack";
|
||||||
self.attacker = args[1];
|
self.attacker = args[1];
|
||||||
|
//self.blip.setFlashes(true);
|
||||||
mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, true);
|
mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (status == "normal") {
|
if (status == "normal") {
|
||||||
self._status = "normal";
|
self._status = "normal";
|
||||||
|
//self.blip.setFlashes(false);
|
||||||
mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, false);
|
mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -259,8 +271,10 @@
|
|||||||
self._status = "normal";
|
self._status = "normal";
|
||||||
self.owner = args[0];
|
self.owner = args[0];
|
||||||
self.attacker = null;
|
self.attacker = null;
|
||||||
|
//self.blip.setFlashes(false);
|
||||||
mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, false);
|
mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, false);
|
||||||
self.setColor(self.owner)
|
self.setColor(self.owner)
|
||||||
|
//self.blip.setColour(self.color);
|
||||||
mp.game.invoke(Natives.SET_BLIP_COLOUR, self.blip, self.color);
|
mp.game.invoke(Natives.SET_BLIP_COLOUR, self.blip, self.color);
|
||||||
self.setLeaderColShape();
|
self.setLeaderColShape();
|
||||||
return;
|
return;
|
||||||
@@ -302,13 +316,13 @@
|
|||||||
|
|
||||||
setLeaderColShape() {
|
setLeaderColShape() {
|
||||||
var self = this;
|
var self = this;
|
||||||
let newVector = new mp.Vector3(self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z - 2)
|
let newVector = new mp.Vector3(self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z - 2)
|
||||||
|
|
||||||
self.leaderColShape = mp.markers.new(1, newVector, 2, {
|
self.leaderColShape = mp.markers.new(1, newVector, 2, {
|
||||||
color: [255, 255, 0, 150],
|
color: [255, 255, 0, 150],
|
||||||
visible: true,
|
visible: true,
|
||||||
dimension: 0
|
dimension: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,7 +335,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
check() {
|
check() {
|
||||||
var self = this
|
var self = this
|
||||||
if (self._entered == true) {
|
if (self._entered == true) {
|
||||||
if (!self.isInsideArea() || (self.isNearGround() == false)) {
|
if (!self.isInsideArea() || (self.isNearGround() == false)) {
|
||||||
self._entered = false;
|
self._entered = false;
|
||||||
@@ -412,6 +426,11 @@
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setValue(value) {
|
||||||
|
var self = this;
|
||||||
|
self.value = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var gangturfs = [];
|
var gangturfs = [];
|
||||||
@@ -453,18 +472,23 @@
|
|||||||
let last_blip = mp.game.invoke(Natives.GET_FIRST_BLIP_INFO_ID, 5);
|
let last_blip = mp.game.invoke(Natives.GET_FIRST_BLIP_INFO_ID, 5);
|
||||||
|
|
||||||
while (mp.game.invoke(Natives.DOES_BLIP_EXIST, last_blip)) {
|
while (mp.game.invoke(Natives.DOES_BLIP_EXIST, last_blip)) {
|
||||||
|
mp.game.invoke(Natives.SET_BLIP_SPRITE, last_blip, -1);
|
||||||
mp.game.ui.removeBlip(last_blip);
|
mp.game.ui.removeBlip(last_blip);
|
||||||
last_blip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 5);
|
last_blip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 5);
|
||||||
|
x++;
|
||||||
|
mp.gui.chat.push(""+x);
|
||||||
}
|
}
|
||||||
|
|
||||||
let last_attackBlip = mp.game.invoke(Natives.GET_FIRST_BLIP_INFO_ID, 378);
|
let last_attackBlip = mp.game.invoke(Natives.GET_FIRST_BLIP_INFO_ID, 378);
|
||||||
while (mp.game.invoke(Natives.DOES_BLIP_EXIST, last_attackBlip)) {
|
while (mp.game.invoke(Natives.DOES_BLIP_EXIST, last_attackBlip)) {
|
||||||
|
mp.game.invoke(Natives.SET_BLIP_SPRITE, last_attackBlip, -1);
|
||||||
mp.game.ui.removeBlip(last_attackBlip);
|
mp.game.ui.removeBlip(last_attackBlip);
|
||||||
last_attackBlip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 378);
|
last_attackBlip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 378);
|
||||||
}
|
}
|
||||||
|
|
||||||
let last_leaderBlip = mp.game.invoke(Natives.GET_FIRST_BLIP_INFO_ID, 437);
|
let last_leaderBlip = mp.game.invoke(Natives.GET_FIRST_BLIP_INFO_ID, 437);
|
||||||
while (mp.game.invoke(Natives.DOES_BLIP_EXIST, last_leaderBlip)) {
|
while (mp.game.invoke(Natives.DOES_BLIP_EXIST, last_leaderBlip)) {
|
||||||
|
mp.game.invoke(Natives.SET_BLIP_SPRITE, last_leaderBlip, -1);
|
||||||
mp.game.ui.removeBlip(last_leaderBlip);
|
mp.game.ui.removeBlip(last_leaderBlip);
|
||||||
last_leaderBlip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 437);
|
last_leaderBlip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 437);
|
||||||
}
|
}
|
||||||
@@ -481,6 +505,16 @@
|
|||||||
turf.leaderColShape.destroy();
|
turf.leaderColShape.destroy();
|
||||||
turf.leaderColShape = null;
|
turf.leaderColShape = null;
|
||||||
}
|
}
|
||||||
|
if (turf._marker)
|
||||||
|
if (turf.blip != null) {
|
||||||
|
mp.game.ui.removeBlip(turf.blip);
|
||||||
|
}
|
||||||
|
if (turf.leaderBlip != null) {
|
||||||
|
mp.game.ui.removeBlip(turf.leaderBlip);
|
||||||
|
}
|
||||||
|
if (turf.attackBlip != null) {
|
||||||
|
mp.game.ui.removeBlip(turf.attackBlip);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
clearBlips();
|
clearBlips();
|
||||||
@@ -489,7 +523,7 @@
|
|||||||
gangturfs = [];
|
gangturfs = [];
|
||||||
turfs.forEach(function (turf) {
|
turfs.forEach(function (turf) {
|
||||||
if (turf.Id != undefined) {
|
if (turf.Id != undefined) {
|
||||||
gangturfs[gangturfs.length] = new Gangturf(turf.Name, turf.Id, turf.X, turf.Y, turf.Range, turf.Color, turf.Rotation, turf.Owner, false, turf.Vector);
|
gangturfs[gangturfs.length] = new Gangturf(turf.Name, turf.Id, turf.X, turf.Y, turf.Range, turf.Color, turf.Rotation, turf.Owner, false, turf.Vector, turf.Value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -497,7 +531,7 @@
|
|||||||
|
|
||||||
mp.events.add('ADMIN:CreateTurf', (rangeJSON) => {
|
mp.events.add('ADMIN:CreateTurf', (rangeJSON) => {
|
||||||
var range = JSON.parse(rangeJSON);
|
var range = JSON.parse(rangeJSON);
|
||||||
gangturfs[gangturfs.length] = new Gangturf("Reload For Name", -1, mp.players.local.position.x, mp.players.local.position.y, range, 0, mp.players.local.getHeading(), "Neutral", true, null);
|
gangturfs[gangturfs.length] = new Gangturf("Reload For Name", -1, mp.players.local.position.x, mp.players.local.position.y, range, 0, mp.players.local.getHeading(), "Neutral", true, null, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
mp.events.add('ADMIN:SetTurf', (name) => {
|
mp.events.add('ADMIN:SetTurf', (name) => {
|
||||||
@@ -541,7 +575,7 @@
|
|||||||
|
|
||||||
mp.events.add('CLIENT:Turf_LoadLeaderBlip', () => {
|
mp.events.add('CLIENT:Turf_LoadLeaderBlip', () => {
|
||||||
gangturfs.forEach(function (turf) {
|
gangturfs.forEach(function (turf) {
|
||||||
turf.setLeaderBlip(false);
|
turf.setLeaderBlip(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -560,4 +594,13 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mp.events.add('CLIENT:UpdateTurfValue', (jsonValues) => {
|
||||||
|
let values = JSON.parse(jsonValues);
|
||||||
|
for (var i = 0; i < gangturfs.length; i++) {
|
||||||
|
let turf = gangturfs[i];
|
||||||
|
turf.setValue(values[i]);
|
||||||
|
turf.render();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
@@ -22,6 +22,9 @@ namespace ReallifeGamemode.Database.Entities
|
|||||||
public float Range { get; set; }
|
public float Range { get; set; }
|
||||||
public int Color { get; set; }
|
public int Color { get; set; }
|
||||||
public string Vector { get; set; } = null;
|
public string Vector { get; set; } = null;
|
||||||
|
public int Value {get; set;} = 0;
|
||||||
|
public int MaxValue { get; set; } = 0;
|
||||||
|
public bool Surplus { get; set; } = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1443
ReallifeGamemode.Database/Migrations/20200403035225_TurfSurplusValue.Designer.cs
generated
Normal file
1443
ReallifeGamemode.Database/Migrations/20200403035225_TurfSurplusValue.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,33 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Database.Migrations
|
||||||
|
{
|
||||||
|
public partial class TurfSurplusValue : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "Surplus",
|
||||||
|
table: "Turfs",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "Value",
|
||||||
|
table: "Turfs",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Surplus",
|
||||||
|
table: "Turfs");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Value",
|
||||||
|
table: "Turfs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -965,6 +965,10 @@ namespace ReallifeGamemode.Database.Migrations
|
|||||||
|
|
||||||
b.Property<float>("Rotation");
|
b.Property<float>("Rotation");
|
||||||
|
|
||||||
|
b.Property<bool>("Surplus");
|
||||||
|
|
||||||
|
b.Property<int>("Value");
|
||||||
|
|
||||||
b.Property<string>("Vector");
|
b.Property<string>("Vector");
|
||||||
|
|
||||||
b.Property<float>("X");
|
b.Property<float>("X");
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ using ReallifeGamemode.Server.Common;
|
|||||||
|
|
||||||
namespace ReallifeGamemode.Server.Core.Managers
|
namespace ReallifeGamemode.Server.Core.Managers
|
||||||
{
|
{
|
||||||
class HouseManager : Script
|
public class HouseManager : Script
|
||||||
{
|
{
|
||||||
private readonly Dictionary<int, IMarker> houseMarkers = new Dictionary<int, IMarker>();
|
public static readonly Dictionary<int, IMarker> houseMarkers = new Dictionary<int, IMarker>();
|
||||||
private readonly Dictionary<int, ITextLabel> houseLabels = new Dictionary<int, ITextLabel>();
|
private readonly Dictionary<int, ITextLabel> houseLabels = new Dictionary<int, ITextLabel>();
|
||||||
private readonly Dictionary<int, IColShape> houseColShapes = new Dictionary<int, IColShape>();
|
private readonly Dictionary<int, IColShape> houseColShapes = new Dictionary<int, IColShape>();
|
||||||
private readonly Dictionary<int, IBlip> houseBlips = new Dictionary<int, IBlip>();
|
private readonly Dictionary<int, IBlip> houseBlips = new Dictionary<int, IBlip>();
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using ReallifeGamemode.Server.Log;
|
|||||||
|
|
||||||
namespace ReallifeGamemode.Server.Core
|
namespace ReallifeGamemode.Server.Core
|
||||||
{
|
{
|
||||||
internal abstract class Script
|
public abstract class Script
|
||||||
{
|
{
|
||||||
protected IAPI Api => Main.API;
|
protected IAPI Api => Main.API;
|
||||||
|
|
||||||
|
|||||||
@@ -995,7 +995,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name is null || component == null || drawable == null)
|
if (name == null || component == null || drawable == null)
|
||||||
{
|
{
|
||||||
player.SendChatMessage("~m~Benutzung: ~s~/clothes [Spieler] [Component ID] [Drawable] (Textur)");
|
player.SendChatMessage("~m~Benutzung: ~s~/clothes [Spieler] [Component ID] [Drawable] (Textur)");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -119,15 +119,15 @@ namespace ReallifeGamemode.Server.Finance
|
|||||||
ChatService.SendMessage(client, "~g~[PAYDAY]~s~ Dein Stundenumsatz beträgt - $~r~" + paycheck.Amount + "~s~.");
|
ChatService.SendMessage(client, "~g~[PAYDAY]~s~ Dein Stundenumsatz beträgt - $~r~" + paycheck.Amount + "~s~.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
public static void PaydayTimer()
|
public static void PaydayTimer()
|
||||||
{
|
{
|
||||||
System.Timers.Timer timer = new System.Timers.Timer(60000);
|
System.Timers.Timer timer = new System.Timers.Timer(60000);
|
||||||
timer.Start();
|
timer.Start();
|
||||||
timer.Elapsed += Timer_Elapsed;
|
timer.Elapsed += Timer_Elapsed;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
public static void Timer_Elapsed()
|
||||||
{
|
{
|
||||||
foreach (var player in NAPI.Pools.GetAllPlayers())
|
foreach (var player in NAPI.Pools.GetAllPlayers())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
|
||||||
using GTANetworkAPI;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using ReallifeGamemode.Database.Models;
|
using GTANetworkAPI;
|
||||||
using ReallifeGamemode.Database.Entities;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using ReallifeGamemode.Server.Services;
|
using ReallifeGamemode.Database.Entities;
|
||||||
|
using ReallifeGamemode.Database.Models;
|
||||||
using ReallifeGamemode.Server.Extensions;
|
using ReallifeGamemode.Server.Extensions;
|
||||||
|
using ReallifeGamemode.Server.Services;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Gangwar
|
namespace ReallifeGamemode.Server.Gangwar
|
||||||
{
|
{
|
||||||
@@ -25,7 +24,7 @@ namespace ReallifeGamemode.Server.Gangwar
|
|||||||
List<Turf> turfing = new List<Turf>();
|
List<Turf> turfing = new List<Turf>();
|
||||||
foreach (var t in turfs)
|
foreach (var t in turfs)
|
||||||
{
|
{
|
||||||
Turf newTurf = new Turf(t.Id, t.Name, t.Color, t.Owner);
|
Turf newTurf = new Turf(t.Id, t.Name, t.Color, t.Owner, t.Value, t.MaxValue, t.Surplus);
|
||||||
turfing.Add(newTurf);
|
turfing.Add(newTurf);
|
||||||
}
|
}
|
||||||
_loadedTurfs = turfing.ToArray();
|
_loadedTurfs = turfing.ToArray();
|
||||||
@@ -40,13 +39,12 @@ namespace ReallifeGamemode.Server.Gangwar
|
|||||||
public static void loadTurfs_ToAllPlayers()
|
public static void loadTurfs_ToAllPlayers()
|
||||||
{
|
{
|
||||||
NAPI.ClientEvent.TriggerClientEventForAll("GangAreas:Create", JsonConvert.SerializeObject(turfs.ToArray()));
|
NAPI.ClientEvent.TriggerClientEventForAll("GangAreas:Create", JsonConvert.SerializeObject(turfs.ToArray()));
|
||||||
foreach(var l in NAPI.Pools.GetAllPlayers())
|
foreach (var l in NAPI.Pools.GetAllPlayers())
|
||||||
{
|
{
|
||||||
if (!l.IsLoggedIn() && !l.GetUser().FactionLeader)
|
if (!l.IsLoggedIn() && !l.GetUser().FactionLeader)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
l.TriggerEvent("CLIENT:Turf_LoadLeaderBlip");
|
l.TriggerEvent("CLIENT:Turf_LoadLeaderBlip");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +149,8 @@ namespace ReallifeGamemode.Server.Gangwar
|
|||||||
}
|
}
|
||||||
|
|
||||||
[RemoteEvent("SERVER:Turf_SetNewLeaderPoint")]
|
[RemoteEvent("SERVER:Turf_SetNewLeaderPoint")]
|
||||||
public void RmtEvent_SetNewLeaderPoint(Player client, string vector, string jsonId) {
|
public void RmtEvent_SetNewLeaderPoint(Player client, string vector, string jsonId)
|
||||||
|
{
|
||||||
int id = JsonConvert.DeserializeObject<int>(jsonId);
|
int id = JsonConvert.DeserializeObject<int>(jsonId);
|
||||||
if (id == -1)
|
if (id == -1)
|
||||||
{
|
{
|
||||||
@@ -171,7 +170,6 @@ namespace ReallifeGamemode.Server.Gangwar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[RemoteEvent("SERVER:StartGangwar")]
|
[RemoteEvent("SERVER:StartGangwar")]
|
||||||
public void RmtEvent_StartGangwar(Player client)
|
public void RmtEvent_StartGangwar(Player client)
|
||||||
{
|
{
|
||||||
@@ -182,7 +180,7 @@ namespace ReallifeGamemode.Server.Gangwar
|
|||||||
{
|
{
|
||||||
if (turf.status == "attack")
|
if (turf.status == "attack")
|
||||||
{
|
{
|
||||||
ChatService.ErrorMessage(client,"Du kannst momentan kein Gangwar starten");
|
ChatService.ErrorMessage(client, "Du kannst momentan kein Gangwar starten");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -200,8 +198,30 @@ namespace ReallifeGamemode.Server.Gangwar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Value_TimerElapsed()
|
||||||
|
{
|
||||||
|
List<int> values = new List<int>();
|
||||||
|
using (var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
foreach (var turf in getTurfs())
|
||||||
|
{
|
||||||
|
if((turf.getValue() + 5) >= turf.getMaxValue())
|
||||||
|
{
|
||||||
|
turf.setValue(turf.getMaxValue());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
turf.addValue(5);
|
||||||
|
}
|
||||||
|
values.Add(turf.getValue());
|
||||||
|
Turfs _turf = dbContext.Turfs.Where(t => t.Id == turf.getId()).FirstOrDefault();
|
||||||
|
_turf.Value = turf.getValue();
|
||||||
|
}
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
}
|
||||||
|
NAPI.ClientEvent.TriggerClientEventForAll("CLIENT:UpdateTurfValue", JsonConvert.SerializeObject(values.ToArray()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,18 +24,24 @@ namespace ReallifeGamemode.Server.Gangwar
|
|||||||
public int Att_Score { get; set; }
|
public int Att_Score { get; set; }
|
||||||
public int Def_Score { get; set; }
|
public int Def_Score { get; set; }
|
||||||
public string status { get; set; }
|
public string status { get; set; }
|
||||||
|
public int value { get; set; }
|
||||||
|
public int maxValue { get; set; }
|
||||||
|
public bool surplus { get; set; }
|
||||||
public List<Player> playerInside { get; set; }
|
public List<Player> playerInside { get; set; }
|
||||||
public Timer timer { get; set; }
|
public Timer timer { get; set; }
|
||||||
public Player[] playerInGangwar { get; set; }
|
public Player[] playerInGangwar { get; set; }
|
||||||
public int timerCount;
|
public int timerCount;
|
||||||
|
|
||||||
|
|
||||||
public Turf(int TurfID, string TurfName, int color, string Owner)
|
public Turf(int TurfID, string TurfName, int color, string Owner, int value, int maxValue,bool surplus)
|
||||||
{
|
{
|
||||||
this.TurfID = TurfID;
|
this.TurfID = TurfID;
|
||||||
this.TurfName = TurfName;
|
this.TurfName = TurfName;
|
||||||
this.Color = color;
|
this.Color = color;
|
||||||
this.Owner = Owner;
|
this.Owner = Owner;
|
||||||
|
this.value = value;
|
||||||
|
this.maxValue = maxValue;
|
||||||
|
this.surplus = surplus;
|
||||||
this.Attacker = null;
|
this.Attacker = null;
|
||||||
this.Att_Score = 50;
|
this.Att_Score = 50;
|
||||||
this.Def_Score = 50;
|
this.Def_Score = 50;
|
||||||
@@ -50,6 +56,36 @@ namespace ReallifeGamemode.Server.Gangwar
|
|||||||
return this.TurfID;
|
return this.TurfID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getValue()
|
||||||
|
{
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(int value)
|
||||||
|
{
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addValue(int addedValue)
|
||||||
|
{
|
||||||
|
this.value += addedValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxValue()
|
||||||
|
{
|
||||||
|
return maxValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool getSurplus()
|
||||||
|
{
|
||||||
|
return surplus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSurplus(bool surplus)
|
||||||
|
{
|
||||||
|
this.surplus = surplus;
|
||||||
|
}
|
||||||
|
|
||||||
public string getName()
|
public string getName()
|
||||||
{
|
{
|
||||||
return this.TurfName;
|
return this.TurfName;
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Linq;
|
||||||
|
using GTANetworkAPI;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using ReallifeGamemode.Server.Services;
|
||||||
|
using ReallifeGamemode.Database.Models;
|
||||||
|
using ReallifeGamemode.Server.Core.Managers;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Job
|
namespace ReallifeGamemode.Server.Job
|
||||||
{
|
{
|
||||||
@@ -11,5 +16,341 @@ namespace ReallifeGamemode.Server.Job
|
|||||||
public override string Name => "Müllmann";
|
public override string Name => "Müllmann";
|
||||||
|
|
||||||
public override bool NeedVehicleToStart => false;
|
public override bool NeedVehicleToStart => false;
|
||||||
|
|
||||||
|
|
||||||
|
public RefuseCollectorJob()
|
||||||
|
{
|
||||||
|
JobStart += RefuseCollectorJobJobStart;
|
||||||
|
JobStop += RefuseCollectorJobJobStop;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RefuseCollectorJobJobStart(Player player)
|
||||||
|
{
|
||||||
|
//setClothes
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RefuseCollectorJobJobStop(Player player)
|
||||||
|
{
|
||||||
|
//removeClothes and replace with old
|
||||||
|
MuellmannJobBeenden(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public List<MuellmannData> muellmanData = new List<MuellmannData>();
|
||||||
|
private List<Vector3> vector3s = new List<Vector3>();
|
||||||
|
|
||||||
|
[ServerEvent(Event.ResourceStart)]
|
||||||
|
public void LoadHouses()
|
||||||
|
{
|
||||||
|
foreach(var marker in HouseManager.houseMarkers)
|
||||||
|
{
|
||||||
|
vector3s.Add(new Vector3(marker.Value.Position.X, marker.Value.Position.Y, marker.Value.Position.Z));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[RemoteEvent("CLIENT:MuellmannJobStarten")]
|
||||||
|
public void MuellmannJobStarten(Player player, Vehicle vehicle)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (vehicle.Model == (uint)Types.VehicleModel.Trash || vehicle.Model == (uint)Types.VehicleModel.Trash2)
|
||||||
|
{
|
||||||
|
Vehicle veh;
|
||||||
|
foreach (var data in muellmanData)
|
||||||
|
{
|
||||||
|
if (data.getDataFromClient(player) == null) continue;
|
||||||
|
veh = data.vehicle;
|
||||||
|
ChatService.SendMessage((Player)player, "~g~Du hast den Müllmann-Job gestartet!");
|
||||||
|
player.TriggerEvent("SERVER:MuellmannStatusTrue");
|
||||||
|
player.TriggerEvent("SERVER:MuellmannBCSErstellen", JsonConvert.SerializeObject(vector3s.ToArray()), veh);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void MuellmannJobBeenden(Player player)
|
||||||
|
{
|
||||||
|
if (player.IsInVehicle)
|
||||||
|
{
|
||||||
|
Vehicle vehicle = player.Vehicle;
|
||||||
|
if (vehicle.Model == (uint)Types.VehicleModel.Trash || vehicle.Model == (uint)Types.VehicleModel.Trash2)
|
||||||
|
{
|
||||||
|
|
||||||
|
ChatService.SendMessage((Player)player, "~g~Du hast den Müllmann-Job beendet!");
|
||||||
|
player.TriggerEvent("SERVER:MuellmannStatusFalse");
|
||||||
|
player.TriggerEvent("SERVER:MuellmannBCSEntfernen");
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChatService.SendMessage((Player)player, "~r~INFO: Das ist kein Müllwagen!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChatService.SendMessage((Player)player, "~r~INFO: Zum Job beenden musst du im Auto sein.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
[RemoteEvent("CLIENT:MuellmannImShape")]
|
||||||
|
public void MuellmannImShape(Player player, string jsonColShape)
|
||||||
|
{
|
||||||
|
foreach (var data in muellmanData)
|
||||||
|
{
|
||||||
|
if (data.getDataFromClient(player) == null) continue;
|
||||||
|
Player target = data.getPartnerClient(player);
|
||||||
|
if (target != null) target.TriggerEvent("MuellmannUpdateColshape", jsonColShape);
|
||||||
|
ChatService.SendMessage((Player)player, "Du hast den Müllsack in der Hand. Bringe ihm zum Müllwagen hinten.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[RemoteEvent("CLIENT:MuellmannAddSack")]
|
||||||
|
public void MuellmannAddSack(Player player)
|
||||||
|
{
|
||||||
|
foreach (var data in muellmanData)
|
||||||
|
{
|
||||||
|
if (data.getDataFromClient(player) == null) continue;
|
||||||
|
|
||||||
|
int count = data.getTrashCount();
|
||||||
|
count++;
|
||||||
|
data.setTrashCount(count);
|
||||||
|
|
||||||
|
Player target = data.getPartnerClient(player);
|
||||||
|
if (target != null) ChatService.SendMessage((Player)target, $"Es sind jetzt {count} Säcke im Müllwagen.");
|
||||||
|
ChatService.SendMessage((Player)player, $"Es sind jetzt {count} Säcke im Müllwagen.");
|
||||||
|
|
||||||
|
if (data.getTrashCount() >= 2)
|
||||||
|
{
|
||||||
|
ChatService.SendMessage((Player)player, "Auto ist voll fahre nun zu Base.");
|
||||||
|
if (target != null) { ChatService.SendMessage((Player)target, "Auto ist voll fahre nun zu Base."); target.TriggerEvent("SERVER:MuellmannZuBase"); }
|
||||||
|
player.TriggerEvent("SERVER:MuellmannZuBase");
|
||||||
|
}
|
||||||
|
//bonus pro sack
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[RemoteEvent("CLIENT:MuellmannBaseSack")]
|
||||||
|
public void MuellmannBaseSack(Player player)
|
||||||
|
{
|
||||||
|
if (player.VehicleSeat != 0) return;
|
||||||
|
|
||||||
|
foreach (var data in muellmanData)
|
||||||
|
{
|
||||||
|
if (data.getDataFromClient(player) == null) continue;
|
||||||
|
|
||||||
|
int count = data.getTrashCount();
|
||||||
|
|
||||||
|
Player target = data.getPartnerClient(player);
|
||||||
|
if (target != null) ChatService.SendMessage((Player)target, $"Fahrzeug wurde entleert. Säcke: {count}");
|
||||||
|
ChatService.SendMessage((Player)player, $"Fahrzeug wurde entleert. Säcke: {count}");
|
||||||
|
player.TriggerEvent("SERVER:MuellmannHintenWiederLeer");
|
||||||
|
//bonus pro sack
|
||||||
|
|
||||||
|
data.setTrashCount(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region zweiSpeieler
|
||||||
|
[ServerEvent(Event.PlayerDisconnected)]
|
||||||
|
private void SrvEvent_PlayerDc(Player player)
|
||||||
|
{
|
||||||
|
if (!GetPlayerInJob().Contains(player)) return;
|
||||||
|
foreach (var data in muellmanData)
|
||||||
|
{
|
||||||
|
if (data.getDataFromClient(player) == null) continue;
|
||||||
|
|
||||||
|
if (data.hasFreePlace())
|
||||||
|
{
|
||||||
|
muellmanData.Remove(data);
|
||||||
|
//müllwagen respawnen
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
data.removeClientFromData(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[ServerEvent(Event.PlayerDeath)]
|
||||||
|
private void SrvEvent_PlayerDeath(Player player)
|
||||||
|
{
|
||||||
|
if (!GetPlayerInJob().Contains(player)) return;
|
||||||
|
foreach (var data in muellmanData)
|
||||||
|
{
|
||||||
|
if (data.getDataFromClient(player) == null) continue;
|
||||||
|
|
||||||
|
if (data.hasFreePlace())
|
||||||
|
{
|
||||||
|
muellmanData.Remove(data);
|
||||||
|
//müllwagen respawnen
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
data.removeClientFromData(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[ServerEvent(Event.VehicleDeath)]
|
||||||
|
private void SrvEvent_Vehicle(Vehicle veh)
|
||||||
|
{
|
||||||
|
if (veh.Model != (uint)Types.VehicleModel.Trash && veh.Model != (uint)Types.VehicleModel.Trash2) return;
|
||||||
|
foreach (var data in muellmanData)
|
||||||
|
{
|
||||||
|
if (data.vehicle == veh)
|
||||||
|
{
|
||||||
|
//müllfahrzeug respawnen
|
||||||
|
|
||||||
|
List<Player> clients = data.getClientsFromData();
|
||||||
|
foreach(var c in clients){ RefuseCollectorJobJobStop(c); }
|
||||||
|
|
||||||
|
muellmanData.Remove(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ServerEvent(Event.PlayerEnterVehicleAttempt)]
|
||||||
|
public void SrvEvent_PlayerEnterVehicle(Player player, Vehicle vehicle, sbyte seat)
|
||||||
|
{
|
||||||
|
Player target;
|
||||||
|
if (!GetPlayerInJob().Contains(player)) return;
|
||||||
|
|
||||||
|
if (vehicle.Model == (uint)Types.VehicleModel.Trash || vehicle.Model == (uint)Types.VehicleModel.Trash2)
|
||||||
|
{
|
||||||
|
foreach (var data in muellmanData)
|
||||||
|
{
|
||||||
|
if (data.vehicle == vehicle)
|
||||||
|
{
|
||||||
|
if (data.getDataFromClient(player) != null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!data.hasFreePlace())
|
||||||
|
{
|
||||||
|
player.StopAnimation();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CheckDataForDuplicatePlayer(player, data);
|
||||||
|
data.setClientToData(player);
|
||||||
|
|
||||||
|
MuellmannJobStarten(player, vehicle);
|
||||||
|
|
||||||
|
target = data.getPartnerClient(player);
|
||||||
|
if (target == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ChatService.SendMessage((Player)player, $"Dein Partner ist {target.Name} !");
|
||||||
|
ChatService.SendMessage((Player)target, $"Dein Partner ist {player.Name} !");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MuellmannData newData = new MuellmannData(vehicle);
|
||||||
|
muellmanData.Add(newData);
|
||||||
|
CheckDataForDuplicatePlayer(player, newData);
|
||||||
|
newData.setClientToData(player);
|
||||||
|
|
||||||
|
MuellmannJobStarten(player, vehicle);
|
||||||
|
|
||||||
|
target = newData.getPartnerClient(player);
|
||||||
|
if (target == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ChatService.SendMessage((Player)player, $"Dein Partner ist {target.Name} !");
|
||||||
|
ChatService.SendMessage((Player)target, $"Dein Partner ist {player.Name} !");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CheckDataForDuplicatePlayer(Player player, MuellmannData data)
|
||||||
|
{
|
||||||
|
foreach (var d in muellmanData)
|
||||||
|
{
|
||||||
|
if (d == data) continue;
|
||||||
|
|
||||||
|
MuellmannData temp = d.getDataFromClient(player);
|
||||||
|
if (temp == null) continue;
|
||||||
|
|
||||||
|
temp.removeClientFromData(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Data
|
||||||
|
public class MuellmannData
|
||||||
|
{
|
||||||
|
Player client1;
|
||||||
|
Player client2;
|
||||||
|
public Vehicle vehicle;
|
||||||
|
int trashCount = 0;
|
||||||
|
|
||||||
|
public MuellmannData(Vehicle vehicle)
|
||||||
|
{
|
||||||
|
this.vehicle = vehicle;
|
||||||
|
}
|
||||||
|
public void setClientToData(Player player)
|
||||||
|
{
|
||||||
|
if (client1 == player || client2 == player)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Spieler schon gespeichert");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (client1 == null) { client1 = player; return; }
|
||||||
|
else if (client2 == null) { client2 = player; return; }
|
||||||
|
else if (client1 != null && client2 != null) { Console.WriteLine("kein Platz"); }
|
||||||
|
}
|
||||||
|
public void removeClientFromData(Player player)
|
||||||
|
{
|
||||||
|
if (client1 == player) { client1 = null; }
|
||||||
|
if (client2 == player) { client2 = null; }
|
||||||
|
}
|
||||||
|
public int getTrashCount()
|
||||||
|
{
|
||||||
|
return this.trashCount;
|
||||||
|
}
|
||||||
|
public void setTrashCount(int i)
|
||||||
|
{
|
||||||
|
this.trashCount = i;
|
||||||
|
}
|
||||||
|
public List<Player> getClientsFromData()
|
||||||
|
{
|
||||||
|
List<Player> tempList = new List<Player>();
|
||||||
|
if (client1 != null) { tempList.Add(client1); }
|
||||||
|
if (client2 != null) { tempList.Add(client2); }
|
||||||
|
return tempList;
|
||||||
|
}
|
||||||
|
public MuellmannData getDataFromClient(Player player)
|
||||||
|
{
|
||||||
|
if (client1 != player && client2 != player)
|
||||||
|
return null;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public bool hasFreePlace()
|
||||||
|
{
|
||||||
|
if (client1 != null && client2 != null)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public Player getPartnerClient(Player player)
|
||||||
|
{
|
||||||
|
if (client1 != player && client2 != player)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (client1 == player) { return client2; }
|
||||||
|
if (client2 == player) { return client1; }
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,17 +92,22 @@ namespace ReallifeGamemode.Server.Job
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public static void StartTaxiTimer()
|
public static void StartTaxiTimer()
|
||||||
{
|
{
|
||||||
Timer timer = new Timer(1000);
|
Timer timer = new Timer(500);
|
||||||
timer.Start();
|
timer.Start();
|
||||||
timer.Elapsed += UpdateFare;
|
timer.Elapsed += UpdateFare;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
private static void UpdateFare(object sender, ElapsedEventArgs e)
|
public static void UpdateFare()
|
||||||
{
|
{
|
||||||
foreach (var player in GetPlayerInJob())
|
foreach (var player in GetPlayerInJob())
|
||||||
{
|
{
|
||||||
|
User u = player.GetUser();
|
||||||
|
if (u.JobId != 1) return;
|
||||||
|
Console.WriteLine(player.Name);
|
||||||
if (!player.HasData("hasPassager")) { player.SetData<bool>("hasPassager", false); continue; }
|
if (!player.HasData("hasPassager")) { player.SetData<bool>("hasPassager", false); continue; }
|
||||||
int playerId = player.GetUser().Id;
|
int playerId = player.GetUser().Id;
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
|
|||||||
using ReallifeGamemode.Database.Entities;
|
using ReallifeGamemode.Database.Entities;
|
||||||
using ReallifeGamemode.Services;
|
using ReallifeGamemode.Services;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @overview Life of German Reallife - Main Class (Main.cs)
|
* @overview Life of German Reallife - Main Class (Main.cs)
|
||||||
* @author VegaZ, hydrant
|
* @author VegaZ, hydrant
|
||||||
@@ -64,7 +65,7 @@ namespace ReallifeGamemode.Server
|
|||||||
|
|
||||||
NAPI.Server.SetGlobalServerChat(false);
|
NAPI.Server.SetGlobalServerChat(false);
|
||||||
|
|
||||||
//NAPI.Server.SetCommandErrorMessage("~r~[FEHLER]~s~ Dieser Command existiert nicht.");
|
NAPI.Server.SetCommandErrorMessage("~r~[FEHLER]~s~ Dieser Command existiert nicht.");
|
||||||
NAPI.Server.SetDefaultSpawnLocation(DEFAULT_SPAWN_POSITION, DEFAULT_SPAWN_HEADING);
|
NAPI.Server.SetDefaultSpawnLocation(DEFAULT_SPAWN_POSITION, DEFAULT_SPAWN_HEADING);
|
||||||
NAPI.Server.SetAutoSpawnOnConnect(false);
|
NAPI.Server.SetAutoSpawnOnConnect(false);
|
||||||
NAPI.Server.SetAutoRespawnAfterDeath(false);
|
NAPI.Server.SetAutoRespawnAfterDeath(false);
|
||||||
@@ -84,7 +85,7 @@ namespace ReallifeGamemode.Server
|
|||||||
TuningManager.LoadTuningGarages();
|
TuningManager.LoadTuningGarages();
|
||||||
|
|
||||||
TimeManager.StartTimeManager();
|
TimeManager.StartTimeManager();
|
||||||
VehicleManager.StartTimer();
|
VehicleManager.CheckEnabledMods();
|
||||||
|
|
||||||
DatabaseHelper.InitDatabaseFirstTime();
|
DatabaseHelper.InitDatabaseFirstTime();
|
||||||
|
|
||||||
@@ -95,7 +96,7 @@ namespace ReallifeGamemode.Server
|
|||||||
ATMManager.InitATMs();
|
ATMManager.InitATMs();
|
||||||
CityHallManager.LoadCityHall();
|
CityHallManager.LoadCityHall();
|
||||||
JobManager.LoadJobs();
|
JobManager.LoadJobs();
|
||||||
TaxiDriverJob.StartTaxiTimer();
|
//TaxiDriverJob.StartTaxiTimer(); Obselete
|
||||||
//HouseManager.LoadHouses();
|
//HouseManager.LoadHouses();
|
||||||
DrivingSchool.DrivingSchool.Setup();
|
DrivingSchool.DrivingSchool.Setup();
|
||||||
PlaneSchool.Setup();
|
PlaneSchool.Setup();
|
||||||
@@ -113,10 +114,12 @@ namespace ReallifeGamemode.Server
|
|||||||
|
|
||||||
NAPI.Data.SetWorldData("blipTemplate", tempBlip);
|
NAPI.Data.SetWorldData("blipTemplate", tempBlip);
|
||||||
|
|
||||||
WantedEscapeTimer.WantedTimer();
|
//WantedEscapeTimer.WantedTimer(); Obselete
|
||||||
Jail.JailTimer();
|
//Jail.JailTimer(); Obselete
|
||||||
Economy.PaydayTimer();
|
//Economy.PaydayTimer(); Obselete
|
||||||
WeaponDealManager.WeaponDealTimer();
|
// WeaponDealManager.WeaponDealTimer(); Obselete
|
||||||
|
|
||||||
|
ThreadTimers.StartAllTimers();
|
||||||
|
|
||||||
UserBankAccount.BalanceChanged += (account) =>
|
UserBankAccount.BalanceChanged += (account) =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
{
|
{
|
||||||
ServerVehicle sVeh = veh.GetServerVehicle();
|
ServerVehicle sVeh = veh.GetServerVehicle();
|
||||||
if (sVeh == null) return;
|
if (sVeh == null) return;
|
||||||
if (sVeh is JobVehicle jV && jV.JobId == 1) // Spieler steigt in Taxi aus
|
if (sVeh is JobVehicle jV && jV.JobId == 1) // Spieler steigt vom Taxi aus
|
||||||
{
|
{
|
||||||
var taxiJob = JobManager.GetJob<TaxiDriverJob>();
|
var taxiJob = JobManager.GetJob<TaxiDriverJob>();
|
||||||
if (veh.Occupants.Count == 0) return;
|
if (veh.Occupants.Count == 0) return;
|
||||||
|
|||||||
@@ -722,12 +722,8 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
private static readonly Dictionary<NetHandle, Vector3> lastPositions = new Dictionary<NetHandle, Vector3>();
|
private static readonly Dictionary<NetHandle, Vector3> lastPositions = new Dictionary<NetHandle, Vector3>();
|
||||||
private static DateTime lastSave = DateTime.UtcNow;
|
private static DateTime lastSave = DateTime.UtcNow;
|
||||||
|
|
||||||
public static void StartTimer()
|
public static void CheckEnabledMods()
|
||||||
{
|
{
|
||||||
Timer timer = new Timer(500);
|
|
||||||
timer.Elapsed += VehicleTimerTick;
|
|
||||||
timer.Start();
|
|
||||||
|
|
||||||
foreach (var name in _enabledMods)
|
foreach (var name in _enabledMods)
|
||||||
{
|
{
|
||||||
if (_enabledMods.Where(x => x == name).Count() != 1)
|
if (_enabledMods.Where(x => x == name).Count() != 1)
|
||||||
@@ -737,7 +733,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void VehicleTimerTick(object sender, ElapsedEventArgs e)
|
public static void VehicleTimerTick()
|
||||||
{
|
{
|
||||||
NAPI.Pools.GetAllVehicles().ForEach(v =>
|
NAPI.Pools.GetAllVehicles().ForEach(v =>
|
||||||
{
|
{
|
||||||
|
|||||||
61
ReallifeGamemode.Server/Util/ThreadTimers.cs
Normal file
61
ReallifeGamemode.Server/Util/ThreadTimers.cs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Timers;
|
||||||
|
using ReallifeGamemode.Server.Wanted;
|
||||||
|
using ReallifeGamemode.Server.Finance;
|
||||||
|
using ReallifeGamemode.Server.WeaponDeal;
|
||||||
|
using ReallifeGamemode.Server.Job;
|
||||||
|
using ReallifeGamemode.Server.Managers;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Util
|
||||||
|
{
|
||||||
|
public class ThreadTimers
|
||||||
|
{
|
||||||
|
|
||||||
|
private static Timer timer500 = new Timer(500); //0.5 seconds timer
|
||||||
|
private static Timer timer2500 = new Timer(2500); //2.5 seconds timer
|
||||||
|
private static Timer timer10000 = new Timer(10000); // 10 second timer
|
||||||
|
private static Timer timer60000 = new Timer(60000); //60 seconds timer
|
||||||
|
|
||||||
|
public static void StartAllTimers()
|
||||||
|
{
|
||||||
|
timer500.Start();
|
||||||
|
timer500.Elapsed += Timer500_Elapsed;
|
||||||
|
|
||||||
|
timer2500.Start();
|
||||||
|
timer2500.Elapsed += Timer2500_Elapsed;
|
||||||
|
|
||||||
|
timer10000.Start();
|
||||||
|
timer10000.Elapsed += Timer10000_Elapsed;
|
||||||
|
|
||||||
|
timer60000.Start();
|
||||||
|
timer60000.Elapsed += Timer60000_Elapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Timer500_Elapsed(object sender, ElapsedEventArgs e)
|
||||||
|
{
|
||||||
|
TaxiDriverJob.UpdateFare();
|
||||||
|
VehicleManager.VehicleTimerTick();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Timer60000_Elapsed(object sender, ElapsedEventArgs e)
|
||||||
|
{
|
||||||
|
Jail.JailOut_Elapsed();
|
||||||
|
Economy.Timer_Elapsed();
|
||||||
|
WeaponDealManager.Timer_Elapsed();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Timer10000_Elapsed(object sender, ElapsedEventArgs e)
|
||||||
|
{
|
||||||
|
Jail.BrakeOut_Elapsed();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Timer2500_Elapsed(object sender, ElapsedEventArgs e)
|
||||||
|
{
|
||||||
|
WantedEscapeTimer.Timer_Elapsed();
|
||||||
|
Jail.JailIn_Elapsed();
|
||||||
|
Gangwar.Gangwar.Value_TimerElapsed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -124,7 +124,7 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
public static void JailTimer()
|
public static void JailTimer()
|
||||||
{
|
{
|
||||||
System.Timers.Timer timer = new System.Timers.Timer(60000);
|
System.Timers.Timer timer = new System.Timers.Timer(60000);
|
||||||
@@ -133,12 +133,12 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
timer.Start();
|
timer.Start();
|
||||||
brakeOut.Start();
|
brakeOut.Start();
|
||||||
jailIn.Start();
|
jailIn.Start();
|
||||||
timer.Elapsed += Timer_Elapsed;
|
//timer.Elapsed += Timer_Elapsed;
|
||||||
brakeOut.Elapsed += BrakeOut_Elapsed;
|
//brakeOut.Elapsed += BrakeOut_Elapsed;
|
||||||
jailIn.Elapsed += JailIn_Elapsed;
|
//jailIn.Elapsed += JailIn_Elapsed;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
private static void JailIn_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
public static void JailIn_Elapsed()
|
||||||
{
|
{
|
||||||
foreach (var player in NAPI.Pools.GetAllPlayers())
|
foreach (var player in NAPI.Pools.GetAllPlayers())
|
||||||
{
|
{
|
||||||
@@ -166,7 +166,7 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void BrakeOut_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
public static void BrakeOut_Elapsed()
|
||||||
{
|
{
|
||||||
foreach (var player in NAPI.Pools.GetAllPlayers())
|
foreach (var player in NAPI.Pools.GetAllPlayers())
|
||||||
{
|
{
|
||||||
@@ -188,7 +188,7 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
public static void JailOut_Elapsed()
|
||||||
{
|
{
|
||||||
foreach (var player in NAPI.Pools.GetAllPlayers())
|
foreach (var player in NAPI.Pools.GetAllPlayers())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,14 +20,14 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
public class WantedEscapeTimer
|
public class WantedEscapeTimer
|
||||||
{
|
{
|
||||||
public static Dictionary<int, int> waTimer { get; set; } = new Dictionary<int, int>(); //zeit in ms
|
public static Dictionary<int, int> waTimer { get; set; } = new Dictionary<int, int>(); //zeit in ms
|
||||||
|
/*
|
||||||
public static void WantedTimer()
|
public static void WantedTimer()
|
||||||
{
|
{
|
||||||
System.Timers.Timer timer = new System.Timers.Timer(2500);
|
//System.Timers.Timer timer = new System.Timers.Timer(2500);
|
||||||
timer.Start();
|
//timer.Start();
|
||||||
timer.Elapsed += Timer_Elapsed;
|
//timer.Elapsed += Timer_Elapsed;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
public static void ResetWantedTimeToElapse(Player client)
|
public static void ResetWantedTimeToElapse(Player client)
|
||||||
{
|
{
|
||||||
User user = client.GetUser();
|
User user = client.GetUser();
|
||||||
@@ -37,7 +37,7 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
waTimer[user.Id] = 300000;
|
waTimer[user.Id] = 300000;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
public static void Timer_Elapsed()
|
||||||
{
|
{
|
||||||
foreach (var player in NAPI.Pools.GetAllPlayers())
|
foreach (var player in NAPI.Pools.GetAllPlayers())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace ReallifeGamemode.Server.WeaponDeal
|
|||||||
var user = client.GetUser();
|
var user = client.GetUser();
|
||||||
using (var context = new DatabaseContext())
|
using (var context = new DatabaseContext())
|
||||||
{
|
{
|
||||||
FactionVehicle factionVehicle = context.FactionVehicles.Where(f => f.GetOwners().Contains(user.FactionId ?? 0) && f.Model == VehicleHash.Burrito3).FirstOrDefault();
|
FactionVehicle factionVehicle = context.FactionVehicles.ToList().Where(f => f.GetOwners().Contains(user.FactionId ?? 0) && f.Model == VehicleHash.Burrito3).FirstOrDefault();
|
||||||
Vehicle fVeh = VehicleManager.GetVehicleFromServerVehicle(factionVehicle);
|
Vehicle fVeh = VehicleManager.GetVehicleFromServerVehicle(factionVehicle);
|
||||||
|
|
||||||
if (fVeh.Position.DistanceTo(client.Position) > 50)
|
if (fVeh.Position.DistanceTo(client.Position) > 50)
|
||||||
@@ -53,14 +53,15 @@ namespace ReallifeGamemode.Server.WeaponDeal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public static void WeaponDealTimer()
|
public static void WeaponDealTimer()
|
||||||
{
|
{
|
||||||
System.Timers.Timer timer = new System.Timers.Timer(60000);
|
System.Timers.Timer timer = new System.Timers.Timer(60000);
|
||||||
timer.Start();
|
timer.Start();
|
||||||
timer.Elapsed += Timer_Elapsed;
|
timer.Elapsed += Timer_Elapsed;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
public static void Timer_Elapsed()
|
||||||
{
|
{
|
||||||
using (var context = new DatabaseContext())
|
using (var context = new DatabaseContext())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user