SHARE
TWEET

Untitled

a guest Jun 18th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local weapons = {
  2.     'WEAPON_KNIFE',
  3.     'WEAPON_NIGHTSTICK',
  4.     'WEAPON_HAMMER',
  5.     'WEAPON_BAT',
  6.     'WEAPON_GOLFCLUB',
  7.     'WEAPON_CROWBAR',
  8.     'WEAPON_BOTTLE',
  9.     'WEAPON_DAGGER',
  10.     'WEAPON_HATCHET',
  11.     'WEAPON_MACHETE',
  12.     'WEAPON_SWITCHBLADE',
  13.     'WEAPON_BATTLEAXE',
  14.     'WEAPON_POOLCUE',
  15.     'WEAPON_WRENCH',
  16.     'WEAPON_PISTOL',
  17.     'WEAPON_COMBATPISTOL',
  18.     'WEAPON_APPISTOL',
  19.     'WEAPON_PISTOL50',
  20.     'WEAPON_REVOLVER',
  21.     'WEAPON_SNSPISTOL',
  22.     'WEAPON_HEAVYPISTOL',
  23.     'WEAPON_VINTAGEPISTOL',
  24.     'WEAPON_MICROSMG',
  25.     'WEAPON_SMG',
  26.     'WEAPON_ASSAULTSMG',
  27.     'WEAPON_MINISMG',
  28.     'WEAPON_MACHINEPISTOL',
  29.     'WEAPON_COMBATPDW',
  30.     'WEAPON_PUMPSHOTGUN',
  31.     'WEAPON_SAWNOFFSHOTGUN',
  32.     'WEAPON_ASSAULTSHOTGUN',
  33.     'WEAPON_BULLPUPSHOTGUN',
  34.     'WEAPON_HEAVYSHOTGUN',
  35.     'WEAPON_ASSAULTRIFLE',
  36.     'WEAPON_CARBINERIFLE',
  37.     'WEAPON_ADVANCEDRIFLE',
  38.     'WEAPON_SPECIALCARBINE',
  39.     'WEAPON_BULLPUPRIFLE',
  40.     'WEAPON_COMPACTRIFLE',
  41.     'WEAPON_MG',
  42.     'WEAPON_COMBATMG',
  43.     'WEAPON_GUSENBERG',
  44.     'WEAPON_SNIPERRIFLE',
  45.     'WEAPON_HEAVYSNIPER',
  46.     'WEAPON_MARKSMANRIFLE',
  47.     'WEAPON_GRENADELAUNCHER',
  48.     'WEAPON_RPG',
  49.     'WEAPON_STINGER',
  50.     'WEAPON_MINIGUN',
  51.     'WEAPON_GRENADE',
  52.     'WEAPON_STICKYBOMB',
  53.     'WEAPON_SMOKEGRENADE',
  54.     'WEAPON_BZGAS',
  55.     'WEAPON_MOLOTOV',
  56.     'WEAPON_DIGISCANNER',
  57.     'WEAPON_FIREWORK',
  58.     'WEAPON_MUSKET',
  59.     'WEAPON_STUNGUN',
  60.     'WEAPON_HOMINGLAUNCHER',
  61.     'WEAPON_PROXMINE',
  62.     'WEAPON_FLAREGUN',
  63.     'WEAPON_MARKSMANPISTOL',
  64.     'WEAPON_RAILGUN',
  65.     'WEAPON_DBSHOTGUN',
  66.     'WEAPON_AUTOSHOTGUN',
  67.     'WEAPON_COMPACTLAUNCHER',
  68.     'WEAPON_PIPEBOMB',
  69.     'WEAPON_DOUBLEACTION',
  70. }
  71.  
  72. local holstered = true
  73. local canfire = true
  74. local currWeapon = nil
  75.  
  76. Citizen.CreateThread(function()
  77.     while true do
  78.         Citizen.Wait(0)
  79.         if DoesEntityExist( GetPlayerPed(-1) ) and not IsEntityDead( GetPlayerPed(-1) ) and not IsPedInAnyVehicle(PlayerPedId(-1), true) then
  80.             if currWeapon ~= GetSelectedPedWeapon(GetPlayerPed(-1)) then
  81.                 pos = GetEntityCoords(GetPlayerPed(-1), true)
  82.                 rot = GetEntityHeading(GetPlayerPed(-1))
  83.  
  84.                 local newWeap = GetSelectedPedWeapon(GetPlayerPed(-1))
  85.                 SetCurrentPedWeapon(GetPlayerPed(-1), currWeapon, true)
  86.                 loadAnimDict( "reaction@intimidation@1h" )
  87.  
  88.                 if CheckWeapon(newWeap) then
  89.                     if holstered then
  90.                         print(1)
  91.                         canFire = false
  92.                         TaskPlayAnimAdvanced(GetPlayerPed(-1), "reaction@intimidation@1h", "intro", GetEntityCoords(GetPlayerPed(-1), true), 0, 0, rot, 8.0, 3.0, -1, 50, 0, 0, 0)
  93.                         Citizen.Wait(1000)
  94.                         SetCurrentPedWeapon(GetPlayerPed(-1), newWeap, true)
  95.                         currWeapon = newWeap
  96.                         Citizen.Wait(2000)
  97.                         ClearPedTasks(GetPlayerPed(-1))
  98.                         holstered = false
  99.                         canFire = true
  100.                     elseif newWeap ~= currWeapon then
  101.                         canFire = false
  102.                         TaskPlayAnimAdvanced(GetPlayerPed(-1), "reaction@intimidation@1h", "outro", GetEntityCoords(GetPlayerPed(-1), true), 0, 0, rot, 8.0, 3.0, -1, 50, 0, 0, 0)
  103.                         Citizen.Wait(1600)
  104.                         SetCurrentPedWeapon(GetPlayerPed(-1), GetHashKey('WEAPON_UNARMED'), true)
  105.                         --ClearPedTasks(GetPlayerPed(-1))
  106.                         TaskPlayAnimAdvanced(GetPlayerPed(-1), "reaction@intimidation@1h", "intro", GetEntityCoords(GetPlayerPed(-1), true), 0, 0, rot, 8.0, 3.0, -1, 50, 0, 0, 0)
  107.                         Citizen.Wait(1000)
  108.                         SetCurrentPedWeapon(GetPlayerPed(-1), newWeap, true)
  109.                         currWeapon = newWeap
  110.                         Citizen.Wait(2000)
  111.                         ClearPedTasks(GetPlayerPed(-1))
  112.                         holstered = false
  113.                         canFire = true
  114.                     end
  115.                 else
  116.                     if not holstered and CheckWeapon(currWeapon) then
  117.                         print(3)
  118.                         canFire = false
  119.                         TaskPlayAnimAdvanced(GetPlayerPed(-1), "reaction@intimidation@1h", "outro", GetEntityCoords(GetPlayerPed(-1), true), 0, 0, rot, 8.0, 3.0, -1, 50, 0, 0, 0)
  120.                         Citizen.Wait(1600)
  121.                         SetCurrentPedWeapon(GetPlayerPed(-1), GetHashKey('WEAPON_UNARMED'), true)
  122.                         ClearPedTasks(GetPlayerPed(-1))
  123.                         SetCurrentPedWeapon(GetPlayerPed(-1), newWeap, true)
  124.                         holstered = true
  125.                         canFire = true
  126.                         currWeapon = newWeap
  127.                     else
  128.                         print(4)
  129.                         SetCurrentPedWeapon(GetPlayerPed(-1), newWeap, true)
  130.                         holstered = false
  131.                         canFire = true
  132.                         currWeapon = newWeap
  133.                     end
  134.                 end
  135.             end
  136.         end
  137.     end
  138. end)
  139.  
  140. Citizen.CreateThread(function()
  141.     while true do
  142.         Citizen.Wait(0)
  143.         if not canFire then
  144.             DisableControlAction(0, 25, true)
  145.             DisablePlayerFiring(GetPlayerPed(-1), true)
  146.         end
  147.     end
  148. end)
  149.  
  150. function CheckWeapon(newWeap)
  151.     for i = 1, #weapons do
  152.         if GetHashKey(weapons[i]) == newWeap then
  153.             return true
  154.         end
  155.     end
  156.     return false
  157. end
  158.  
  159. function loadAnimDict(dict)
  160.     while (not HasAnimDictLoaded(dict)) do
  161.         RequestAnimDict(dict)
  162.         Citizen.Wait(5)
  163.     end
  164. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top