Merge branch 'develop' of ssh://development.life-of-german.org:451/log-gtav/reallife-gamemode into develop
This commit is contained in:
45
ReallifeGamemode.Client/Player/antiafk.ts
Normal file
45
ReallifeGamemode.Client/Player/antiafk.ts
Normal 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);
|
||||
}
|
||||
}
|
||||
3
ReallifeGamemode.Client/dlcpacks/fibpack/dlc.rpf
Normal file
3
ReallifeGamemode.Client/dlcpacks/fibpack/dlc.rpf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5e4f54ec27530515452c0ef05241bd26ba70d13451ac24eb799ff3c6b18f42ec
|
||||
size 98724352
|
||||
1
ReallifeGamemode.Client/global.d.ts
vendored
1
ReallifeGamemode.Client/global.d.ts
vendored
@@ -4,6 +4,7 @@
|
||||
InMenu: boolean,
|
||||
InChat: boolean,
|
||||
LoggedIn: boolean,
|
||||
IsAfk: boolean,
|
||||
}
|
||||
|
||||
declare type AccountData = {
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user