Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. script_name('bStatsShortcuts')
  2. script_author('Nasif')
  3.  
  4. local SE = require 'lib.samp.events'
  5. specID = -1
  6.  
  7. keyCombo = 164 -- ALT
  8.  
  9. keySilence = 49 -- Key 1
  10. keyDeagle = 50 -- Key 2
  11. keyShotgun = 51 -- Key 3
  12. keySawn = 52 -- Key 4
  13. keySpas = 53 -- Key 5
  14. keyUzi = 54 -- Key 6
  15. keyMp5= 55 -- Key 7
  16. keyTec9= 56 -- Key 8
  17. keyAk = 57 -- Key 9
  18. keyM4 = 48 -- Key 0
  19. keySniper = 189 -- Key -
  20. keyMini = 187 -- Key +
  21.  
  22. isSpec = false
  23.  
  24. function main()
  25. repeat wait(0) until isSampAvailable()
  26.  
  27. X, Y = getScreenResolution()
  28. font = renderCreateFont('Ubuntu Mono', 10, FCR_BORDER + FCR_BOLD)
  29.  
  30. while true do
  31. wait (0)
  32.  
  33. if keycheck({k = {keyCombo, keySilence}, t = {'KeyDown', 'KeyPressed'}}) then
  34. sampSendChat(string.format("/bstats %d 23", specID))
  35. end
  36. if keycheck({k = {keyCombo, keyDeagle}, t = {'KeyDown', 'KeyPressed'}}) then
  37. sampSendChat(string.format("/bstats %d 24", specID))
  38. end
  39. if keycheck({k = {keyCombo, keyShotgun}, t = {'KeyDown', 'KeyPressed'}}) then
  40. sampSendChat(string.format("/bstats %d 25", specID))
  41. end
  42. if keycheck({k = {keyCombo, keySawn}, t = {'KeyDown', 'KeyPressed'}}) then
  43. sampSendChat(string.format("/bstats %d 26", specID))
  44. end
  45. if keycheck({k = {keyCombo, keySpas}, t = {'KeyDown', 'KeyPressed'}}) then
  46. sampSendChat(string.format("/bstats %d 27", specID))
  47. end
  48. if keycheck({k = {keyCombo, keyUzi}, t = {'KeyDown', 'KeyPressed'}}) then
  49. sampSendChat(string.format("/bstats %d 28", specID))
  50. end
  51. if keycheck({k = {keyCombo, keyMp5}, t = {'KeyDown', 'KeyPressed'}}) then
  52. sampSendChat(string.format("/bstats %d 29", specID))
  53. end
  54. if keycheck({k = {keyCombo, keyTec9}, t = {'KeyDown', 'KeyPressed'}}) then
  55. sampSendChat(string.format("/bstats %d 32", specID))
  56. end
  57. if keycheck({k = {keyCombo, keyAk}, t = {'KeyDown', 'KeyPressed'}}) then
  58. sampSendChat(string.format("/bstats %d 30", specID))
  59. end
  60. if keycheck({k = {keyCombo, keyM4}, t = {'KeyDown', 'KeyPressed'}}) then
  61. sampSendChat(string.format("/bstats %d 31", specID))
  62. end
  63. if keycheck({k = {keyCombo, keySniper}, t = {'KeyDown', 'KeyPressed'}}) then
  64. sampSendChat(string.format("/bstats %d 34", specID))
  65. end
  66. if keycheck({k = {keyCombo, keyMini}, t = {'KeyDown', 'KeyPressed'}}) then
  67. sampSendChat(string.format("/bstats %d 38", specID))
  68. end
  69.  
  70. if(isKeyDown(keyCombo) and isSpec) then
  71. renderFontDrawText(font, "Silence -> 1\nDeagle -> 2\nShotgun -> 3\nSawnOff -> 4\nSpas -> 5\nUzi -> 6\nMP5 -> 7\nTec9 -> 8\nAK47 -> 9\nSniper -> -\nMini -> +", 45, Y/2 + 100, 0xFFFFFFFF)
  72. end
  73. end
  74.  
  75. end
  76.  
  77. function SE.onTogglePlayerSpectating(state)
  78. isSpec = not isSpec
  79. end
  80.  
  81. local PressType = {KeyDown = isKeyDown, KeyPressed = wasKeyPressed}
  82.  
  83. function keycheck(k)
  84. local r = true
  85. for i = 1, #k.k do
  86. r = r and PressType[k.t[i]](k.k[i])
  87. end
  88. return r
  89. end
  90.  
  91. function SE.onSpectatePlayer(id, x)
  92. specID = id
  93. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement