I’m trying to write a method that drops the current held weapon via a command.
However, I’m getting an error when within in “SetPedDropInventoryWeapon” native.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CitizenFX.Core;
using CitizenFX.Core.UI;
using static CitizenFX.Core.Native.API;
namespace Weapon
{
public class DropWeapon : BaseScript
{
public DropWeapon()
{
TriggerEvent("chat:addSuggestion", "/drop", "Drop your weapon on the ground.");
Tick += dropWeap;
RegisterCommand("drop", new Action<int, List<object>, string>((source, arguments, raw) =>
{
dropWeap();
}), false);
}
private async Task dropWeap()
{
var ped = GetPlayerPed(-1);
var weap = GetSelectedPedWeapon(ped);
SetPedDropsWeaponsWhenDead(ped, true);
RequestAnimDict("mp_weapon_drop");
if (DoesEntityExist(GetPlayerPed(-1)) && !IsEntityDead(GetPlayerPed(-1)))
{
TaskPlayAnim(ped, "mp_weapon_drop", "drop_bh", 8, 2, -1, 0, 2, false, false, false);
SetPedDropsInventoryWeapon(ped, weap, 0, 2, 0, 1000);
SetCurrentPedWeapon(ped, 2725352035, true);
Screen.ShowNotification("You dropped your weapon on the ground.");
}
}
}
}
The error is “SetPedDropsInventoryWeapon(ped, weap, 0, 2, 0, 1000);” the “wep” integer is not able to be converted to an uint.
Any ideas?