Fix missing database migration
This commit is contained in:
79
ReallifeGamemode.Server/Events/UpdateCharacterWeapon.cs
Normal file
79
ReallifeGamemode.Server/Events/UpdateCharacterWeapon.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using Newtonsoft.Json;
|
||||
using ReallifeGamemode.Server.Entities;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Models;
|
||||
|
||||
namespace ReallifeGamemode.Server.Events
|
||||
{
|
||||
public class UpdateCharacterWeapon : Script
|
||||
{
|
||||
|
||||
|
||||
|
||||
[RemoteEvent("updateWeaponSelection")]
|
||||
public void UpdateWeaponSelection(Client client, string weaponModel, int slot)
|
||||
{
|
||||
if(weaponModel == "Schutzweste")
|
||||
{
|
||||
client.Armor = 100;
|
||||
return;
|
||||
}
|
||||
|
||||
WeaponHash weaponHash = NAPI.Util.WeaponNameToModel(weaponModel);
|
||||
|
||||
if (slot == 1)
|
||||
{
|
||||
client.RemoveAllWeapons();
|
||||
client.GiveWeapon(weaponHash, 0);
|
||||
|
||||
}
|
||||
if (slot == 2)
|
||||
{
|
||||
client.RemoveAllWeapons();
|
||||
client.GiveWeapon(weaponHash, 0);
|
||||
}
|
||||
if (slot == 3)
|
||||
{
|
||||
client.RemoveAllWeapons();
|
||||
client.GiveWeapon(weaponHash, 0);
|
||||
}
|
||||
if (slot == 4)
|
||||
{
|
||||
client.RemoveAllWeapons();
|
||||
client.GiveWeapon(weaponHash, 0);
|
||||
client.Armor = 0;
|
||||
}
|
||||
}
|
||||
|
||||
[RemoteEvent("cancelWeaponSelection")]
|
||||
public void CancelWeaponSelection(Client client)
|
||||
{
|
||||
client.RemoveAllWeapons();
|
||||
}
|
||||
|
||||
|
||||
[RemoteEvent("saveWeaponSelection")]
|
||||
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);
|
||||
|
||||
|
||||
client.GiveWeapon(primary, 150);
|
||||
client.GiveWeapon(secondary, 600);
|
||||
client.GiveWeapon(melee, 1);
|
||||
if(specialModel != "Schutzweste")
|
||||
{
|
||||
WeaponHash special = NAPI.Util.WeaponNameToModel(specialModel);
|
||||
client.GiveWeapon(special, 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user