Hello,
I was wondering how I would create a script where you cannot use alternate melee with the taser equipped.
DisableControlAction( 0, 142, true ) -- MeleeAttackAlternate
WEAPON_STUNGUN = 0x3656C8C1
Any help appreciated
Thanks,
Scotty
Hello,
I was wondering how I would create a script where you cannot use alternate melee with the taser equipped.
DisableControlAction( 0, 142, true ) -- MeleeAttackAlternate
WEAPON_STUNGUN = 0x3656C8C1
Any help appreciated
Thanks,
Scotty
Possible try checking if the player is meleeing then clear their tasks? Not too sure on how you would do this any other way, nor am i sure my idea will work
Ok, one more thing from my post before on FiveM Base. This does not seem to be working. It does not give me any weapons at all:
local cop = {
{['i'] = 1, ['weapon'] = "WEAPON_TEARGAS"},
{['i'] = 2, ['weapon'] = "WEAPON_COMBATPISTOL"},
{['i'] = 3, ['weapon'] = "WEAPON_STUNGUN"},
{['i'] = 4, ['weapon'] = "WEAPON_PUMPSHOTGUN"},
{['i'] = 5, ['weapon'] = "WEAPON_CARBINERIFLE"},
{['i'] = 6, ['weapon'] = "WEAPON_NIGHTSTICK"},
{['i'] = 6, ['weapon'] = "WEAPON_FLASHLIGHT"},
}
RegisterNetEvent("yt:cop")
AddEventHandler("yt:cop", function()
RemoveAllPedWeapons(GetPlayerPed(-1))
local model = GetHashKey("s_m_y_sheriff_01")
RequestModel(model)
while not HasModelLoaded(model) do
RequestModel(model)
Citizen.Wait(0)
end
SetPlayerModel(PlayerId(), model)
SetModelAsNoLongerNeeded(model)
local playerPed = GetPlayerPed(-1)
for k,v in ipairs(cop) do
Citizen.Trace("Weapon: "..v.i.." "..v.weapon.." Given to ".. playerPed) then
GiveWeaponComponentToPed(ped, 0x83BF0278, 0x7BC4CDDC) --Carbine Rifle Flashlight
GiveWeaponComponentToPed(ped, 0x83BF0278, 0xC164F53) --Carbine Rifle Grip
GiveWeaponComponentToPed(ped, 0x83BF0278, 0xA0D89C42) --Carbine Rifle Scope
GiveWeaponComponentToPed(ped, 0x5EF9FEC4, 0x359B7AAE) --Combat Pistol Flashlight
GiveWeaponComponentToPed(ped, 0x1D073A89, 0x7BC4CDDC) --Pump Shotgun Flashlight
end
end
end)
Psst, the GiveWeaponComponentToPed
only gives the attachment to the specified weapon im pretty sure, youd need to give the weapon then the component
This works for giving just weapons:
local cop = {
{['i'] = 1, ['weapon'] = "WEAPON_TEARGAS"},
{['i'] = 2, ['weapon'] = "WEAPON_COMBATPISTOL"},
{['i'] = 3, ['weapon'] = "WEAPON_STUNGUN"},
{['i'] = 4, ['weapon'] = "WEAPON_PUMPSHOTGUN"},
{['i'] = 5, ['weapon'] = "WEAPON_CARBINERIFLE"},
{['i'] = 6, ['weapon'] = "WEAPON_NIGHTSTICK"},
{['i'] = 6, ['weapon'] = "WEAPON_FLASHLIGHT"},
}
RegisterNetEvent("yt:cop")
AddEventHandler("yt:cop", function()
RemoveAllPedWeapons(GetPlayerPed(-1))
local model = GetHashKey("s_m_y_sheriff_01")
RequestModel(model)
while not HasModelLoaded(model) do
RequestModel(model)
Citizen.Wait(0)
end
SetPlayerModel(PlayerId(), model)
SetModelAsNoLongerNeeded(model)
local playerPed = GetPlayerPed(-1)
for k,v in ipairs(cop) do
Citizen.Trace("Weapon: "..v.i.." "..v.weapon.." Given to ".. playerPed)
end
end)
Is it GiveWeaponToPed
to give weapons normally?
yes, then use the component thing with the weapons hash and the attachment hash
It should look like this?
RegisterNetEvent("yt:cop")
AddEventHandler("yt:cop", function()
RemoveAllPedWeapons(GetPlayerPed(-1))
local model = GetHashKey("s_m_y_sheriff_01")
RequestModel(model)
while not HasModelLoaded(model) do
RequestModel(model)
Citizen.Wait(0)
end
SetPlayerModel(PlayerId(), model)
SetModelAsNoLongerNeeded(model)
local playerPed = GetPlayerPed(-1)
for k,v in ipairs(cop) do
GiveWeaponToPed(ped, 0x83BF0278)
GiveWeaponToPed(ped, 0x5EF9FEC4)
GiveWeaponToPed(ped, 0x1D073A89)
GiveWeaponComponentToPed(ped, 0x83BF0278, 0x7BC4CDDC) --Carbine Rifle Flashlight
GiveWeaponComponentToPed(ped, 0x83BF0278, 0xC164F53) --Carbine Rifle Grip
GiveWeaponComponentToPed(ped, 0x83BF0278, 0xA0D89C42) --Carbine Rifle Scope
GiveWeaponComponentToPed(ped, 0x5EF9FEC4, 0x359B7AAE) --Combat Pistol Flashlight
GiveWeaponComponentToPed(ped, 0x1D073A89, 0x7BC4CDDC) --Pump Shotgun Flashlight
end
end
end)
Were should i put that in so it work? (sorry lol).