Advertisement
ticzz

WeaponID_WeaponTypeID_checks_for_further_usage.lua

Jul 2nd, 2023 (edited)
1,068
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.87 KB | None | 0 0
  1. local get = gui.GetValue
  2. local localplayer = entities.GetLocalPlayer()
  3.  
  4. local weaponIDlist = {
  5.     taser = { 31 },
  6.     pistol = { usp = 61, cz = 63, duel = 2, fs = 3, g18 = 4, p2000 = 32, p250 = 36, tek9 = 30 },
  7.     hpistol = { deg = 1, rev = 64 },
  8.     smg = { ump = 24, mp5 = 23, mp9 = 34, p90 = 19, mp7 = 33, pp = 26, mac = 17 },
  9.     shotgun = { sawedoff = 29, mag7 = 27, nova = 35, xm = 25 },
  10.     rifle = { ak = 7, aug = 8, fam = 10, galil = 13, m4a1s = 60, m4a4 = 16, sg = 39 },
  11.     asniper = { scar = 38, g3sg1 = 11 },
  12.     scout = { 40 },
  13.     awp = { 9 },
  14.     lmg = { m249 = 14, negev = 28 },
  15.     grenades = { flashbang = 43, hegrenade = 44, smokegrenade = 45, molotov = 46, decoy = 47, incgrenade = 48 },
  16.     knives = { m9 = 508, bayo = 500, ct_knife = 42, t_knife = 59, classic = 503, flip = 505, gut = 506, karam = 507, huntsman = 509, falch = 512, bowie = 514,
  17.             butterfly = 515, shadow = 516, para = 517, survival = 518, ursus = 519, navaja = 520, nomad = 521, stilleto = 522, taon = 523, skeleton = 525 },
  18. }
  19.  
  20. -- include filter for items by weapon types
  21. callbacks.Register("Draw", "Indicators", function()
  22.     if not localplayer then
  23.         return
  24.     end -- if no local player stop/return here
  25.  
  26.     local act_wpn = localplayer:GetPropEntity("m_hActiveWeapon")                            -- get the current weapon of local player
  27.     local act_gunid = act_wpn:GetWeaponID()                                     -- check for weaponID of current weapon
  28.     local act_guntype = act_wpn:GetWeaponType()                                 -- check for the weapontypeID of current weapon
  29.  
  30.     -- filter weapongroups by weapontype IDs usage                                  -- exclude full groups by weapontypeIDs, see ReturnList below
  31.     local is_Utility = act_guntype == "0" or "9" or "7" or "11" or "nil"                            -- If current gears/items typeID matches one of those, it means
  32.     if is_Utility then return end                                           -- you are holding any kind of utility, so stop script and return again
  33.  
  34.     -- this is just an example of weapon IDs usage
  35.     local hc = get("rbot.hitscan.accuracy." .. weaponIDlist[act_gunid] .. ".hitchance")
  36.     local md = get("rbot.hitscan.accuracy." .. weaponIDlist[act_gunid] .. ".mindmg")
  37.  
  38.     draw.TextShadow(10, 555, "Hitchance of the " .. weaponIDlist[act_gunid] .. " is " .. hc)
  39.     draw.TextShadow(10, 565, "MinDamage of the " .. weaponIDlist[act_gunid] .. " is " .. md)
  40. end)
  41.  
  42. --[[####################################################################################################################--
  43.             Weapontype IDs ReturnList   - to exclude/filter full weapongroups from script by weapontype ids
  44.        
  45.     WEAPONTYPE_UNKNOWN = -1 | WEAPONTYPE_KNIFE = 0 | WEAPONTYPE_PISTOL = 1 | WEAPONTYPE_SUBMACHINEGUN = 2 | WEAPONTYPE_RIFLE = 3 | WEAPONTYPE_SHOTGUN = 4 |
  46.         WEAPONTYPE_SNIPER_RIFLE = 5 | WEAPONTYPE_MACHINEGUN = 6 | WEAPONTYPE_C4 = 7 | WEAPONTYPE_TASER = 8 | WEAPONTYPE_GRENADE = 9 | WEAPONTYPE_HEALTHSHOT = 11   
  47.  
  48. --####################################################################################################################--]]
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement