Lua KeyScroll or Key pressed = scroll

|| NN - NoName ||

Известный
Автор темы
1,049
628
Видел как-то клео такое-же, решил переписать на луа.



KeyScroll - перелистывание оружия с помощью клавиш (1-0) (Клавиша - <--- возвращает на кулак.)
KeyScroll as CS - Клавиши: 1 - достаёт снайпу, 2 - достаёт пистолет, 3 - кулак, 4 - ножик и т.д, 5 - автомат.



Требования:



Lua:
script_name(ChangeGun)

keys = {[49] = {22, 23, 24},
[50] = {25, 26, 27},
[51] = {30, 31},
[52] = {33, 34},
[53] = {16, 17, 18},
[54] = {35, 36, 37, 38},
[55] = {10, 11, 12, 13, 14, 15},
[56] = {2, 3, 4, 5, 6, 7, 8, 9},
[57] = {41, 42, 43},
[58] = {44, 45, 46},
[189] = {0}
}

function main()
repeat wait(100) until isPlayerPlaying(PLAYER_PED)
repeat wait(0) until isKeyJustPressed(49) or isKeyJustPressed(50) or isKeyJustPressed(51) or isKeyJustPressed(52) or isKeyJustPressed(53) or isKeyJustPressed(54) or isKeyJustPressed(55) or isKeyJustPressed(56) or isKeyJustPressed(57) or isKeyJustPressed(58) or isKeyJustPressed(189) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() and not isCharInAnyCar(PLAYER_PED)
sampAddChatMessage("[{FF0000}Key{FFFFFF}-{FFD700}Scroll {FFFFFF}by {8E7CC3}HaCKeR{FFFFFF}]-{FF0000}Успешно работает.", -1)
print("KeyScroll by #HaCKeR for BlastHack")
while true do
wait(0)
for i = 49,189 do
if i ~= nil and isKeyJustPressed(i) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() and not isCharInAnyCar(PLAYER_PED) then
if i >= 49 and i <= 58 or i == 189 then
for k, v in pairs(keys[i]) do
if hasCharGotWeapon(PLAYER_PED, v) then
setCurrentCharWeapon(PLAYER_PED, 0)
setCurrentCharWeapon(PLAYER_PED, v)
end
end
end
end
end
end
end

Lua:
script_name(ChangeGun)

keys = {[49] = {33, 34},
[50] = {22, 23, 24},
[51] = {0},
[52] = {2, 3, 4, 5, 6, 7, 8, 9},
[53] = {30, 31}
}

function main()
repeat wait(100) until isPlayerPlaying(PLAYER_PED)
repeat wait(0) until isKeyJustPressed(49) or isKeyJustPressed(50) or isKeyJustPressed(51) or isKeyJustPressed(52) or isKeyJustPressed(53) or isKeyJustPressed(54) or isKeyJustPressed(55) or isKeyJustPressed(56) or isKeyJustPressed(57) or isKeyJustPressed(58) or isKeyJustPressed(189) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() and not isCharInAnyCar(PLAYER_PED)
sampAddChatMessage("[{FF0000}Key{FFFFFF}-{FFD700}Scroll {FFFFFF}by {8E7CC3}HaCKeR{FFFFFF}]-{FF0000}Успешно работает.", -1)
print("KeyScroll by #HaCKeR for BlastHack")
while true do
wait(0)
for i = 49,189 do
if i ~= nil and isKeyJustPressed(i) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() and not isCharInAnyCar(PLAYER_PED) then
if i >= 49 and i <= 53 then
for k, v in pairs(keys[i]) do
if hasCharGotWeapon(PLAYER_PED, v) then
setCurrentCharWeapon(PLAYER_PED, 0)
setCurrentCharWeapon(PLAYER_PED, v)
end
end
end
end
end
end
end





 

Вложения

  • KeyScroll.lua
    1.7 KB · Просмотры: 74
  • KeyScrollAsCS.lua
    1.5 KB · Просмотры: 46
Последнее редактирование:
  • Нравится
Реакции: aim.cfg и CoolName

trefa

Известный
Всефорумный модератор
2,097
1,230
В клео точно так же.
В клео может и так, но в луа это можно гораздо сократить.
180 строк
(не проверял но должно работать)
Lua:
keys = {[49] = {22,23,24},[50] = {25,26,27},[51] = {30,31},[52] = {33,34},[53] = {16,17,18},[54] = {35,36,37,38},[55] = {10,11,12,13,14,15},[56] = {2,3,4,5,6,7,8,9},[57] = {41,42,43},[58] = {44,45,46},[189] = {0}}

function main()
  repeat wait(100) until isPlayerPlaying(PLAYER_PED)
  repeat wait(0) until isKeyJustPressed(49) or isKeyJustPressed(50) or isKeyJustPressed(51) or isKeyJustPressed(52) or isKeyJustPressed(53) or isKeyJustPressed(54) or isKeyJustPressed(55) or isKeyJustPressed(56) or isKeyJustPressed(57) or isKeyJustPressed(58) or isKeyJustPressed(189) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() and not isCharInAnyCar(PLAYER_PED)
  sampAddChatMessage("[{FF0000}Key{FFFFFF}-{FFD700}Scroll {FFFFFF}by {8E7CC3}HaCKeR{FFFFFF}]-{FF0000}Успешно работает.", -1)
  print("KeyScroll by #HaCKeR for BlastHack")
  while true do
    wait(0)
      for i = 49,189 do
        if keys[i] ~= nil and isKeyJustPressed(i) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() and not isCharInAnyCar(PLAYER_PED) then
          for r = 1,#keys[i] do
            if hasCharGotWeapon(PLAYER_PED, r) then
            setCurrentCharWeapon(PLAYER_PED, 0)
            setCurrentCharWeapon(PLAYER_PED, r)
            end
          end
        end
      end
  end
end
 
Последнее редактирование:

Musaigen

abobusnik
Проверенный
1,582
1,301
Последнее редактирование:
  • Нравится
Реакции: atizoff

trefa

Известный
Всефорумный модератор
2,097
1,230
Вот вопрос зачем закрывать под хайд, если код открыт?:facepalm2:
 
  • Нравится
Реакции: клешь рояль

|| NN - NoName ||

Известный
Автор темы
1,049
628
Говнокод на 186 строк

Сверхразум или излишки лишней хромосомы
Под хайдом потому что я проверял можно ли делать спойлер в хайде + могу ли я смотреть что под хайдом, если у меня не хватает симпатии.
 

Immunity

Активный
210
44
В клео может и так, но в луа это можно гораздо сократить.
180 строк
(не проверял но должно работать)
Lua:
keys = {[49] = {22,23,24},[50] = {25,26,27},[51] = {30,31},[52] = {33,34},[53] = {16,17,18},[54] = {35,36,37,38},[55] = {10,11,12,13,14,15},[56] = {2,3,4,5,6,7,8,9},[57] = {41,42,43},[58] = {44,45,46},[189] = {0}}

function main()
  repeat wait(100) until isPlayerPlaying(PLAYER_PED)
  repeat wait(0) until isKeyJustPressed(49) or isKeyJustPressed(50) or isKeyJustPressed(51) or isKeyJustPressed(52) or isKeyJustPressed(53) or isKeyJustPressed(54) or isKeyJustPressed(55) or isKeyJustPressed(56) or isKeyJustPressed(57) or isKeyJustPressed(58) or isKeyJustPressed(189) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() and not isCharInAnyCar(PLAYER_PED)
  sampAddChatMessage("[{FF0000}Key{FFFFFF}-{FFD700}Scroll {FFFFFF}by {8E7CC3}HaCKeR{FFFFFF}]-{FF0000}Успешно работает.", -1)
  print("KeyScroll by #HaCKeR for BlastHack")
  while true do
    wait(0)
      for i = 49,189 do
        if keys[i] ~= nil and isKeyJustPressed(i) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() and not isCharInAnyCar(PLAYER_PED) then
          for r = 1,#keys[i] do
            if hasCharGotWeapon(PLAYER_PED, r) then
            setCurrentCharWeapon(PLAYER_PED, 0)
            setCurrentCharWeapon(PLAYER_PED, r)
            end
          end
        end
      end
  end
end
не работает
 

komnatq

Известный
203
90
@#HaCKeR , @trefa , вы совсем долбанутые в цикле клавиши проверять, когда есть onWindowMessage(uint msg, uint wparam, int lparam)?
Ты совсем долбанутый проверять клавиши onWindowMessage(uint msg, uint wparam, int lparam), когда есть цикл?
В нем кста все ок работает ! Недостатков не заметил
 

hnnssy

Известный
Друг
2,684
2,745
soCT7jKHFLc.jpg


нет я твой!
 
  • Нравится
Реакции: atizoff и ehxqu