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,
|
InMenu: boolean,
|
||||||
InChat: boolean,
|
InChat: boolean,
|
||||||
LoggedIn: boolean,
|
LoggedIn: boolean,
|
||||||
|
IsAfk: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
declare type AccountData = {
|
declare type AccountData = {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ let globalData: IGlobalData = {
|
|||||||
HideGui: false,
|
HideGui: false,
|
||||||
InChat: false,
|
InChat: false,
|
||||||
LoggedIn: false,
|
LoggedIn: false,
|
||||||
|
IsAfk: false,
|
||||||
|
|
||||||
get InMenu(): boolean {
|
get InMenu(): boolean {
|
||||||
return inMenu;
|
return inMenu;
|
||||||
@@ -258,6 +259,9 @@ animationSync();
|
|||||||
import antiCheat from './admin/anticheat';
|
import antiCheat from './admin/anticheat';
|
||||||
antiCheat(globalData);
|
antiCheat(globalData);
|
||||||
|
|
||||||
|
import antiAfk from './Player/antiafk';
|
||||||
|
antiAfk(globalData);
|
||||||
|
|
||||||
require('./Gui/policedepartment');
|
require('./Gui/policedepartment');
|
||||||
require('./Gui/helptext');
|
require('./Gui/helptext');
|
||||||
|
|
||||||
|
|||||||
@@ -234,18 +234,19 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
[Command("setweaponrank", "~m~Benutzung: ~s~/setweaponrank [Waffen Name] [Rank]")]
|
[Command("setweaponrank", "~m~Benutzung: ~s~/setweaponrank [Waffen Name] [Rank]")]
|
||||||
public void CmdFactionWeaponRank(Player player, string weaponModel, int rank)
|
public void CmdFactionWeaponRank(Player player, string weaponModel, int rank)
|
||||||
{
|
{
|
||||||
if (player.GetUser()?.FactionId == null || player.GetUser().FactionLeader == false)
|
User user = player.GetUser();
|
||||||
|
if (user == null || user.FactionId == null || user.FactionLeader == false)
|
||||||
{
|
{
|
||||||
ChatService.NotAuthorized(player);
|
ChatService.NotAuthorized(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rank > 12 || rank < 1)
|
if (rank > 12 || rank < 1)
|
||||||
{
|
{
|
||||||
ChatService.ErrorMessage(player, "Gebe einen gültigen Rang ein");
|
ChatService.ErrorMessage(player, "Gebe einen gültigen Rang ein");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
User user = player.GetUser();
|
|
||||||
WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.5 && w.FactionId == user.FactionId);
|
WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.5 && w.FactionId == user.FactionId);
|
||||||
if (nearestWeapon == null)
|
if (nearestWeapon == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,5 +13,15 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
{
|
{
|
||||||
player.SafeTeleport(pos);
|
player.SafeTeleport(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[RemoteEvent("CLIENT:SetAfkStatus")]
|
||||||
|
public void SetPlayerAfkStatus(Player player, bool status)
|
||||||
|
{
|
||||||
|
player.SetServerData("isAfk", status);
|
||||||
|
if(status)
|
||||||
|
{
|
||||||
|
player.SendNotification("Du wurdest ~b~AFK~s~ gesetzt", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ namespace ReallifeGamemode.Server.Extensions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int time = 26 * user.Wanteds;
|
int time = 18 * user.Wanteds;
|
||||||
if (killed)
|
if (killed)
|
||||||
{
|
{
|
||||||
time *= 2;
|
time *= 2;
|
||||||
@@ -136,6 +136,11 @@ namespace ReallifeGamemode.Server.Extensions
|
|||||||
return player.GetServerData("duty", false);
|
return player.GetServerData("duty", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsAfk(this Player player)
|
||||||
|
{
|
||||||
|
return player.GetServerData("isAfk", false);
|
||||||
|
}
|
||||||
|
|
||||||
public static bool IsAlive(this Player player)
|
public static bool IsAlive(this Player player)
|
||||||
{
|
{
|
||||||
return !player.HasData("isDead") || player.GetData<bool>("isDead") == false;
|
return !player.HasData("isDead") || player.GetData<bool>("isDead") == false;
|
||||||
|
|||||||
@@ -189,6 +189,11 @@ namespace ReallifeGamemode.Server.Finance
|
|||||||
using var dbContext = new DatabaseContext();
|
using var dbContext = new DatabaseContext();
|
||||||
foreach (var player in NAPI.Pools.GetAllPlayers().Where(p => p.IsLoggedIn()))
|
foreach (var player in NAPI.Pools.GetAllPlayers().Where(p => p.IsLoggedIn()))
|
||||||
{
|
{
|
||||||
|
if(player.IsAfk())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
User user = player.GetUser(dbContext);
|
User user = player.GetUser(dbContext);
|
||||||
if(user == null)
|
if(user == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ namespace ReallifeGamemode.Server.Gangwar
|
|||||||
Player[] attackers = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && c.GetUser().Faction?.Name == this.Attacker).ToArray();
|
Player[] attackers = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && c.GetUser().Faction?.Name == this.Attacker).ToArray();
|
||||||
|
|
||||||
Faction ownerFaction = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Name == getOwner()).FirstOrDefault();
|
Faction ownerFaction = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Name == getOwner()).FirstOrDefault();
|
||||||
Faction attackerFaction = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Name == getOwner()).FirstOrDefault();
|
Faction attackerFaction = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Name == getAttacker()).FirstOrDefault();
|
||||||
|
|
||||||
if (ownerFaction == null || attackerFaction == null)
|
if (ownerFaction == null || attackerFaction == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -564,6 +564,11 @@ namespace ReallifeGamemode.Server.Job
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!playerVehiclePair.ContainsKey(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (JobManager.playerTimersJobVehicleRespawn.ContainsKey(player))
|
if (JobManager.playerTimersJobVehicleRespawn.ContainsKey(player))
|
||||||
{
|
{
|
||||||
JobManager.playerTimersJobVehicleRespawn[player].Stop();
|
JobManager.playerTimersJobVehicleRespawn[player].Stop();
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
|
|
||||||
FactionHelper.ResetPlayer(player, own, dbContext);
|
FactionHelper.ResetPlayer(player, own, dbContext);
|
||||||
|
|
||||||
own.Faction = u.Faction;
|
own.FactionId = u.FactionId;
|
||||||
own.FactionLeader = false;
|
own.FactionLeader = false;
|
||||||
own.FactionRank = dbContext
|
own.FactionRank = dbContext
|
||||||
.FactionRanks
|
.FactionRanks
|
||||||
|
|||||||
@@ -754,6 +754,19 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
"winky",
|
"winky",
|
||||||
"polamggtr", //mod
|
"polamggtr", //mod
|
||||||
"newsfrog", //mod
|
"newsfrog", //mod
|
||||||
|
"fibn",//mod
|
||||||
|
"fibg",//mod
|
||||||
|
"fibd",//mod
|
||||||
|
"fibs",//mod
|
||||||
|
"fibc",//mod
|
||||||
|
"fibn2",//mod
|
||||||
|
"fibx",//mod
|
||||||
|
"fibg2",//mod
|
||||||
|
"fibd2",//mod
|
||||||
|
"fibj",//mod
|
||||||
|
"fibn3",//mod
|
||||||
|
"fibr"//mod
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly Dictionary<int, NetHandle> _serverVehicles = new Dictionary<int, NetHandle>();
|
private static readonly Dictionary<int, NetHandle> _serverVehicles = new Dictionary<int, NetHandle>();
|
||||||
|
|||||||
@@ -30,6 +30,11 @@ namespace ReallifeGamemode.Server.WeaponDeal
|
|||||||
public void SrvEVENT_startWeaponDeal(Player client)
|
public void SrvEVENT_startWeaponDeal(Player client)
|
||||||
{
|
{
|
||||||
var user = client.GetUser();
|
var user = client.GetUser();
|
||||||
|
if(user == null || user.FactionId == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
using (var context = new DatabaseContext(true))
|
using (var context = new DatabaseContext(true))
|
||||||
{
|
{
|
||||||
FactionVehicle factionVehicle = context.FactionVehicles.Where(f => f.Model == VehicleHash.Burrito3 || f.Model == VehicleHash.Policet).ToList().Where(f => f.GetOwners().Contains(user.FactionId ?? 0)).FirstOrDefault();
|
FactionVehicle factionVehicle = context.FactionVehicles.Where(f => f.Model == VehicleHash.Burrito3 || f.Model == VehicleHash.Policet).ToList().Where(f => f.GetOwners().Contains(user.FactionId ?? 0)).FirstOrDefault();
|
||||||
@@ -40,7 +45,6 @@ namespace ReallifeGamemode.Server.WeaponDeal
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Vehicle fVeh = VehicleManager.GetVehicleFromServerVehicle(factionVehicle);
|
Vehicle fVeh = VehicleManager.GetVehicleFromServerVehicle(factionVehicle);
|
||||||
|
|
||||||
if (checkWeaponDbyVehicle(fVeh))
|
if (checkWeaponDbyVehicle(fVeh))
|
||||||
@@ -58,7 +62,7 @@ namespace ReallifeGamemode.Server.WeaponDeal
|
|||||||
|
|
||||||
WeaponDealPoints.factionWeaponDeal[user.FactionId.Value] = -1;
|
WeaponDealPoints.factionWeaponDeal[user.FactionId.Value] = -1;
|
||||||
Vector3 vector;
|
Vector3 vector;
|
||||||
vector = WeaponDealPoints.getRndWD_Route(client.GetUser().FactionId.Value);
|
vector = WeaponDealPoints.getRndWD_Route(user.FactionId.Value);
|
||||||
if (vector == new Vector3())
|
if (vector == new Vector3())
|
||||||
return;
|
return;
|
||||||
fVeh.SetData<Vector3>("weaponDealPoint", vector);
|
fVeh.SetData<Vector3>("weaponDealPoint", vector);
|
||||||
|
|||||||
Reference in New Issue
Block a user