Merge branch 'develop' of ssh://development.life-of-german.org:451/log-gtav/reallife-gamemode into develop

This commit is contained in:
2021-04-14 03:09:19 +02:00
13 changed files with 103 additions and 7 deletions

View File

@@ -0,0 +1,45 @@
export default function antiAfk(globalData: IGlobalData) {
let lastPosition: Vector3Mp = mp.players.local.position;
let afkCounter: number = 0;
let afkStatus: boolean = false;
setInterval(checkAfkPosition, 1000 * 10);
function checkAfkPosition() {
if (!globalData.LoggedIn) {
return;
}
let lp = lastPosition;
let np = mp.players.local.position;
let distance = mp.game.gameplay.getDistanceBetweenCoords(lp.x, lp.y, lp.z, np.x, np.y, np.z, false);
if (distance <= 5) {
if (!afkStatus) {
afkCounter++;
}
} else {
afkCounter = 0;
if (afkStatus) {
afkStatus = false;
globalData.IsAfk = afkStatus;
setServerAfkStatus(afkStatus);
}
}
if (afkCounter >= 30) {
afkStatus = true;
globalData.IsAfk = afkStatus;
setServerAfkStatus(afkStatus);
}
lastPosition = np;
}
function setServerAfkStatus(status: boolean) {
mp.events.callRemote("CLIENT:SetAfkStatus", status);
}
}

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5e4f54ec27530515452c0ef05241bd26ba70d13451ac24eb799ff3c6b18f42ec
size 98724352

View File

@@ -4,6 +4,7 @@
InMenu: boolean,
InChat: boolean,
LoggedIn: boolean,
IsAfk: boolean,
}
declare type AccountData = {

View File

@@ -14,6 +14,7 @@ let globalData: IGlobalData = {
HideGui: false,
InChat: false,
LoggedIn: false,
IsAfk: false,
get InMenu(): boolean {
return inMenu;
@@ -258,6 +259,9 @@ animationSync();
import antiCheat from './admin/anticheat';
antiCheat(globalData);
import antiAfk from './Player/antiafk';
antiAfk(globalData);
require('./Gui/policedepartment');
require('./Gui/helptext');