[+] Add Command for Admin /setweaponrack , /rmweaponrack and for Leader /setweaponrank

+ Add blip alpha channel for Players (set to 125)
   + Add blip color for Player with Wanted
   - Removed WeaponHash from DB entry FactionWeapons (Deprecated)
This commit is contained in:
Lukas Moungos
2019-07-21 21:01:14 +02:00
parent 57e22c0b6e
commit bbcb56c492
13 changed files with 1489 additions and 68 deletions

View File

@@ -206,6 +206,7 @@ namespace ReallifeGamemode.Server.Events
player.SendNotification("Du bist nun ~r~außer Dienst.");
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", false);
player.NametagColor = new Color(255, 255, 255);
player.SetSharedData("blipColor", 4);
UpdateCharacterCloth.LoadCharacterDefaults(player);
}
}
@@ -216,59 +217,34 @@ namespace ReallifeGamemode.Server.Events
List<string> secondarys = new List<string>();
List<string> melees = new List<string>();
List<string> specials = new List<string>();
primarys.Add("Keine");
secondarys.Add("Keine");
melees.Add("Keine");
specials.Add("Keine");
using (var context = new DatabaseContext())
{
List<FactionWeapon> weapons = context.FactionWeapons.ToList().FindAll(w => w.FactionId == user.FactionId);
foreach (var weapon in weapons)
{
switch (weapon.SlotID)
{
case 1:
if (weapon.WeaponHash != -1)
{
if (user.FactionRank.Order >= weapon.Rank)
primarys.Add(weapon.WeaponModel.ToString());
}
else
{
primarys.Add("Keine");
}
if (user.FactionRank.Order >= weapon.Rank)
primarys.Add(weapon.WeaponModel.ToString());
break;
case 2:
if (weapon.WeaponHash != -1)
{
if (user.FactionRank.Order >= weapon.Rank)
secondarys.Add(weapon.WeaponModel.ToString());
}
else
{
secondarys.Add("Keine");
}
if (user.FactionRank.Order >= weapon.Rank)
secondarys.Add(weapon.WeaponModel.ToString());
break;
case 3:
if (weapon.WeaponHash != -1)
{
if (user.FactionRank.Order >= weapon.Rank)
melees.Add(weapon.WeaponModel.ToString());
}
else
{
melees.Add("Keine");
}
if (user.FactionRank.Order >= weapon.Rank)
melees.Add(weapon.WeaponModel.ToString());
break;
case 4:
if (weapon.WeaponHash != -1)
{
if (user.FactionRank.Order >= weapon.Rank)
specials.Add(weapon.WeaponModel.ToString());
}
else
{
specials.Add("Keine");
specials.Add("Schutzweste");
}
if (user.FactionRank.Order >= weapon.Rank)
specials.Add(weapon.WeaponModel.ToString());
break;
}
}
@@ -276,19 +252,18 @@ namespace ReallifeGamemode.Server.Events
player.TriggerEvent("showWeaponMenu", primarys.ToArray(), secondarys.ToArray(), melees.ToArray(), specials.ToArray());
}
if(nearestJailReleasePoint != null)
if (nearestJailReleasePoint != null)
{
List<string> criminals = new List<string>();
criminals.Add("Keiner");
foreach (Client target in NAPI.Pools.GetAllPlayers())
{
User c = target.GetUser();
if (c.JailTime > 0)
{
if (c.JailTime > 0)
{
criminals.Add(c.Name.ToString());
}
}
criminals.Add(c.Name);
}
}
player.TriggerEvent("showJailMenu", JsonConvert.SerializeObject(criminals.ToArray()));
}

View File

@@ -6,7 +6,9 @@ using GTANetworkAPI;
using Newtonsoft.Json;
using ReallifeGamemode.Server.Entities;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Managers;
using ReallifeGamemode.Server.Models;
using ReallifeGamemode.Server.Services;
namespace ReallifeGamemode.Server.Events
{
@@ -18,9 +20,9 @@ namespace ReallifeGamemode.Server.Events
[RemoteEvent("updateWeaponSelection")]
public void UpdateWeaponSelection(Client client, string weaponModel, int slot)
{
if(weaponModel == "Schutzweste")
if(weaponModel == "Keine")
{
client.Armor = 100;
client.RemoveAllWeapons();
return;
}
@@ -45,8 +47,7 @@ namespace ReallifeGamemode.Server.Events
if (slot == 4)
{
client.RemoveAllWeapons();
client.GiveWeapon(weaponHash, 0);
client.Armor = 0;
client.GiveWeapon(weaponHash, 0);
}
}
@@ -61,19 +62,38 @@ namespace ReallifeGamemode.Server.Events
public void SaveWeaponSelection(Client client, string primaryModel, string secondaryModel, string meleeModel, string specialModel)
{
client.RemoveAllWeapons();
WeaponHash primary = NAPI.Util.WeaponNameToModel(primaryModel);
WeaponHash secondary = NAPI.Util.WeaponNameToModel(secondaryModel);
WeaponHash melee = NAPI.Util.WeaponNameToModel(meleeModel);
if (!uint.TryParse(primaryModel, out uint primary))
{
if (primaryModel.Contains("mk2") && !primaryModel.Contains("_mk2")) primaryModel = primaryModel.Replace("mk2", "_mk2");
primary = NAPI.Util.GetHashKey($"weapon_{primaryModel}");
}
if (!uint.TryParse(secondaryModel, out uint secondary))
{
if (secondaryModel.Contains("mk2") && !secondaryModel.Contains("_mk2")) secondaryModel = secondaryModel.Replace("mk2", "_mk2");
secondary = NAPI.Util.GetHashKey($"weapon_{secondaryModel}");
}
if (!uint.TryParse(meleeModel, out uint melee))
{
if (meleeModel.Contains("mk2") && !meleeModel.Contains("_mk2")) meleeModel = meleeModel.Replace("mk2", "_mk2");
melee = NAPI.Util.GetHashKey($"weapon_{meleeModel}");
}
client.GiveWeapon(primary, 150);
client.GiveWeapon(secondary, 600);
client.GiveWeapon(melee, 1);
client.GiveWeapon((WeaponHash)primary, 150);
client.GiveWeapon((WeaponHash)secondary, 600);
client.GiveWeapon((WeaponHash)melee, 1);
if(specialModel != "Schutzweste")
{
WeaponHash special = NAPI.Util.WeaponNameToModel(specialModel);
client.GiveWeapon(special, 50);
}
client.Armor = 0;
if (!uint.TryParse(specialModel, out uint special))
{
if (specialModel.Contains("mk2") && !specialModel.Contains("_mk2")) specialModel = specialModel.Replace("mk2", "_mk2");
special = NAPI.Util.GetHashKey($"weapon_{specialModel}");
}
client.GiveWeapon((WeaponHash)special, 50);
return;
}
client.Armor = 100;
}
}
}