Advertisement
Guest User

interaction.lua

a guest
Jan 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.52 KB | None | 0 0
  1. LSPD = {
  2. {"WEAPON_PISTOL"},
  3. {"WEAPON_NIGHTSTICK"},
  4. {"WEAPON_STUNGUN"},
  5. {"WEAPON_Flashlight"},
  6. {"WEAPON_CarbineRifle"},
  7. {"WEAPON_PumpShotgun"},
  8. {"WEAPON_FIREEXTINGUISHER"},
  9. }
  10.  
  11. Sheriff = {
  12. {"WEAPON_PISTOL"},
  13. {"WEAPON_NIGHTSTICK"},
  14. {"WEAPON_STUNGUN"},
  15. {"WEAPON_Flashlight"},
  16. {"WEAPON_CarbineRifle"},
  17. {"WEAPON_PumpShotgun"},
  18. {"WEAPON_FIREEXTINGUISHER"},
  19. }
  20.  
  21. CHP = {
  22. {"WEAPON_PISTOL"},
  23. {"WEAPON_NIGHTSTICK"},
  24. {"WEAPON_STUNGUN"},
  25. {"WEAPON_Flashlight"},
  26. {"WEAPON_CarbineRifle"},
  27. {"WEAPON_PumpShotgun"},
  28. {"WEAPON_FIREEXTINGUISHER"},
  29. }
  30.  
  31. fire = {
  32. {"WEAPON_Hatchet"},
  33. {"WEAPON_PetrolCan"},
  34. {"WEAPON_Flashlight"},
  35. {"WEAPON_Flare"},
  36. {"WEAPON_Crowbar"},
  37. {"WEAPON_FIREEXTINGUISHER"},
  38. }
  39.  
  40. medic = {
  41. {"WEAPON_Hatchet"},
  42. {"WEAPON_PetrolCan"},
  43. {"WEAPON_Flashlight"},
  44. {"WEAPON_Flare"},
  45. {"WEAPON_Crowbar"},
  46. {"WEAPON_FIREEXTINGUISHER"},
  47. }
  48.  
  49. swat = {
  50. {"WEAPON_PISTOL"},
  51. {"WEAPON_NIGHTSTICK"},
  52. {"WEAPON_STUNGUN"},
  53. {"WEAPON_Flashlight"},
  54. {"WEAPON_CarbineRifle"},
  55. {"WEAPON_PumpShotgun"},
  56. {"WEAPON_SmokeGrenade"},
  57. {"WEAPON_FIREEXTINGUISHER"},
  58. }
  59.  
  60.  
  61. Citizen.CreateThread(function() -- Ooooh, warmenu time :D
  62. local items = { "LSPD", "Sheriff", "CHP", "Fire", "Medic", "SWAT"}
  63. local currentItemIndex = 1
  64. local selectedItemIndex = 1
  65. local checkbox = true
  66.  
  67. WarMenu.CreateMenu('loadout', 'Loadout Menu')
  68. WarMenu.SetSubTitle("loadout", "Loadout Menu")
  69.  
  70.  
  71. while true do
  72.  
  73.  
  74. if WarMenu.IsMenuOpened('loadout') then
  75. if WarMenu.ComboBox('Loadout', items, currentItemIndex, selectedItemIndex, function(currentIndex, selectedIndex)
  76. currentItemIndex = currentIndex
  77. selectedItemIndex = selectedIndex
  78.  
  79. -- Do your stuff here if current index was changed (don't forget to check it)
  80. end) then
  81. -- Do your stuff here if current item was activated
  82.  
  83. elseif WarMenu.Button("Set Loadout") then
  84. if selectedItemIndex == 1 then
  85. setloadout(1) -- Functions cause its less ugly (not really but kinda)
  86. elseif selectedItemIndex == 2 then
  87. setloadout(2)
  88. elseif selectedItemIndex == 3 then
  89. setloadout(3)
  90. elseif selectedItemIndex == 4 then
  91. setloadout(4)
  92. elseif selectedItemIndex == 5 then
  93. setloadout(5)
  94. elseif selectedItemIndex == 6 then
  95. setloadout(6)
  96. end
  97. end
  98.  
  99. WarMenu.Display()
  100. elseif IsControlJustReleased(0, 244) then --M by default
  101. --WarMenu.OpenMenu('loadout')
  102. end
  103.  
  104. Citizen.Wait(0)
  105. end
  106. end)
  107.  
  108. RegisterCommand("loadouts", function()
  109. WarMenu.OpenMenu('loadout') --Added a comand to stop any accidental key pressin'
  110. end, false)
  111.  
  112. function setloadout(loadoutnum) -- Seriously, this fucking code is ugly, its what i get for spending like 1 hr on it but it works :P
  113. local player = PlayerPedId()
  114. DoScreenFadeOut(1000)
  115. Citizen.Wait(1000)
  116. RemoveAllPedWeapons(PlayerPedId(), 0)
  117. if loadoutnum == 1 then
  118. RequestModel("s_m_y_cop_01")
  119. while not HasModelLoaded("s_m_y_cop_01") do
  120. Citizen.Wait(0)
  121. end
  122. SetPlayerModel(PlayerId(), GetHashKey("s_m_y_cop_01"))
  123. for k, w in pairs(LSPD) do
  124. GiveWeaponToPed(GetPlayerPed(-1), w[1], 1000, false, false)
  125. end
  126. elseif loadoutnum == 2 then
  127. RequestModel("s_m_y_sheriff_01")
  128. while not HasModelLoaded("s_m_y_sheriff_01") do
  129. Citizen.Wait(0)
  130. end
  131. SetPlayerModel(PlayerId(), GetHashKey("s_m_y_sheriff_01"))
  132. for k, w in pairs(Sheriff) do
  133. GiveWeaponToPed(GetPlayerPed(-1), w[1], 1000, false, false)
  134. end
  135. elseif loadoutnum == 3 then
  136. RequestModel("s_m_y_hwaycop_01")
  137. while not HasModelLoaded("s_m_y_hwaycop_01") do
  138. Citizen.Wait(0)
  139. end
  140. SetPlayerModel(PlayerId(), GetHashKey("s_m_y_hwaycop_01"))
  141. for k, w in pairs(CHP) do
  142. GiveWeaponToPed(GetPlayerPed(-1), w[1], 1000, false, false)
  143. end
  144. elseif loadoutnum == 4 then
  145. RequestModel("s_m_y_fireman_01")
  146. while not HasModelLoaded("s_m_y_fireman_01") do
  147. Citizen.Wait(0)
  148. end
  149. SetPlayerModel(PlayerId(), GetHashKey("s_m_y_fireman_01"))
  150. for k, w in pairs(fire) do
  151. GiveWeaponToPed(GetPlayerPed(-1), w[1], 1000, false, false)
  152. end
  153. elseif loadoutnum == 5 then
  154. RequestModel("s_m_m_paramedic_01")
  155. while not HasModelLoaded("s_m_m_paramedic_01") do
  156. Citizen.Wait(0)
  157. end
  158. SetPlayerModel(PlayerId(), GetHashKey("s_m_m_paramedic_01"))
  159. for k, w in pairs(medic) do
  160. GiveWeaponToPed(GetPlayerPed(-1), w[1], 1000, false, false)
  161. end
  162. elseif loadoutnum == 6 then
  163. RequestModel("s_m_y_swat_01")
  164. while not HasModelLoaded("s_m_y_swat_01") do
  165. Citizen.Wait(0)
  166. end
  167. SetPlayerModel(PlayerId(), GetHashKey("s_m_y_swat_01"))
  168. for k, w in pairs(swat) do
  169. GiveWeaponToPed(GetPlayerPed(-1), w[1], 1000, false, false)
  170. end
  171. end
  172. SetCurrentPedWeapon(PlayerPedId(), "WEAPON_UNARMED", true)
  173. Citizen.Wait(500)
  174. DoScreenFadeIn(1000)
  175. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement