Add new scripts called holsters

This commit is contained in:
KingMcDonalds
2023-04-30 16:05:33 -07:00
parent be1012a015
commit 40033d48b5
3 changed files with 97 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
client_script "client.lua"
+95
View File
@@ -0,0 +1,95 @@
-- Created by Deziel0495 and IllusiveTea --
-- NOTICE
-- This script is licensed under "No License". https://choosealicense.com/no-license/
-- You are allowed to: Download, Use and Edit the Script.
-- You are not allowed to: Copy, re-release, re-distribute it without our written permission.
--- DO NOT EDIT THIS
local holstered = true
-- RESTRICTED PEDS --
-- I've only listed peds that have a remote speaker mic, but any ped listed here will do the animations.
local skins = {
"mp_f_freemode_01",
"mp_m_freemode_01",
"copx2",
"markocop",
}
-- Add/remove weapon hashes here to be added for holster checks.
local weapons = {
"WEAPON_COMBATPISTOL",
"WEAPON_PISTOL",
"WEAPON_PISTOL_MK2",
"WEAPON_SIG",
"WEAPON_G17",
"WEAPON_GLOCK19X",
"WEAPON_GLOCK19X2",
"WEAPON_M1911A",
}
-- HOLSTER/UNHOLSTER PISTOL --
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local ped = PlayerPedId()
if DoesEntityExist( ped ) and not IsEntityDead( ped ) and not IsPedInAnyVehicle(PlayerPedId(), true) and CheckSkin(ped) then
loadAnimDict( "rcmjosh4" )
loadAnimDict( "weapons@pistol@" )
if CheckWeapon(ped) then
if holstered then
TaskPlayAnim(ped, "rcmjosh4", "josh_leadout_cop2", 8.0, 2.0, -1, 48, 10, 0, 0, 0 )
Citizen.Wait(130)
ClearPedTasks(ped)
holstered = false
end
--SetPedComponentVariation(ped, 9, 0, 0, 0)
elseif not CheckWeapon(ped) then
if not holstered then
TaskPlayAnim(ped, "weapons@pistol@", "aim_2_holster", 8.0, 2.0, -1, 48, 10, 0, 0, 0 )
Citizen.Wait(500)
ClearPedTasks(ped)
holstered = true
end
--SetPedComponentVariation(ped, 9, 1, 0, 0)
end
end
end
end)
-- DO NOT REMOVE THESE! --
function CheckSkin(ped)
for i = 1, #skins do
if GetHashKey(skins[i]) == GetEntityModel(ped) then
return true
end
end
return false
end
function CheckWeapon(ped)
for i = 1, #weapons do
if GetHashKey(weapons[i]) == GetSelectedPedWeapon(ped) then
return true
end
end
return false
end
function DisableActions(ped)
DisableControlAction(1, 140, true)
DisableControlAction(1, 141, true)
DisableControlAction(1, 142, true)
DisableControlAction(1, 37, true) -- Disables INPUT_SELECT_WEAPON (TAB)
DisablePlayerFiring(ped, true) -- Disable weapon firing
end
function loadAnimDict( dict )
while ( not HasAnimDictLoaded( dict ) ) do
RequestAnimDict( dict )
Citizen.Wait( 0 )
end
end
+1
View File
@@ -182,6 +182,7 @@ start AIBackup
start cvpiv8
start r_pepperspray
start scully_sling
start holster
#[-----Discord Perms-----]
start Discord-Presence