Merge branch 'develop' of ssh://development.life-of-german.org:451/log-gtav/reallife-gamemode into develop
This commit is contained in:
@@ -6,7 +6,7 @@ namespace ReallifeGamemode.Server.Business
|
||||
{
|
||||
public override int Id => 8;
|
||||
|
||||
public override string Name => "Motorrad Shop";
|
||||
public override string Name => "Bike Shop";
|
||||
|
||||
public override Vector3 Position => new Vector3(1180.997, -394.9542, 68.01635);
|
||||
|
||||
|
||||
25
ReallifeGamemode.Server/Business/ClassicAndLuxuryCarshop.cs
Normal file
25
ReallifeGamemode.Server/Business/ClassicAndLuxuryCarshop.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
|
||||
namespace ReallifeGamemode.Server.Business
|
||||
{
|
||||
class ClassicAndLuxuryCarshop : CarDealerBusinessBase
|
||||
{
|
||||
public override int Id => 13;
|
||||
|
||||
public override string Name => "Classic & Luxury Carshop";
|
||||
|
||||
public override Vector3 Position => new Vector3(-1274.3439, 315.1384, 65.51176);
|
||||
|
||||
public override Vector3 CarSpawnPositon => new Vector3(-1351.2072, 244.88942, 60.357693);
|
||||
|
||||
public override float CarSpawnHeading => 3.62f;
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
25
ReallifeGamemode.Server/Business/OldschoolCarshop.cs
Normal file
25
ReallifeGamemode.Server/Business/OldschoolCarshop.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
|
||||
namespace ReallifeGamemode.Server.Business
|
||||
{
|
||||
class OldschoolCarshop : CarDealerBusinessBase
|
||||
{
|
||||
public override int Id => 14;
|
||||
|
||||
public override string Name => "Oldschool Carshop";
|
||||
|
||||
public override Vector3 Position => new Vector3(-1888.1119, 2049.722, 140.9831);
|
||||
|
||||
public override Vector3 CarSpawnPositon => new Vector3(-1883.5817, 2029.6252, 140.55038);
|
||||
|
||||
public override float CarSpawnHeading => 163.73f;
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ namespace ReallifeGamemode.Server.Business
|
||||
{
|
||||
public override int Id => 3;
|
||||
|
||||
public override string Name => "Vapid Autohaus";
|
||||
public override string Name => "Vapid Carshop";
|
||||
|
||||
public override Vector3 Position => new Vector3(-177, -1156, 23);
|
||||
|
||||
|
||||
@@ -1402,6 +1402,13 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
target.TriggerEvent("onPlayerRevived");
|
||||
target.SendNotification("Du wurdest von Admin ~y~" + player.Name + "~s~ wiederbelebt.");
|
||||
|
||||
MedicTask task = Medic.ReviveTasks.FirstOrDefault(t => t.Victim == player.Name);
|
||||
if (task != null)
|
||||
{
|
||||
ChatService.BroadcastFaction("~y~[MEDIC] ~w~Der Auftrag von " + target.Name + " wurde entfernt (Administrativ wiederbelebt)", new List<int>() { 2 });
|
||||
}
|
||||
|
||||
target.SetData("isDead", false);
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
@@ -1686,6 +1693,32 @@ namespace ReallifeGamemode.Server.Commands
|
||||
NAPI.Vehicle.SetVehicleTyreSmokeColor(veh, new Color(r, g, b));
|
||||
}
|
||||
|
||||
[Command("spectate", "~m~Benutzung: ~s~/spectate [NAME/ID]", Alias = "spec")]
|
||||
public void CmdAdminSpectate(Player player, string targetname = null)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
Player target;
|
||||
if (targetname != null)
|
||||
{
|
||||
target = PlayerService.GetPlayerByNameOrId(targetname);
|
||||
if (target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
player.TriggerEvent("SERVER:ADMIN_SPECTATE", target);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.TriggerEvent("SERVER:ADMIN_STOP_SPECTATE");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion Admin
|
||||
|
||||
#region ALevel1337
|
||||
@@ -1976,7 +2009,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
foreach (var managedPlayer in peopleInRange)
|
||||
{
|
||||
if (!managedPlayer.IsLoggedIn() || managedPlayer.GetData<bool>("isDead")) return;
|
||||
if (!managedPlayer.IsLoggedIn() || managedPlayer.GetData<bool>("isDead")) continue;
|
||||
managedPlayer.SafeSetHealth(hp);
|
||||
ChatService.SendMessage(managedPlayer, "~b~Admin " + player.Name + " hat im Radius von " + radius + " die HP auf " + hp + " gesetzt.");
|
||||
}
|
||||
@@ -2059,6 +2092,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
[Command("showtuningmenu", "~m~Benutzung: ~s~/showtuningmenu", Alias = "stm")]
|
||||
public void CmdAdminShowtuningmenu(Player player)
|
||||
{
|
||||
|
||||
@@ -356,15 +356,15 @@ namespace ReallifeGamemode.Server.Commands
|
||||
public void CmdFactionMedicHealive(Player player, string receiver, int price = 10)
|
||||
{
|
||||
Player target = PlayerService.GetPlayerByNameOrId(receiver);
|
||||
if (player.GetUser()?.FactionId != 2)
|
||||
if(target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.Position.DistanceTo(target.Position) > 5)
|
||||
if (player.GetUser()?.FactionId != 2)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Der Patient ist zu weit entfernt");
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -391,6 +391,12 @@ namespace ReallifeGamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.Position.DistanceTo(target.Position) > 5)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Der Patient ist zu weit entfernt");
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.Health == 100)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Der Spieler ist bereits voll geheilt");
|
||||
@@ -408,6 +414,31 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
#region Staatsfraktionen (LSPD / FBI) Commands
|
||||
|
||||
[Command("m", "~m~Benutzung: ~s~/m [Message]", GreedyArg = true)]
|
||||
public void CmdFactionMegaphone(Player player, string message)
|
||||
{
|
||||
User user = player.GetUser();
|
||||
if (user == null || (user.FactionId != 1 && user.FactionId != 3))
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.IsDuty())
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Du bist nicht im Dienst");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.IsInVehicle)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Du bist nicht in einem Fahrzeug");
|
||||
return;
|
||||
}
|
||||
|
||||
ChatService.SendInRange(player.Position, 50, "!{#FFFF00}[" + player.GetUser().Faction.Name + " " + player.Name + ": !{#FFFF00}" + message + "]");
|
||||
}
|
||||
|
||||
[Command("cuff", "~m~Benutzung: ~s~/cuff")]
|
||||
public void CmdFactionCuff(Player player)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using GTANetworkAPI;
|
||||
using Newtonsoft.Json;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
@@ -16,6 +17,42 @@ namespace ReallifeGamemode.Server.Commands
|
||||
{
|
||||
internal class UserCommands : Script
|
||||
{
|
||||
[Command("look", "~m~look")]
|
||||
public void CmdUserLook(Player player)
|
||||
{
|
||||
if (!player.IsLoggedIn()) return;
|
||||
|
||||
Vehicle veh = NAPI.Pools.GetAllVehicles()
|
||||
.Where(v => v.Position.DistanceTo(player.Position) <= 5)
|
||||
.OrderBy(v => v.Position.DistanceTo(player.Position))
|
||||
.FirstOrDefault();
|
||||
|
||||
if (veh == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var lastDriverDic = new Dictionary<string, DateTime>();
|
||||
|
||||
if(VehicleManager.lastDriversInVehicle.ContainsKey(veh))
|
||||
{
|
||||
lastDriverDic = VehicleManager.lastDriversInVehicle[veh];
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendNotification("~r~Mit diesem Fahrzeug ist noch niemand gefahren");
|
||||
return;
|
||||
}
|
||||
|
||||
var list = lastDriverDic.Select(v => new
|
||||
{
|
||||
Name = v.Key,
|
||||
Time = v.Value
|
||||
}).OrderByDescending(v => v.Time).ToList();
|
||||
|
||||
player.TriggerEvent("lookLastDrivers", JsonConvert.SerializeObject(list));
|
||||
}
|
||||
|
||||
[Command("id", "~m~Benutzung: ~s~/id [Name]")]
|
||||
public void CmdUserId(Player player, String targetname)
|
||||
{
|
||||
@@ -61,7 +98,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
else
|
||||
{
|
||||
pVeh = NAPI.Pools.GetAllVehicles().Where(v => v.Position.DistanceTo(player.Position) <= 5).FirstOrDefault();
|
||||
pVeh = NAPI.Pools.GetAllVehicles().Where(v => v.Position.DistanceTo(player.Position) <= 5).OrderBy(v => v.Position.DistanceTo(player.Position)).FirstOrDefault();
|
||||
}
|
||||
|
||||
if (pVeh == null)
|
||||
|
||||
@@ -98,8 +98,18 @@ namespace ReallifeGamemode.Server.DrivingSchool
|
||||
|
||||
private static void EntityEnterBusinessColShape(ColShape colShape, Player client)
|
||||
{
|
||||
var user = client.GetUser();
|
||||
if (client.IsInVehicle || !client.IsLoggedIn()) return;
|
||||
|
||||
if (user.GetData<bool>("duty"))
|
||||
{
|
||||
client.SendNotification("~r~Im Dienst kannst du keinen Führerschein machen", false);
|
||||
return;
|
||||
}
|
||||
if (user.Wanteds > 0)
|
||||
{
|
||||
client.SendNotification("~r~Mit Wanteds kannst du keinen Führerschein machen", false);
|
||||
return;
|
||||
}
|
||||
client.TriggerEvent("drivingSchoolMenu");
|
||||
}
|
||||
|
||||
@@ -112,11 +122,13 @@ namespace ReallifeGamemode.Server.DrivingSchool
|
||||
public void StartDrivingSchool(Player client)
|
||||
{
|
||||
User user = client.GetUser();
|
||||
|
||||
if (user.DriverLicenseVehicle || client.HasData("ActiveSchool"))
|
||||
{
|
||||
client.SendChatMessage("~b~[INFO]~s~ Du besitzt schon einen Führerschein.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (user.Handmoney < 2500)
|
||||
{
|
||||
client.SendNotification("~r~[FEHLER]~s~ Du hast nicht genug Geld auf der Hand($2.500)!", true);
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
{
|
||||
string serverMsg = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
||||
if (serverMsg.Trim().Length == 0) return;
|
||||
NAPI.Player.GetPlayersInRadiusOfPlayer(10, player).ForEach(p =>
|
||||
NAPI.Player.GetPlayersInRadiusOfPlayer(25, player).ForEach(p =>
|
||||
{
|
||||
ChatService.SendMessage(p, $"{player.Name} sagt: {serverMsg}");
|
||||
});
|
||||
|
||||
@@ -25,9 +25,19 @@ namespace ReallifeGamemode.Server.Events
|
||||
{
|
||||
public class Death : Script
|
||||
{
|
||||
private readonly Dictionary<Player, DateTime> lastPlayerDeathTime = new Dictionary<Player, DateTime>();
|
||||
|
||||
|
||||
[ServerEvent(Event.PlayerDeath)]
|
||||
public void OnPlayerDeath(Player player, Player killer, uint reason)
|
||||
{
|
||||
if (lastPlayerDeathTime.TryGetValue(player, out DateTime lastDeathTime) && DateTime.Now - lastDeathTime < TimeSpan.FromSeconds(5))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lastPlayerDeathTime[player] = DateTime.Now;
|
||||
|
||||
if (!player.IsLoggedIn())
|
||||
{
|
||||
player.Kick();
|
||||
@@ -51,18 +61,28 @@ namespace ReallifeGamemode.Server.Events
|
||||
float killerPosZ = -1;
|
||||
float killerHeading = -1;
|
||||
|
||||
NAPI.Util.ConsoleOutput($"OnPlayerDeath - Player {player.Name} died - Killer = {(killer != null ? killer.Name : "no killer found")}");
|
||||
|
||||
if (killer.IsLoggedIn())
|
||||
{
|
||||
NAPI.Util.ConsoleOutput($"OnPlayerDeath - Player {player.Name} died - Killer is logged in");
|
||||
|
||||
var killerUser = killer.GetUser(dbContext);
|
||||
if (killerUser != null)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput($"OnPlayerDeath - Player {player.Name} died - Killer GetUser is not null");
|
||||
killerId = killerUser.Id;
|
||||
killerPosX = killer.Position.X;
|
||||
killerPosY = killer.Position.Y;
|
||||
killerPosZ = killer.Position.Z;
|
||||
killerHeading = killer.Heading;
|
||||
if (player.HasData("inGangWar") && killer.HasData("inGangWar"))
|
||||
|
||||
var playerInGangwar = player.HasData("inGangWar");
|
||||
var killerInGangwar = killer.HasData("inGangWar");
|
||||
NAPI.Util.ConsoleOutput($"OnPlayerDeath - Player {player.Name} died - PlayerInGangwar = {playerInGangwar}, KillerInGangwar = {killerInGangwar}");
|
||||
if (playerInGangwar && killerInGangwar)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput($"OnPlayerDeath - Player {player.Name} died - Both players in gangwar, setting kill");
|
||||
Gangwar.Gangwar.GangwarKill(killer, player);
|
||||
}
|
||||
|
||||
@@ -78,6 +98,22 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
}
|
||||
|
||||
var dead = new Database.Entities.Logs.Death
|
||||
{
|
||||
VictimId = player.GetUser().Id,
|
||||
KillerId = killerId,
|
||||
KillerPositionX = killerPosX,
|
||||
KillerPositionY = killerPosY,
|
||||
KillerPositionZ = killerPosZ,
|
||||
KillerHeading = killerHeading,
|
||||
VictimPositionX = player.Position.X,
|
||||
VictimPositionY = player.Position.Y,
|
||||
VictimPositionZ = player.Position.Z,
|
||||
VictimHeading = player.Heading,
|
||||
CauseOfDeath = reason.ToString()
|
||||
};
|
||||
dbContext.DeathLogs.Add(dead);
|
||||
|
||||
bool copNearby = NAPI.Pools.GetAllPlayers().Any(u => u.IsDuty() && u.IsAlive() && u.Position.DistanceToSquared(player.Position) <= 200 * 200);
|
||||
|
||||
if (user.Wanteds > 0)
|
||||
@@ -94,11 +130,13 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
}
|
||||
|
||||
Medic.delHealTask(player);
|
||||
|
||||
if (user.JailTime <= 0)
|
||||
{
|
||||
user.Dead = true;
|
||||
|
||||
if (!player.HasData("reviveSperre") && player.GetData<bool>("isDead") == false && !player.HasData("inGangWar") && player.GetData<bool>("SAdminduty") == false)
|
||||
if (!player.HasData("reviveSperre") && player.GetData<bool>("isDead") == false && !player.HasData("inGangWar") && player.GetData<bool>("SAdminduty") == false)
|
||||
{
|
||||
//MEDIC AUFTRAG
|
||||
MedicTask reviveTask = new MedicTask()
|
||||
@@ -113,11 +151,10 @@ namespace ReallifeGamemode.Server.Events
|
||||
MedicName = "none"
|
||||
};
|
||||
Medic.AddTaskToList(reviveTask);
|
||||
Medic.delHealTask(player);
|
||||
ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " ist soeben verstorben.", new List<int>() { 2 });
|
||||
}
|
||||
|
||||
player.SetData("isDead", true);
|
||||
player.SetData("isDead", true);
|
||||
|
||||
if (player.GetUser().IsAdmin(AdminLevel.ADMIN) == true)
|
||||
{
|
||||
@@ -152,24 +189,10 @@ namespace ReallifeGamemode.Server.Events
|
||||
TextLabel grndTxtLbl = NAPI.TextLabel.CreateTextLabel(iItem.Name + " ~s~(~y~" + amount + "~s~)", textPos, 5, 0.5f, 4, new Color(255, 255, 255), false, 0);
|
||||
GroundItem.AddGroundItem(grndItem, grndObject, grndTxtLbl);
|
||||
|
||||
player.ClearAnimation();
|
||||
|
||||
dbContext.Remove(item);
|
||||
}
|
||||
|
||||
var dead = new Database.Entities.Logs.Death
|
||||
{
|
||||
VictimId = player.GetUser().Id,
|
||||
KillerId = killerId,
|
||||
KillerPositionX = killerPosX,
|
||||
KillerPositionY = killerPosY,
|
||||
KillerPositionZ = killerPosZ,
|
||||
KillerHeading = killerHeading,
|
||||
VictimPositionX = player.Position.X,
|
||||
VictimPositionY = player.Position.Y,
|
||||
VictimPositionZ = player.Position.Z,
|
||||
VictimHeading = player.Heading,
|
||||
CauseOfDeath = reason.ToString()
|
||||
};
|
||||
dbContext.DeathLogs.Add(dead);
|
||||
}
|
||||
}
|
||||
Job.JobBase job = Managers.JobManager.GetJob(player.GetUser().JobId ?? -1);
|
||||
@@ -239,7 +262,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
player.RemoveAllWeapons();
|
||||
MedicTask task = Medic.ReviveTasks.FirstOrDefault(t => t.Victim == player.Name);
|
||||
|
||||
if(task != null)
|
||||
if (task != null)
|
||||
{
|
||||
Player medicPlayer = PlayerService.GetPlayerByNameOrId(task.MedicName);
|
||||
Medic.RemoveTaskFromList(task);
|
||||
|
||||
@@ -62,6 +62,19 @@ namespace ReallifeGamemode.Server.Events
|
||||
{
|
||||
ChatService.BroadcastAdmin("!{#FFFF00}*** " + player.Name + " hat den Server verlassen", AdminLevel.MAPPING);
|
||||
}
|
||||
|
||||
MedicTask task = Medic.ReviveTasks.FirstOrDefault(t => t.Victim == player.Name);
|
||||
|
||||
if (task != null)
|
||||
{
|
||||
ChatService.BroadcastFaction("~y~[MEDIC] ~w~Info: Der Auftrag von " + player.Name + " wurde entfernt (Ausgeloggt)", new List<int>() { 2 });
|
||||
}
|
||||
|
||||
if (player.IsAdminDuty())
|
||||
{
|
||||
ChatService.Broadcast("!{#ee4d2e}[SUPPORT] " + player.Name + " hat sich vom Support abgemeldet (Ausgeloggt)");
|
||||
}
|
||||
|
||||
/*
|
||||
TaxiDriverJob taxiJob = JobManager.GetJob<TaxiDriverJob>();
|
||||
TaxiContract taxiContract = taxiJob.TaxiContracts.Where(t => t.Name == player.Name).FirstOrDefault();
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
using ReallifeGamemode.Server.WeaponDeal;
|
||||
|
||||
@@ -20,6 +22,13 @@ namespace ReallifeGamemode.Server.Events
|
||||
if (vehicle.HasMarkerBehind())
|
||||
vehicle.RemoveMarkerBehind();
|
||||
|
||||
if (!VehicleManager.lastDriversInVehicle.ContainsKey(vehicle))
|
||||
{
|
||||
VehicleManager.lastDriversInVehicle.Add(vehicle, new Dictionary<string, DateTime>());
|
||||
}
|
||||
|
||||
VehicleManager.lastDriversInVehicle[vehicle][client.Name] = DateTime.Now;
|
||||
|
||||
if (vehicle.GetServerVehicle() is FactionVehicle veh)
|
||||
{
|
||||
User u = client.GetUser();
|
||||
|
||||
@@ -9,6 +9,7 @@ using ReallifeGamemode.Server.Types;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
using ReallifeGamemode.Server.WeaponDeal;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
using ReallifeGamemode.Server.Job;
|
||||
|
||||
namespace ReallifeGamemode.Server.Events
|
||||
{
|
||||
@@ -28,7 +29,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
|
||||
if (vehicle.GetServerVehicle() is FactionVehicle veh)
|
||||
{
|
||||
if (!veh.GetOwners().Contains(player.GetUser().FactionId ?? 0) && !(u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty()))
|
||||
if (!veh.GetOwners().Contains(player.GetUser().FactionId ?? 0) && !(u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty()) && !JobBase.GetPlayerInJob().Contains(player))
|
||||
{
|
||||
if ((VehicleHash)vehicle.Model == VehicleHash.Burrito3)
|
||||
{
|
||||
|
||||
@@ -168,6 +168,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
busskill = u.BusSkill,
|
||||
pilotskill = u.PilotSkill,
|
||||
wage = u.Wage,
|
||||
isActive = JobBase.GetPlayerInJob().Contains(player),
|
||||
};
|
||||
|
||||
var memberList = dbContext.Users.Where(f => f.FactionId == u.FactionId && u.FactionId != 0).OrderByDescending(f => f.FactionRank.Order).ThenBy(f => f.Name).Select(m => new
|
||||
@@ -230,11 +231,12 @@ namespace ReallifeGamemode.Server.Events
|
||||
WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.5 && w.FactionId == user.FactionId);
|
||||
JailReleasePoint nearestJailReleasePoint = PositionManager.JailReleasePoints.Find(j => j.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3) && user.GetData<bool>("duty"));
|
||||
ElevatorPoint nearestElevatorPoint = PositionManager.ElevatorPoints.Find(e => e.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 2 || user.FactionId == 3));
|
||||
ClotheshopPoint nearestClotheShopPoint = PositionManager.clotheshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5 && (!user.GetData<bool>("duty")));
|
||||
FriseurPoint nearestFriseurPoint = PositionManager.friseurPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5 && (!user.GetData<bool>("duty")));
|
||||
ClotheshopPoint nearestClotheShopPoint = PositionManager.clotheshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
|
||||
FriseurPoint nearestFriseurPoint = PositionManager.friseurPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
|
||||
ItemshopPoint nearestItemShopPoint = PositionManager.itemshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
|
||||
JobPoint nearestJobPoint = PositionManager.JobPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6);
|
||||
Player nearestCuffPlayer = PositionManager.cuffPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6 && user.GetData<bool>("duty"));
|
||||
AmmunationPoint nearestAmmunationPoint = PositionManager.AmmunationPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
|
||||
|
||||
if (user?.FactionId != null)
|
||||
{
|
||||
@@ -506,6 +508,16 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
if (nearestClotheShopPoint != null)
|
||||
{
|
||||
if (user.GetData<bool>("duty"))
|
||||
{
|
||||
player.SendNotification("~r~Im Dienst kannst du keine Kleidung kaufen", false);
|
||||
return;
|
||||
}
|
||||
if(JobBase.GetPlayerInJob().Contains(player))
|
||||
{
|
||||
player.SendNotification("~r~Im aktiven Job kannst du keine Kleidung kaufen", false);
|
||||
return;
|
||||
}
|
||||
nearestClotheShopPoint.clotheShop.LoadShopNUI(player);
|
||||
}
|
||||
if (nearestItemShopPoint != null)
|
||||
@@ -514,8 +526,29 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
if (nearestFriseurPoint != null)
|
||||
{
|
||||
if (user.GetData<bool>("duty"))
|
||||
{
|
||||
player.SendNotification("~r~Im Dienst wirst du nicht vom Friseur bedient", false);
|
||||
return;
|
||||
}
|
||||
if (JobBase.GetPlayerInJob().Contains(player))
|
||||
{
|
||||
player.SendNotification("~r~Im aktiven Job wirst du nicht vom Friseur bedient", false);
|
||||
return;
|
||||
}
|
||||
nearestFriseurPoint.friseurShop.LoadShopNUI(player);
|
||||
}
|
||||
if (nearestAmmunationPoint != null)
|
||||
{
|
||||
if (!user.WeaponLicense)
|
||||
{
|
||||
player.SendNotification("~r~Du besitzt keinen Waffenschein");
|
||||
}
|
||||
else
|
||||
{
|
||||
nearestAmmunationPoint.Ammunation.LoadShopNUI(player);
|
||||
}
|
||||
}
|
||||
if (user.FactionLeader)
|
||||
{
|
||||
player.TriggerEvent("CLIENT:StartGangwar");
|
||||
@@ -535,6 +568,16 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
if (!job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
if (user.GetData<bool>("duty"))
|
||||
{
|
||||
player.SendNotification("~r~Im Dienst kannst du keinen Job ausführen", false);
|
||||
return;
|
||||
}
|
||||
if (user.Wanteds > 0)
|
||||
{
|
||||
player.SendNotification("~r~Mit Wanteds kannst du keinen Job starten", false);
|
||||
return;
|
||||
}
|
||||
if (player.GetUser().JobId == 3)
|
||||
{
|
||||
if (nearestJobPoint.Skill > user.PilotSkill)
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
[RemoteEvent("CLIENT:SetAfkStatus")]
|
||||
public void SetPlayerAfkStatus(Player player, bool status)
|
||||
{
|
||||
player.SetServerData("isAfk", status);
|
||||
player.SetSharedData("isAfk", status);
|
||||
if(status)
|
||||
{
|
||||
player.SendNotification("Du wurdest ~b~AFK~s~ gesetzt", true);
|
||||
|
||||
@@ -118,5 +118,24 @@ namespace ReallifeGamemode.Server.Events
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
[RemoteEvent("CLIENT:Ammunation_BuyWeapon")]
|
||||
public void AmmunationBuyWeapoon(Player player, string weaponmodel, int ammo, int price)
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
User user = player.GetUser(dbContext);
|
||||
|
||||
if (user.Handmoney < price)
|
||||
{
|
||||
player.SendNotification("Du hast nicht genügend Geld bei dir");
|
||||
return;
|
||||
}
|
||||
user.Handmoney -= price;
|
||||
dbContext.SaveChanges();
|
||||
player.GiveWeapon(NAPI.Util.WeaponNameToModel(weaponmodel), ammo);
|
||||
//client.TriggerEvent("SERVER:SET_HANDMONEY", user.Handmoney);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,12 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
|
||||
public static bool IsAfk(this Player player)
|
||||
{
|
||||
return player.GetServerData("isAfk", false);
|
||||
if(!player.HasSharedData("isAfk"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return player.GetSharedData<bool>("isAfk");
|
||||
}
|
||||
|
||||
public static bool IsAlive(this Player player)
|
||||
@@ -438,6 +443,7 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
return;
|
||||
|
||||
player.SyncAnimation("hup");
|
||||
NAPI.Player.SetPlayerCurrentWeapon(player, WeaponHash.Unarmed);
|
||||
|
||||
if (player.GetUser().Wanteds > 0)
|
||||
PositionManager.cuffPoints.Add(player);
|
||||
|
||||
@@ -36,24 +36,23 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
return 210 * 1000;
|
||||
|
||||
case 4:
|
||||
if ((VehicleHash)vehicle.HashCode == VehicleHash.Moonbeam
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Moonbeam2
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Ratloader
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Ratloader2
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Slamvan
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Slamvan2
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Slamvan3
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Yosemite
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Yosemite2
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Picador
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Moonbeam)
|
||||
if ((VehicleHash)vehicle.Model == VehicleHash.Moonbeam
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Moonbeam2
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Ratloader
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Ratloader2
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Slamvan
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Slamvan2
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Slamvan3
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Yosemite
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Yosemite2
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Picador)
|
||||
return 250 * 1000;
|
||||
else
|
||||
return 180 * 1000;
|
||||
|
||||
case 5:
|
||||
if ((VehicleHash)vehicle.HashCode == VehicleHash.Fagaloa
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Cheburek)
|
||||
if ((VehicleHash)vehicle.Model == VehicleHash.Fagaloa
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Cheburek)
|
||||
return 200 * 1000;
|
||||
else
|
||||
return 110 * 1000;
|
||||
@@ -68,12 +67,12 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
return 5 * 1000;
|
||||
|
||||
case 9:
|
||||
if ((VehicleHash)vehicle.HashCode == VehicleHash.Bifta
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Blazer
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Blazer2
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Blazer3
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Blazer4
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Blazer5)
|
||||
if ((VehicleHash)vehicle.Model == VehicleHash.Bifta
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Blazer
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Blazer2
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Blazer3
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Blazer4
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Blazer5)
|
||||
return 30 * 1000;
|
||||
else
|
||||
return 300 * 1000;
|
||||
@@ -85,9 +84,9 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
return 0;
|
||||
|
||||
case 12:
|
||||
if ((VehicleHash)vehicle.HashCode == VehicleHash.Minivan
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Minivan2
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Bobcatxl)
|
||||
if ((VehicleHash)vehicle.Model == VehicleHash.Minivan
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Minivan2
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Bobcatxl)
|
||||
return 600 * 1000;
|
||||
else
|
||||
return 1000 * 1000;
|
||||
@@ -108,13 +107,13 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
return 0;
|
||||
|
||||
case 18:
|
||||
if ((VehicleHash)vehicle.HashCode == VehicleHash.Policet)
|
||||
if ((VehicleHash)vehicle.Model == VehicleHash.Policet)
|
||||
return 1000 * 1000;
|
||||
else if ((VehicleHash)vehicle.HashCode == VehicleHash.Firetruk
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Pbus
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Policeb
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Polmav
|
||||
|| (VehicleHash)vehicle.HashCode == VehicleHash.Predator)
|
||||
else if ((VehicleHash)vehicle.Model == VehicleHash.Firetruk
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Pbus
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Policeb
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Polmav
|
||||
|| (VehicleHash)vehicle.Model == VehicleHash.Predator)
|
||||
return 0;
|
||||
else
|
||||
return 150 * 1000;
|
||||
|
||||
@@ -263,7 +263,7 @@ namespace ReallifeGamemode.Server.Factions.Medic
|
||||
{
|
||||
player.SetData("healauftrag", false);
|
||||
var medicPlayer = PlayerService.GetPlayerByNameOrId(task.MedicName);
|
||||
if (task.MedicName != "none")
|
||||
if (medicPlayer != null)
|
||||
{
|
||||
medicPlayer.TriggerEvent("destroyMedicTaskCheckpoint");
|
||||
}
|
||||
|
||||
@@ -49,13 +49,22 @@ namespace ReallifeGamemode.Server.Gangwar
|
||||
|
||||
public static void GangwarKill(Player killer, Player victim)
|
||||
{
|
||||
if (killer.HasData("GotInsideOfTurf") && victim.HasData("GotInsideOfTurf"))
|
||||
var killerInsideTurf = killer.HasData("GotInsideOfTurf");
|
||||
var victimInsideTurf = victim.HasData("GotInsideOfTurf");
|
||||
|
||||
NAPI.Util.ConsoleOutput($"GangwarKill - Victim {victim.Name} - KillerInsideTurf = {killerInsideTurf}, VictimInsideTurf = {victimInsideTurf}");
|
||||
|
||||
if (killerInsideTurf && victimInsideTurf)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput($"GangwarKill - Victim {victim.Name} - Killer and Victim are in Turf area");
|
||||
foreach (var turf in getTurfs())
|
||||
{
|
||||
if (turf.getId() == victim.GetData<int>("inGangWar"))
|
||||
{
|
||||
turf.setKill(victim.GetUser().Faction.Name);
|
||||
NAPI.Util.ConsoleOutput($"GangwarKill - Victim {victim.Name} - Killed in turf id {turf.getId()}");
|
||||
var victimFactionName = victim.GetUser().Faction.Name;
|
||||
NAPI.Util.ConsoleOutput($"GangwarKill - Victim {victim.Name} - Faction Name = {victimFactionName}");
|
||||
turf.setKill(victimFactionName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,11 +203,16 @@ namespace ReallifeGamemode.Server.Gangwar
|
||||
public void enter(Player client)
|
||||
{
|
||||
User user = client.GetUser();
|
||||
if(user == null || user.FactionId == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.status == "attack")
|
||||
{
|
||||
if (user.Faction.Name != getOwner() && user.Faction.Name != getAttacker())
|
||||
return;
|
||||
Player gPlayer = playerInGangwar.Where(c => c != null && !c.Handle.IsNull && c.IsLoggedIn() && c.GetUser()?.Id == user.Id).FirstOrDefault();
|
||||
Player gPlayer = playerInGangwar.Where(c => c != null && !c.Handle.IsNull && c.IsLoggedIn() && c.Handle.Value == client.Handle.Value).FirstOrDefault();
|
||||
if (gPlayer == null)
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
@@ -366,10 +371,12 @@ namespace ReallifeGamemode.Server.Gangwar
|
||||
{
|
||||
if (getOwner() == FactionName)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput($"GangwarKill - Adding Point for Faction {getAttacker()}");
|
||||
Att_Score += 1;
|
||||
}
|
||||
else if (getAttacker() == FactionName)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput($"GangwarKill - Adding Point for Faction {getOwner()}");
|
||||
Def_Score += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ using ReallifeGamemode.Server.Managers;
|
||||
|
||||
namespace ReallifeGamemode.Server.Inventory.Items
|
||||
{
|
||||
internal class Döner : ConsumableItem
|
||||
internal class Kebab : ConsumableItem
|
||||
{
|
||||
public override int Id => 106;
|
||||
public override string Name => "Döner";
|
||||
@@ -33,9 +33,9 @@ namespace ReallifeGamemode.Server.Job
|
||||
public const uint VEHICLE_INTERMEDIATE = (uint)VehicleHash.Coach;
|
||||
public const uint VEHICLE_PROFESSIONAL = (uint)VehicleHash.Tourbus;
|
||||
|
||||
public const int WAGE_BEGINNER = 800;
|
||||
public const int WAGE_INTERMEDIATE = 1200;
|
||||
public const int WAGE_PROFESSIOAL = 1800;
|
||||
public const int WAGE_BEGINNER = 400;
|
||||
public const int WAGE_INTERMEDIATE = 600;
|
||||
public const int WAGE_PROFESSIOAL = 900;
|
||||
|
||||
public const string BEGINNER = "Anfänger";
|
||||
public const string INTERMEDIATE = "Fortgeschrittener";
|
||||
@@ -195,25 +195,16 @@ namespace ReallifeGamemode.Server.Job
|
||||
{ 0,
|
||||
new List<Vector3>()
|
||||
{
|
||||
//new Vector3(-601.733, -2049.285, 6.090),
|
||||
//new Vector3(-598.849365234375, -2053.087646484375, 5.8428778648376465),
|
||||
new Vector3(-229.679931640625, -2049.821533203125, 27.384798049926758),
|
||||
new Vector3(-72.33480834960938, -615.8173217773438, 35.91234588623047),
|
||||
new Vector3(-176.9166717529297, -153.85665893554688, 43.38493728637695),
|
||||
new Vector3(-508.5746765136719, -261.1121826171875, 35.247962951660156),
|
||||
new Vector3(-1396.5457763671875, 51.69581604003906, 53.21350860595703),
|
||||
new Vector3(-1911.845458984375, 205.62884521484375, 84.06185150146484),
|
||||
new Vector3(-1675.4029541015625, 488.7856140136719, 128.6395721435547),
|
||||
new Vector3(-995.8155517578125, 589.4381713867188, 102.18698120117188),
|
||||
new Vector3(-314.6571350097656, 451.9184875488281, 107.99801635742188),
|
||||
new Vector3(211.09194946289062, 350.1848449707031, 105.41163635253906),
|
||||
new Vector3(599.4515380859375, 626.0756225585938, 128.6754608154297),
|
||||
new Vector3(969.324462890625, 164.03329467773438, 80.59388732910156),
|
||||
new Vector3(1069.521240234375, -763.7572631835938, 57.43597412109375),
|
||||
new Vector3(1421.075927734375, -1854.2821044921875, 70.56175994873047),
|
||||
new Vector3(268.5604248046875, -2070.274169921875, 16.816179275512695),
|
||||
new Vector3(-147.51795959472656, -1974.3182373046875, 22.48438262939453),
|
||||
new Vector3(-569.0294189453125, -2210.80908203125, 5.571292877197266),
|
||||
new Vector3(-146.62071, -2178.8228, 10.194298),
|
||||
new Vector3(14.580393, -1578.6385, 29.212185),
|
||||
new Vector3(222.91612, -1098.8556, 29.227453),
|
||||
new Vector3(246.44946, -648.45496, 39.420746),
|
||||
new Vector3(102.181, -298.95276, 46.04399),
|
||||
new Vector3(-104.91002, -606.26013, 36.06103),
|
||||
new Vector3(-288.1007, -1204.5107, 24.403156),
|
||||
new Vector3(-166.23526, -1574.4166, 35.152023),
|
||||
new Vector3(-60.337997, -1976.121, 16.486664),
|
||||
new Vector3(-599.1891, -2049.2695, 6.14637),
|
||||
}
|
||||
},
|
||||
{ 1,
|
||||
@@ -238,16 +229,15 @@ namespace ReallifeGamemode.Server.Job
|
||||
new List<Vector3>()
|
||||
{
|
||||
//new Vector3(-601.733, -2049.285, 6.090),
|
||||
new Vector3(-146.62071, -2178.8228, 9.194298),
|
||||
new Vector3(14.580393, -1578.6385, 28.212185),
|
||||
new Vector3(222.91612, -1098.8556, 28.227453),
|
||||
new Vector3(246.44946, -648.45496, 38.420746),
|
||||
new Vector3(102.181, -298.95276, 45.04399),
|
||||
new Vector3(-104.91002, -606.26013, 35.06103),
|
||||
new Vector3(-288.1007, -1204.5107, 23.403156),
|
||||
new Vector3(-166.23526, -1574.4166, 34.152023),
|
||||
new Vector3(-60.337997, -1976.121, 15.486664),
|
||||
new Vector3(-599.1891, -2049.2695, 5.14637),
|
||||
new Vector3(-566.381, -2209.74, 5.88064),
|
||||
new Vector3(769.912, -1983.54, 29.2573),
|
||||
new Vector3(1021.58, -725.525, 57.6664),
|
||||
new Vector3(244.279, -860.634, 29.5133),
|
||||
new Vector3(-506.147, -282.95, 35.4909),
|
||||
new Vector3(-1205.3, -130.106, 40.9405),
|
||||
new Vector3(-1396.98, -773.447, 20.68),
|
||||
new Vector3(-666.861, -1241.26, 10.5494),
|
||||
new Vector3(-599.541, -2054.42, 6.0372),
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -443,6 +433,14 @@ namespace ReallifeGamemode.Server.Job
|
||||
player.SendChatMessage("~y~[JOB]: ~w~Die neue Route lädt. Bitte warten...");
|
||||
string type = getPlayerRouteType(player);
|
||||
|
||||
if (type == BEGINNER)
|
||||
BusJobEvents.payWage(player, WAGE_BEGINNER);
|
||||
else if (type == INTERMEDIATE)
|
||||
BusJobEvents.payWage(player, WAGE_INTERMEDIATE);
|
||||
else if (type == PROFESSIONAL)
|
||||
BusJobEvents.payWage(player, WAGE_PROFESSIOAL);
|
||||
|
||||
|
||||
NAPI.Task.Run(() =>
|
||||
{
|
||||
if (type == BEGINNER)
|
||||
@@ -466,6 +464,7 @@ namespace ReallifeGamemode.Server.Job
|
||||
NAPI.ClientEvent.TriggerClientEventForAll("SERVER:setIndicatorStatus", veh.Handle.Value, data.Left, data.Right);
|
||||
}
|
||||
|
||||
|
||||
public void BusCheckpoint(Player player)
|
||||
{
|
||||
if (!player.IsInVehicle || player.VehicleSeat != 0) return;
|
||||
@@ -564,7 +563,7 @@ namespace ReallifeGamemode.Server.Job
|
||||
return;
|
||||
}
|
||||
|
||||
if(!playerVehiclePair.ContainsKey(player))
|
||||
if (!playerVehiclePair.ContainsKey(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -624,7 +623,7 @@ namespace ReallifeGamemode.Server.Job
|
||||
payWage(player, BusDriverJob.WAGE_PROFESSIOAL / BusDriverJob.playerRouteCurrent[player.Name].Count);
|
||||
}
|
||||
|
||||
private void payWage(Player player, int wage)
|
||||
public static void payWage(Player player, int wage)
|
||||
{
|
||||
using var dbContext = new DatabaseContext();
|
||||
User user = player.GetUser(dbContext);
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace ReallifeGamemode.Server.Job
|
||||
public void removeClientFromData(Player player)
|
||||
{
|
||||
if (client1 == player) { client1 = null; }
|
||||
if (client2 == player) { client2 = null;}
|
||||
if (client2 == player) { client2 = null; }
|
||||
}
|
||||
|
||||
public int getTrashCount()
|
||||
|
||||
@@ -122,6 +122,7 @@ namespace ReallifeGamemode.Server
|
||||
ShopManager.LoadClotheShops();
|
||||
ShopManager.LoadItemShops();
|
||||
ShopManager.LoadFriseur();
|
||||
ShopManager.LoadAmmunations();
|
||||
TuningManager.LoadTuningGarages();
|
||||
|
||||
TimeManager.StartTimeManager();
|
||||
|
||||
@@ -181,6 +181,11 @@ namespace ReallifeGamemode.Server.Managers
|
||||
ChatService.ErrorMessage(player, "Dieser Spieler ist schon in einer Fraktion");
|
||||
return;
|
||||
}
|
||||
if (targetUser?.Wanteds > 0)
|
||||
{
|
||||
player.SendNotification("~r~Du kannst diesen Spieler nicht inviten da er aktuell gesucht wird. (Wanted)", false);
|
||||
return;
|
||||
}
|
||||
|
||||
target.SetData("accept_faction_invite", player.Name);
|
||||
|
||||
@@ -486,7 +491,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
using var dbContext = new DatabaseContext();
|
||||
var user = player.GetUser(dbContext);
|
||||
|
||||
if(user.FactionId == null)
|
||||
if (user.FactionId == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -517,7 +522,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
}
|
||||
|
||||
var factionVehicleCount = dbContext.FactionVehicles.ToList().Where(v => v.Id == id && v.GetOwners().Contains(user.FactionId.Value)).Count();
|
||||
if(factionVehicleCount <= 6)
|
||||
if (factionVehicleCount <= 6)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Die Fraktion braucht mindestens 6 Fahrzeuge");
|
||||
return;
|
||||
@@ -589,86 +594,77 @@ namespace ReallifeGamemode.Server.Managers
|
||||
public void InteractionMenu_LSPD_Points3(Player player, string jsonNameOrId, string jsoAmount, string jsonReason)
|
||||
{
|
||||
string nameOrId = (string)JsonConvert.DeserializeObject(jsonNameOrId);
|
||||
int amount = Int32.Parse((string)JsonConvert.DeserializeObject(jsoAmount));
|
||||
string reason = (string)JsonConvert.DeserializeObject(jsonReason);
|
||||
Player target = PlayerService.GetPlayerByNameOrId(nameOrId);
|
||||
string playername = NAPI.Player.GetPlayerName(player);
|
||||
string targetname = NAPI.Player.GetPlayerName(target);
|
||||
|
||||
if (!int.TryParse((string)JsonConvert.DeserializeObject(jsoAmount), out int amount))
|
||||
{
|
||||
player.SendNotification("~r~Es muss eine gültige Zahl für die Punkte angegeben werden!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
else if (target.GetUser().DriverLicenseVehicle == false && target.GetUser().DriverLicenseBike == false)
|
||||
{
|
||||
player.SendNotification("~r~Spieler hat weder Auto- noch Motorradführerschein!");
|
||||
}
|
||||
else if (target == player)
|
||||
|
||||
if (target == player)
|
||||
{
|
||||
player.SendNotification("~r~Du kannst dir selbst keine Punkte setzen!");
|
||||
return;
|
||||
}
|
||||
|
||||
using var dbContext = new DatabaseContext();
|
||||
User targetUser = target.GetUser(dbContext);
|
||||
|
||||
if(targetUser == null)
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetUser.DriverLicenseVehicle == false && targetUser.DriverLicenseBike == false)
|
||||
{
|
||||
player.SendNotification("~r~Spieler hat weder Auto- noch Motorradführerschein!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (amount < -13 || amount > 13)
|
||||
{
|
||||
player.SendNotification("~r~Du kannst nur zwischen 1 und 12 Punkte verteilen!");
|
||||
return;
|
||||
}
|
||||
|
||||
targetUser.Points += amount;
|
||||
|
||||
player.SendNotification($"~w~Du hast ~y~{targetname} ~b~{amount} ~w~Strafpunkte gegeben. Grund: ~g~{reason}~w~.");
|
||||
target.SendNotification($"~b~{player.GetUser().FactionRank.RankName} | {playername} ~w~hat dir ~y~{amount} ~w~Strafpunkte gegeben.", true);
|
||||
ChatService.HQMessage(targetname + " hat von " + playername + " " + amount + " Strafpunkt(e) erhalten. Gesamt: " + targetUser.Points);
|
||||
|
||||
if (targetUser.Points < 0)
|
||||
{
|
||||
targetUser.Points = 0;
|
||||
}
|
||||
else if (targetUser.Points >= 12)
|
||||
{
|
||||
target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~r~12/12 ~x~Strafpunkten.", true);
|
||||
target.SendNotification($"~w~Dir wird ~r~Auto- ~w~und ~r~Motorradführerschein ~w~entzogen.", true); //FlashNotif
|
||||
|
||||
ChatService.HQMessage(targetname + " besitzt nun keinen Führerschein mehr.");
|
||||
|
||||
targetUser.Points = 0;
|
||||
targetUser.DriverLicenseVehicle = false;
|
||||
targetUser.DriverLicenseBike = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (amount > -13 && amount < 13)
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
User target2 = target.GetUser(dbContext);
|
||||
target2.Points += amount;
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
player.SendNotification($"~w~Du hast ~y~{targetname} ~b~{amount} ~w~Strafpunkte gegeben. Grund: ~g~{reason}~w~.");
|
||||
target.SendNotification($"~b~{player.GetUser().FactionRank.RankName} | {playername} ~w~hat dir ~y~{amount} ~w~Strafpunkte gegeben.", true);
|
||||
ChatService.BroadcastFaction("!{#8181E9}HQ: " + targetname + " hat von " + playername + " " + amount + " Strafpunkt(e) erhalten. Gesamt: " + target.GetUser().Points, new List<int>() { 1, 3 });
|
||||
if (target.GetUser().Points < 0)
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
User target2 = target.GetUser(dbContext);
|
||||
target2.Points = 0;
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
else if (target.GetUser().Points >= 12)
|
||||
{
|
||||
target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~r~12/12 ~x~Strafpunkten.", true);
|
||||
target.SendNotification($"~w~Dir wird ~r~Auto- ~w~und ~r~Motorradführerschein ~w~entzogen.", true); //FlashNotif
|
||||
ChatService.HQMessage(targetname + "hat von" + playername + " " + amount + " Strafpunkt erhalten(e). Gesamt: " + target.GetUser().Points);
|
||||
foreach (var copPlayer in NAPI.Pools.GetAllPlayers())
|
||||
{
|
||||
User copUser = copPlayer.GetUser();
|
||||
if (copUser == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (copUser.FactionId == 1 || copUser.FactionId == 3)
|
||||
{
|
||||
if (copUser.GetData<bool>("duty") == true)
|
||||
{
|
||||
ChatService.HQMessage(targetname + " besitzt nun keinen Führerschein mehr.");
|
||||
}
|
||||
}
|
||||
}
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
User target2 = target.GetUser(dbContext);
|
||||
target2.Points = 0;
|
||||
target2.DriverLicenseVehicle = false;
|
||||
target2.DriverLicenseBike = false;
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~y~{target.GetUser().Points}/12 ~x~Strafpunkten.", true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendNotification("~r~Du kannst nur zwischen 1 und 12 Punkte verteilen!");
|
||||
}
|
||||
target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~y~{targetUser.Points}/12 ~x~Strafpunkten.", true);
|
||||
}
|
||||
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
[RemoteEvent("CLIENT:InteractionMenu_Ticket")]
|
||||
|
||||
@@ -563,6 +563,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
if (iItem is IWeaponDealItem obj)
|
||||
{
|
||||
player.ClearAttachments();
|
||||
player.ClearAnimation();
|
||||
dropPosition.Z -= 1.05f;
|
||||
grndObject = NAPI.Object.CreateObject(3666746839, dropPosition, new Vector3(0, 0, r.Next(0, 360)), 255, 0);
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
VehicleStreaming.SetEngineState(player.Vehicle, false);
|
||||
}
|
||||
|
||||
player.Position = playerJobStartPosition[player];
|
||||
job.StopJob(player);
|
||||
|
||||
if (playerTimersJobVehicleRespawn.ContainsKey(player))
|
||||
|
||||
@@ -6,6 +6,7 @@ using ReallifeGamemode.Server.Shop.SevenEleven;
|
||||
using ReallifeGamemode.Server.Shop.Friseur;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Shop.Ammunation;
|
||||
|
||||
namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
@@ -29,6 +30,8 @@ namespace ReallifeGamemode.Server.Managers
|
||||
|
||||
public static List<Player> cuffPoints = new List<Player>();
|
||||
|
||||
public static List<AmmunationPoint> AmmunationPoints = new List<AmmunationPoint>();
|
||||
|
||||
public static void LoadPositionManager()
|
||||
{
|
||||
#region DutyPoints
|
||||
@@ -280,6 +283,20 @@ namespace ReallifeGamemode.Server.Managers
|
||||
NAPI.TextLabel.CreateTextLabel("24/7 - Dr\u00fccke ~y~E", s.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||
}
|
||||
|
||||
foreach (Ammunation s in ShopManager.Ammunations)
|
||||
{
|
||||
NAPI.Marker.CreateMarker(1, new Vector3(s.vector.X, s.vector.Y, s.vector.Z - 2), new Vector3(s.vector.X, s.vector.Y, s.vector.Z + 1),
|
||||
new Vector3(0, 0, 0), 2, new Color(255, 255, 255, 50), false, 0);
|
||||
NAPI.TextLabel.CreateTextLabel("Ammunation - Dr\u00fccke ~y~E", s.vector, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||
|
||||
AmmunationPoint ammuShop = new AmmunationPoint
|
||||
{
|
||||
Position = s.vector,
|
||||
Ammunation = s
|
||||
};
|
||||
AmmunationPoints.Add(ammuShop);
|
||||
}
|
||||
|
||||
#endregion Shops
|
||||
}
|
||||
|
||||
@@ -407,3 +424,9 @@ public class ElevatorPoint
|
||||
public int FactionId { get; set; }
|
||||
public string Stage { get; set; }
|
||||
}
|
||||
|
||||
public class AmmunationPoint
|
||||
{
|
||||
public Vector3 Position { get; set; }
|
||||
public Ammunation Ammunation { get; set; }
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Shop.Clothing;
|
||||
using ReallifeGamemode.Server.Shop.SevenEleven;
|
||||
using ReallifeGamemode.Server.Shop.Friseur;
|
||||
using ReallifeGamemode.Server.Shop.Ammunation;
|
||||
|
||||
namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
@@ -14,6 +15,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
public static List<ClotheShop> clotheStores = new List<ClotheShop>();
|
||||
public static List<ItemShop> itemShops = new List<ItemShop>();
|
||||
public static List<Friseur> FriseurStores = new List<Friseur>();
|
||||
public static List<Ammunation> Ammunations = new List<Ammunation>();
|
||||
|
||||
public static void LoadClotheShops()
|
||||
{
|
||||
@@ -81,5 +83,20 @@ namespace ReallifeGamemode.Server.Managers
|
||||
}
|
||||
}
|
||||
|
||||
public static void LoadAmmunations()
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
List<SavedBlip> ammunations = dbContext.Blips.ToList().FindAll(s => s.Name == "Ammunation");
|
||||
|
||||
foreach (var store in ammunations)
|
||||
{
|
||||
Vector3 pos = new Vector3(store.PositionX, store.PositionY, store.PositionZ);
|
||||
Ammunation newShop = new Ammunation(pos);
|
||||
Ammunations.Add(newShop);
|
||||
}
|
||||
NAPI.Util.ConsoleOutput($"Loading {ammunations.Count} Ammunations");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,9 @@ namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
public class VehicleManager : Script
|
||||
{
|
||||
|
||||
public static Dictionary<Vehicle, Dictionary<string, DateTime>> lastDriversInVehicle = new Dictionary<Vehicle, Dictionary<string, DateTime>>();
|
||||
|
||||
private static readonly List<string> _enabledMods = new List<string>()
|
||||
{
|
||||
"ninef",
|
||||
|
||||
40
ReallifeGamemode.Server/Shop/Ammunation/Ammunation.cs
Normal file
40
ReallifeGamemode.Server/Shop/Ammunation/Ammunation.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using Newtonsoft.Json;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
|
||||
namespace ReallifeGamemode.Server.Shop.Ammunation
|
||||
{
|
||||
public class Ammunation
|
||||
{
|
||||
public Vector3 vector { get; set; }
|
||||
public List<Weapon> weaponList = new List<Weapon>();
|
||||
|
||||
public Ammunation(Vector3 position)
|
||||
{
|
||||
this.vector = position;
|
||||
LoadWeapons();
|
||||
}
|
||||
|
||||
public void LoadWeapons()
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
weaponList = dbContext.Weapons.ToList().FindAll(w => w.AmmunationActive == true);
|
||||
}
|
||||
}
|
||||
public void LoadShopNUI(Player client)
|
||||
{
|
||||
|
||||
List<Weapon> shopWeapons = weaponList.ToList();
|
||||
client.TriggerEvent("AmmunationShop:LoadNativeUI", JsonConvert.SerializeObject(shopWeapons));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,7 @@ namespace ReallifeGamemode.Server.Wanted
|
||||
dbContext.SaveChanges();
|
||||
waTimer[user.Id] = WantedEscapeTime;
|
||||
}
|
||||
else if (!isNearCop)
|
||||
else if (!isNearCop && !player.IsAfk())
|
||||
{
|
||||
player.TriggerEvent("SERVER:SetWantedFlash", true);
|
||||
waTimer[user.Id] -= 2500;
|
||||
|
||||
@@ -196,7 +196,7 @@ namespace ReallifeGamemode.Server.WeaponDeal
|
||||
fVeh.AddAttachment("weapondeal1", false);
|
||||
fVeh.AddAttachment("weapondeal2", false);
|
||||
InventoryManager.RemoveAllItemsfromVehicleInventory(fVeh);
|
||||
int oMembers = NAPI.Pools.GetAllPlayers().Where(p => p.IsLoggedIn() && p.GetUser(context).FactionId == user.FactionId).Count();
|
||||
int oMembers = NAPI.Pools.GetAllPlayers().Where(p => !p.IsAfk() && p.IsLoggedIn() && p.GetUser(context).FactionId == user.FactionId).Count();
|
||||
|
||||
if (factionVehicle.GetOwners().Contains(8) || factionVehicle.GetOwners().Contains(7))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user