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');
|
||||
|
||||
|
||||
@@ -234,18 +234,19 @@ namespace ReallifeGamemode.Server.Commands
|
||||
[Command("setweaponrank", "~m~Benutzung: ~s~/setweaponrank [Waffen Name] [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);
|
||||
return;
|
||||
}
|
||||
|
||||
if (rank > 12 || rank < 1)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Gebe einen gültigen Rang ein");
|
||||
return;
|
||||
}
|
||||
|
||||
User user = player.GetUser();
|
||||
WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.5 && w.FactionId == user.FactionId);
|
||||
if (nearestWeapon == null)
|
||||
{
|
||||
|
||||
@@ -13,5 +13,15 @@ namespace ReallifeGamemode.Server.Events
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
int time = 26 * user.Wanteds;
|
||||
int time = 18 * user.Wanteds;
|
||||
if (killed)
|
||||
{
|
||||
time *= 2;
|
||||
@@ -136,6 +136,11 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
return player.GetServerData("duty", false);
|
||||
}
|
||||
|
||||
public static bool IsAfk(this Player player)
|
||||
{
|
||||
return player.GetServerData("isAfk", false);
|
||||
}
|
||||
|
||||
public static bool IsAlive(this Player player)
|
||||
{
|
||||
return !player.HasData("isDead") || player.GetData<bool>("isDead") == false;
|
||||
|
||||
@@ -189,6 +189,11 @@ namespace ReallifeGamemode.Server.Finance
|
||||
using var dbContext = new DatabaseContext();
|
||||
foreach (var player in NAPI.Pools.GetAllPlayers().Where(p => p.IsLoggedIn()))
|
||||
{
|
||||
if(player.IsAfk())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
User user = player.GetUser(dbContext);
|
||||
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();
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -564,6 +564,11 @@ namespace ReallifeGamemode.Server.Job
|
||||
return;
|
||||
}
|
||||
|
||||
if(!playerVehiclePair.ContainsKey(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (JobManager.playerTimersJobVehicleRespawn.ContainsKey(player))
|
||||
{
|
||||
JobManager.playerTimersJobVehicleRespawn[player].Stop();
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
|
||||
FactionHelper.ResetPlayer(player, own, dbContext);
|
||||
|
||||
own.Faction = u.Faction;
|
||||
own.FactionId = u.FactionId;
|
||||
own.FactionLeader = false;
|
||||
own.FactionRank = dbContext
|
||||
.FactionRanks
|
||||
|
||||
@@ -754,6 +754,19 @@ namespace ReallifeGamemode.Server.Managers
|
||||
"winky",
|
||||
"polamggtr", //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>();
|
||||
|
||||
@@ -30,6 +30,11 @@ namespace ReallifeGamemode.Server.WeaponDeal
|
||||
public void SrvEVENT_startWeaponDeal(Player client)
|
||||
{
|
||||
var user = client.GetUser();
|
||||
if(user == null || user.FactionId == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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();
|
||||
@@ -40,7 +45,6 @@ namespace ReallifeGamemode.Server.WeaponDeal
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Vehicle fVeh = VehicleManager.GetVehicleFromServerVehicle(factionVehicle);
|
||||
|
||||
if (checkWeaponDbyVehicle(fVeh))
|
||||
@@ -58,7 +62,7 @@ namespace ReallifeGamemode.Server.WeaponDeal
|
||||
|
||||
WeaponDealPoints.factionWeaponDeal[user.FactionId.Value] = -1;
|
||||
Vector3 vector;
|
||||
vector = WeaponDealPoints.getRndWD_Route(client.GetUser().FactionId.Value);
|
||||
vector = WeaponDealPoints.getRndWD_Route(user.FactionId.Value);
|
||||
if (vector == new Vector3())
|
||||
return;
|
||||
fVeh.SetData<Vector3>("weaponDealPoint", vector);
|
||||
|
||||
Reference in New Issue
Block a user