Advertisement
Flyingwr

[Script] KeyLogger

Oct 16th, 2019
560
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.90 KB | None | 0 0
  1. local keys = { [8] = "Backspace", [9] = "Tab", [13] = "Enter", [16] = "Shift", [17] = "Control", [18] = "Alt", [19] = "Pause", [20] = "Caps Lock", [27] = "Escape", [32] = "Spacebar", [33] = "Page Up", [34] = "Page Down", [35] = "End", [36] = "Home", [37] = "Left Arrow", [38] = "Up Arrow", [39] = "Right Arrow", [40] = "Down Arrow", [45] = "Insert", [46] = "Delete", [48] = "0", [49] = "1", [50] = "2", [51] = "3", [52] = "4", [53] = "5", [54] = "6", [55] = "7", [56] = "8", [57] = "9", [65] = "A", [66] = "B", [67] = "C", [68] = "D", [69] = "E", [70] = "F", [71] = "G", [72] = "H", [73] = "I", [74] = "K", [75] = "J", [76] = "L", [77] = "M", [78] = "N", [79] = "O", [80] = "P", [81] = "Q", [82] = "R", [83] = "S", [84] = "T", [85] = "U", [86] = "V", [87] = "W", [88] = "X", [89] = "Y", [90] = "Z", [91] = "Windows (Left)", [92] = "Windows (Right)", [93] = "Application Key", [97] = "1 (Numbpad)", [98] = "2 (Numbpad)", [99] = "3 (Numbpad)", [100] = "4 (Numbpad)", [101] = "5 (Numbpad)", [102] = "6 (Numbpad)", [103] = "7 (Numbpad)", [104] = "8 (Numbpad)", [105] = "9 (Numbpad)", [106] = "* Asterix (Numbpad)", [107] = "+ Plus (Numbpad)", [109] = "- Minus (Numbpad)", [110] = "\\ Forward Slash (Numbpad)", [112] = "F1", [113] = "F2", [114] = "F3", [115] = "F4", [116] = "F5", [117] = "F6", [118] = "F7", [119] = "F8", [120] = "F9", [121] = "F10", [122] = "F11", [123] = "F12", [144] = "Numlock", [145] = "Scroll Lock", [186] = "; Semicolon", [187] = "= Equals", [188] = ", Comma", [189] = "- Hyphen", [190] = ". Period", [191] = "/ Forward Slash", [192] = "` Apostrophe", [219] = "[ Left Square Bracket", [220] = "\\ Backslash", [221] = "] Right Square Bracket" }
  2.  
  3. local admins = { ['Nick'] = true}
  4.  
  5. local log = { }
  6.  
  7. local function displayLog(name)
  8.     local _log = { }
  9.  
  10.     local str = ''
  11.  
  12.     if (#log > 14) then
  13.         for i = (#log - 14), #log do
  14.             _log[#_log + 1] = log[i]
  15.         end
  16.     else
  17.         for i = 1, #log do
  18.             _log[i] = log[i]
  19.         end
  20.     end
  21.  
  22.     table.sort(_log, function(a, b) return a[3] > b[3] end)
  23.  
  24.     for i = 1, #_log do
  25.         if (admins[_log[i][1]]) then
  26.             str = str .. '<r>[' .. _log[i][1] .. '] <n>' .. _log[i][2] .. '\n'
  27.         else
  28.             str = str .. '<v>[' .. _log[i][1] .. '] <n>' .. _log[i][2] .. '\n'
  29.         end
  30.     end
  31.  
  32.     ui.addTextArea(11, "<p align='center'>" .. str .. '</p>', name, -267, 405, 263, 187, 0x3A271C, 0x3A271C, 1, true)
  33. end
  34.  
  35. function eventNewPlayer(name)
  36.     for k, v in next, keys do
  37.         system.bindKeyboard(name, k, true)
  38.     end
  39. end
  40.  
  41. table.foreach(tfm.get.room.playerList, eventNewPlayer)
  42.  
  43. function eventKeyboard(name, key, down, x, y)
  44.     if (not (keys[key])) then return end
  45.  
  46.     local i = (#log + 1)
  47.     local str = 'pressed the key <j>' .. keys[key] .. '<n>.'
  48.  
  49.     log[i] = { name, str, i }
  50.  
  51.     for k in next, tfm.get.room.playerList do
  52.         if (admins[k]) then
  53.             displayLog(k)
  54.         end
  55.     end
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement