add armor as lonley item
This commit is contained in:
@@ -39,6 +39,10 @@ namespace ReallifeGamemode.Server.Events
|
||||
client.RemoveAllWeapons();
|
||||
client.GiveWeapon(weaponHash, 0);
|
||||
}
|
||||
if (slot == 5)
|
||||
{
|
||||
client.Armor = 100;
|
||||
}
|
||||
}
|
||||
|
||||
[RemoteEvent("cancelWeaponSelection")]
|
||||
@@ -48,7 +52,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
|
||||
[RemoteEvent("saveWeaponSelection")]
|
||||
public void SaveWeaponSelection(Player client, string primaryModel, string secondaryModel, string meleeModel, string specialModel)
|
||||
public void SaveWeaponSelection(Player client, string primaryModel, string secondaryModel, string meleeModel, string specialModel, string armor)
|
||||
{
|
||||
client.RemoveAllWeapons();
|
||||
if (!uint.TryParse(primaryModel, out uint primary))
|
||||
@@ -70,17 +74,16 @@ namespace ReallifeGamemode.Server.Events
|
||||
client.GiveWeapon((WeaponHash)primary, 300);
|
||||
client.GiveWeapon((WeaponHash)secondary, 100);
|
||||
client.GiveWeapon((WeaponHash)melee, 1);
|
||||
if (specialModel != "Schutzweste")
|
||||
{
|
||||
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, 30);
|
||||
}
|
||||
else
|
||||
|
||||
if(armor == "Schutzweste")
|
||||
{
|
||||
client.Armor = 100;
|
||||
}
|
||||
@@ -100,6 +103,9 @@ namespace ReallifeGamemode.Server.Events
|
||||
FactionWeapon slot4 = context.FactionWeapons.Where(w => w.FactionId == user.FactionId && w.WeaponModel == specialModel).FirstOrDefault();
|
||||
if (slot4 != null)
|
||||
slot4.Ammount -= 1;
|
||||
FactionWeapon slot5 = context.FactionWeapons.Where(w => w.FactionId == user.FactionId && w.WeaponModel == armor).FirstOrDefault();
|
||||
if (slot5 != null)
|
||||
slot5.Ammount -= 1;
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user