change weaponAmmo & add WeaponStock at WeaponMenu
This commit is contained in:
@@ -342,6 +342,17 @@ namespace ReallifeGamemode.Server.Events
|
||||
List<string> melees = new List<string>();
|
||||
List<string> specials = new List<string>();
|
||||
List<string> timer = new List<string>();
|
||||
int pistol_Amount = 0;
|
||||
int pistol50_Amount = 0;
|
||||
int Pistol_mk2_Amount = 0;
|
||||
int Combatpistol_Amount = 0;
|
||||
int SMG_Amount = 0;
|
||||
int Carbinerifle_Amount = 0;
|
||||
int Compactrifle_Amount = 0;
|
||||
int sniperrifle_Amount = 0;
|
||||
int Pumpshotgun_Amount = 0;
|
||||
int Schutzweste_Amount = 0;
|
||||
int Stungun_Amount = 0;
|
||||
string dealTime = "Starten";
|
||||
primarys.Add("Keine");
|
||||
secondarys.Add("Keine");
|
||||
@@ -386,7 +397,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
|
||||
List<FactionWeapon> weapons = context.FactionWeapons.Where(w => w.FactionId == user.FactionId).ToList();
|
||||
Database.Entities.Faction faction = context.Factions.Where(fac => fac.Id == user.FactionId).FirstOrDefault();
|
||||
|
||||
|
||||
if (faction.WeaponDealTime > 0)
|
||||
dealTime = "noch " + faction.WeaponDealTime.ToString() + " min. übrig";
|
||||
|
||||
@@ -418,10 +429,56 @@ namespace ReallifeGamemode.Server.Events
|
||||
specials.Add(weapon.WeaponModel.ToString());
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
foreach (var weapon in weapons)
|
||||
{
|
||||
if (weapon.WeaponModel == "Pistol")
|
||||
{
|
||||
pistol_Amount = weapon.Ammount;
|
||||
}
|
||||
else if(weapon.WeaponModel == "Pistol50"){
|
||||
pistol50_Amount = weapon.Ammount;
|
||||
}
|
||||
else if(weapon.WeaponModel == "Pistol_MK2") {
|
||||
Pistol_mk2_Amount = weapon.Ammount;
|
||||
}
|
||||
else if (weapon.WeaponModel == "Combatpistol")
|
||||
{
|
||||
Combatpistol_Amount = weapon.Ammount;
|
||||
}
|
||||
else if (weapon.WeaponModel == "SMG")
|
||||
{
|
||||
SMG_Amount = weapon.Ammount;
|
||||
}
|
||||
else if (weapon.WeaponModel == "CarbineRifle")
|
||||
{
|
||||
Carbinerifle_Amount = weapon.Ammount;
|
||||
}
|
||||
else if (weapon.WeaponModel == "CompactRifle")
|
||||
{
|
||||
Compactrifle_Amount = weapon.Ammount;
|
||||
}
|
||||
else if (weapon.WeaponModel == "sniperrifle")
|
||||
{
|
||||
sniperrifle_Amount = weapon.Ammount;
|
||||
}
|
||||
else if (weapon.WeaponModel == "PumpShotgun")
|
||||
{
|
||||
Pumpshotgun_Amount = weapon.Ammount;
|
||||
}
|
||||
else if (weapon.WeaponModel == "Schutzweste")
|
||||
{
|
||||
Schutzweste_Amount = weapon.Ammount;
|
||||
}
|
||||
else if (weapon.WeaponModel == "Stungun")
|
||||
{
|
||||
Stungun_Amount = weapon.Ammount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
player.TriggerEvent("showWeaponMenu", primarys.ToArray(), secondarys.ToArray(), melees.ToArray(), specials.ToArray(), JsonConvert.SerializeObject(timer.ToArray()));
|
||||
player.TriggerEvent("showWeaponMenu", primarys.ToArray(), secondarys.ToArray(), melees.ToArray(), specials.ToArray(), JsonConvert.SerializeObject(timer.ToArray()), pistol_Amount.ToString(), pistol50_Amount.ToString(), Pistol_mk2_Amount.ToString(), Combatpistol_Amount.ToString(), SMG_Amount.ToString(), Carbinerifle_Amount.ToString(), Compactrifle_Amount.ToString(), sniperrifle_Amount.ToString(), Pumpshotgun_Amount.ToString(), Schutzweste_Amount.ToString(), Stungun_Amount.ToString());
|
||||
}
|
||||
if (nearestJailReleasePoint != null)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
@@ -67,8 +67,8 @@ namespace ReallifeGamemode.Server.Events
|
||||
melee = NAPI.Util.GetHashKey($"weapon_{meleeModel}");
|
||||
}
|
||||
|
||||
client.GiveWeapon((WeaponHash)primary, 50);
|
||||
client.GiveWeapon((WeaponHash)secondary, 150);
|
||||
client.GiveWeapon((WeaponHash)primary, 300);
|
||||
client.GiveWeapon((WeaponHash)secondary, 100);
|
||||
client.GiveWeapon((WeaponHash)melee, 1);
|
||||
if (specialModel != "Schutzweste")
|
||||
{
|
||||
@@ -78,11 +78,11 @@ namespace ReallifeGamemode.Server.Events
|
||||
if (specialModel.Contains("mk2") && !specialModel.Contains("_mk2")) specialModel = specialModel.Replace("mk2", "_mk2");
|
||||
special = NAPI.Util.GetHashKey($"weapon_{specialModel}");
|
||||
}
|
||||
client.GiveWeapon((WeaponHash)special, 50);
|
||||
client.GiveWeapon((WeaponHash)special, 30);
|
||||
}
|
||||
else
|
||||
{
|
||||
client.Armor = 50;
|
||||
client.Armor = 100;
|
||||
}
|
||||
|
||||
using (var context = new DatabaseContext())
|
||||
|
||||
Reference in New Issue
Block a user