MasterRex23

Stickykeys.lua

Sep 13th, 2023 (edited)
1,227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.87 KB | Gaming | 0 0
  1. --[[
  2.     stickyKeys.lua v 1.1
  3.         by
  4.     MarioChallengerX2
  5.  
  6.     --your hands are like glue to npcs!
  7.  
  8. --]]
  9.  
  10.  
  11.  
  12.  
  13. local SK = {}
  14.  
  15.  
  16. SK.stickymovementstate = true
  17.  
  18. SK.holdingtable = {}
  19.  
  20. SK.holdingtable[45] = true
  21. SK.holdingtable[31] = true
  22.  
  23.  
  24.  
  25.  
  26. function SK.onInitAPI()
  27.     registerEvent(SK, "onTick")
  28.     registerEvent(SK, "onStart")
  29. end
  30.  
  31. function SK.onTick()
  32.     for k, p in ipairs(Player.get()) do
  33.         local stickyitem = p.holdingNPC ~= nil and p.holdingNPC.isValid and SK.holdingtable[player.holdingNPC.id]
  34.         if SK.stickymovementstate == true then --this option does not auto hold run button for you.
  35.             if stickyitem then
  36.                 player:mem(0x62, FIELD_WORD, 10)
  37.             end
  38.         end
  39.         if SK.stickymovementstate == false then --this option will always have the run button held for you
  40.             if stickyitem then
  41.                 player.keys.run = KEYS_DOWN
  42.             end
  43.         end
  44.     end
  45. end
  46.  
  47.  
  48.  
  49. return SK
Tags: Library
Advertisement
Add Comment
Please, Sign In to add comment