[+] 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

@@ -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;
}
}
}