Merge branch 'develop' into 'master'
[HOTFIX] Fix undefined in infobox, Taxi call , Drivingschool menu and online list See merge request log-gtav/reallife-gamemode!29
This commit is contained in:
@@ -50,7 +50,7 @@ export default function (globalData: IGlobalData): void {
|
||||
|
||||
var playerName;
|
||||
var playerId;
|
||||
var playerMoney;
|
||||
var playerMoney = "5000";
|
||||
|
||||
mp.events.add("draw", (pName, pId) => {
|
||||
playerName = pName;
|
||||
@@ -110,6 +110,9 @@ export default function (globalData: IGlobalData): void {
|
||||
});
|
||||
|
||||
mp.events.add("updateMoney", (money) => {
|
||||
if (money == undefined)
|
||||
money = 0;
|
||||
|
||||
playerMoney = moneyFormat(money);
|
||||
});
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ export default function drivingSchoolList(globalData: IGlobalData) {
|
||||
var drivingMenu: NativeUI.Menu;
|
||||
|
||||
|
||||
var stage = "";
|
||||
var stage = "Auto";
|
||||
|
||||
|
||||
//Weapon Menu
|
||||
|
||||
@@ -3540,6 +3540,33 @@ namespace ReallifeGamemode.Server.Commands
|
||||
player.SendChatMessage("~m~Benutzung:~s~ /business [price] [Option]");
|
||||
}
|
||||
|
||||
[Command("checkstats", "~m~Benutzung:~s~ /checkstats [Name / ID]")]
|
||||
public void CmdAdminCheckStats(Player player, string nameOrId)
|
||||
{
|
||||
User user = player.GetUser();
|
||||
if(!user.IsAdmin(AdminLevel.ADMIN))
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
}
|
||||
|
||||
Player target = PlayerService.GetPlayerByNameOrId(nameOrId);
|
||||
if(target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
|
||||
User targetUser = target.GetUser();
|
||||
int handmoney = targetUser.Handmoney;
|
||||
int bankmoney = targetUser.BankAccount.Balance;
|
||||
bool driverLicense = targetUser.DriverLicenseVehicle;
|
||||
bool bikeLicense = targetUser.DriverLicenseBike;
|
||||
bool flyingLicense = targetUser.FlyingLicensePlane;
|
||||
bool weaponLicense = targetUser.WeaponLicense;
|
||||
ChatService.SendMessage(player, $"Stats von {target.Name} - HandMoney: {handmoney.ToMoneyString()}, BankMoney: {bankmoney.ToMoneyString()}, DriverLicense: {driverLicense.ToString()}, BikeLicense: {bikeLicense.ToString()}, FlyingLicense: {flyingLicense.ToString()}, WeaponLicense: {weaponLicense.ToString()}");
|
||||
}
|
||||
|
||||
|
||||
#endregion ALevel1337
|
||||
|
||||
#region ALevel1338
|
||||
|
||||
@@ -10,6 +10,7 @@ using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Factions.Medic;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
using ReallifeGamemode.Server.Types;
|
||||
using ReallifeGamemode.Services;
|
||||
|
||||
/**
|
||||
@@ -43,20 +44,21 @@ namespace ReallifeGamemode.Server.Commands
|
||||
[Command("ga", "~m~Benutzung: ~s~/ga [Nachricht]", GreedyArg = true)]
|
||||
public void CmdFactionGA(Player player, string message)
|
||||
{
|
||||
Faction f = player.GetUser()?.Faction;
|
||||
User user = player.GetUser();
|
||||
Faction f = user?.Faction;
|
||||
if (f == null || f.StateOwned)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
if (player.GetUser().Faction.Name == "Ballas" || player.GetUser().Faction.Name == "Grove")
|
||||
if (f.Name == "Ballas" || f.Name == "Grove" || user.IsAdmin(AdminLevel.ADMIN))
|
||||
{
|
||||
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
||||
|
||||
string broadcastMessage = "!{FF0000}** " + player.GetUser().GetFactionRank().RankName + " " + player.Name + ": " + message + " **";
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.GangOwned));
|
||||
ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.GangOwned), true);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -177,7 +179,8 @@ namespace ReallifeGamemode.Server.Commands
|
||||
[Command("lc", "~m~Benutzung: ~s~/lc [Nachricht]", GreedyArg = true)]
|
||||
public void CmdFactionLc(Player player, string message)
|
||||
{
|
||||
if (player.GetUser()?.FactionId == null || player.GetUser().FactionLeader == false)
|
||||
User user = player.GetUser();
|
||||
if (user?.FactionId == null || user.FactionLeader == false || !user.IsAdmin(AdminLevel.ADMIN))
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
@@ -189,7 +192,8 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
NAPI.Pools.GetAllPlayers().ForEach(p =>
|
||||
{
|
||||
if (p.GetUser()?.FactionLeader ?? false) ChatService.SendMessage(p, broadcastMsg);
|
||||
User pUser = p.GetUser();
|
||||
if (pUser?.FactionLeader ?? false || pUser.IsAdmin(AdminLevel.ADMIN)) ChatService.SendMessage(p, broadcastMsg);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -612,14 +612,14 @@ namespace ReallifeGamemode.Server.Events
|
||||
public void KeyPressO(Player player)
|
||||
{
|
||||
if (!player.IsLoggedIn()) return;
|
||||
List<Player> players = NAPI.Pools.GetAllPlayers().Where(p => p.IsLoggedIn() == true).ToList();
|
||||
List<Player> players = NAPI.Pools.GetAllPlayers().Where(p => p.IsLoggedIn() == true).OrderBy(o => o.Handle.Value).ToList();
|
||||
|
||||
var listPlayers = players.Select(p => new
|
||||
{
|
||||
Id = p.Handle.Value,
|
||||
p.Name,
|
||||
p.Ping,
|
||||
FactionName = p.GetUser().Faction?.Name ?? "Zivilist",
|
||||
FactionName = p.GetUser()?.Faction?.Name ?? "Zivilist",
|
||||
});
|
||||
player.TriggerEvent("showPlayerlist", JsonConvert.SerializeObject(listPlayers));
|
||||
}
|
||||
|
||||
@@ -93,6 +93,11 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
|
||||
internal static T GetData<T>(this User user, string key, T nullValue)
|
||||
{
|
||||
if(user == null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
key += "data_";
|
||||
if (!user.Player.HasData(key)) return nullValue;
|
||||
return JsonConvert.DeserializeObject<T>(user.Player.GetData<dynamic>(key));
|
||||
@@ -102,6 +107,11 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
|
||||
internal static void SetData(this User user, string key, object value)
|
||||
{
|
||||
if(user == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
key += "data_";
|
||||
user.Player.SetData(key, JsonConvert.SerializeObject(value));
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace ReallifeGamemode.Server.Factions.Medic
|
||||
public static List<MedicTask> ReviveTasks = new List<MedicTask>();
|
||||
public static List<MedicTask> HealTasks = new List<MedicTask>();
|
||||
public static List<MedicTask> FireTasks = new List<MedicTask>();
|
||||
public static int ReviveIncome = 500;
|
||||
public static int ReviveIncome = 100;
|
||||
public static int dutyMedics = 0;
|
||||
|
||||
public static void AddTaskToList(MedicTask task)
|
||||
|
||||
@@ -443,6 +443,12 @@ namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
var taxiJob = JobManager.GetJob<TaxiDriverJob>();
|
||||
|
||||
if(taxiJob == null)
|
||||
{
|
||||
player.SendChatMessage("Aktuell kann kein Taxi gerufen werden.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (taxiJob.TaxiContracts.Where(t => t.Name == player.Name).Count() != 0)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Du kannst nur einmal ein Taxi rufen");
|
||||
|
||||
@@ -52,11 +52,12 @@ namespace ReallifeGamemode.Server.Services
|
||||
/// </summary>
|
||||
/// <param name="message">Die Nachricht, die gesendet werden soll</param>
|
||||
/// <param name="factions">Die Liste an Fraktionen, die diese Nachricht bekommen sollen</param>
|
||||
public static void BroadcastFaction(string message, List<Faction> factions)
|
||||
public static void BroadcastFaction(string message, List<Faction> factions, bool toAdmins = false)
|
||||
{
|
||||
foreach (Player c in NAPI.Pools.GetAllPlayers())
|
||||
{
|
||||
Faction f = c.GetUser()?.Faction;
|
||||
User user = c.GetUser();
|
||||
Faction f = user.Faction;
|
||||
if (f != null)
|
||||
{
|
||||
if (factions.Find(fT => fT.Id == f.Id) != null)
|
||||
@@ -64,6 +65,10 @@ namespace ReallifeGamemode.Server.Services
|
||||
ChatService.SendMessage(c, message);
|
||||
}
|
||||
}
|
||||
else if(user.IsAdmin(AdminLevel.ADMIN) && toAdmins)
|
||||
{
|
||||
ChatService.SendMessage(c, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user