Помощь Как изменить клавишу активации в Lua?

Тема в разделе "Lua, SF, ASI Плагины", создана пользователем Кислый, 12 ноя 2016.

  1. Кислый

    Кислый Господь Модератор

    Сообщения:
    1.153
    Симпатии:
    220
    Баллы:
    63
    Для начала открываем луа скрипт в notepad+ ( Или любой текстовый редактор )
    Я нашёл RenderHack
    Код:
    script_name('RenderHack')
    script_author('ZeroXruS')
    script_version_number(5)
    script_version('5')
    script_dependencies('SAMPFUNCS', 'CLEO', 'SAMP')
    
    require 'lib.sampfuncs'
    require 'lib.moonloader'
    
    TRUE= 1
    FALSE= -1
    SAMP_MAX_PLAYERS= 1004
    Menu= {}
    Menu.Cursor= {}
    Menu.Window= {}
    Menu.Position= {}
    Cheat= {}
    function main()
        if not isSampLoaded() or not isCleoLoaded() or not isSampfuncsLoaded() then return end
        while not isSampAvailable() do wait(100) end
       
        Menu.Open= FALSE
        Menu.Cursor.X= 0
        Menu.Cursor.Y= 0
        Menu.Cursor.Open= 0
        Menu.Window.X= 0
        Menu.Window.Y= 0
        Menu.Window.Pause= 0
        Menu.Position.X= 0
        Menu.Position.Y= 0
        Menu.d3dFont= renderCreateFont('Arial', 11, FCR_BORDER)
       
        Cheat.Enabled= FALSE
        Cheat.d3dFont= renderCreateFont('Arial', 7, FCR_BORDER)
       
        Cheat.A_Teleport= TRUE
        Cheat.A_Bullet= FALSE
        Cheat.A_FakeKill= FALSE
        Cheat.B_FakeKill= 0
       
        Cheat.TextTeleport= renderGetFontDrawTextLength(Menu.d3dFont, "Teleport")
        Cheat.TextBullet= renderGetFontDrawTextLength(Menu.d3dFont, "Bullet")
        Cheat.TextFakeKill= renderGetFontDrawTextLength(Menu.d3dFont, "FakeKill")
        Cheat.TextReconnect= renderGetFontDrawTextLength(Menu.d3dFont, "Reconnect")
        Cheat.TextNull= renderGetFontDrawTextLength(Menu.d3dFont, "Null")
       
        Menu.Lock= FALSE
       
        while true do
            wait(0)
           
            Menu.Cursor.X, Menu.Cursor.Y= getCursorPos()
            Menu.Window.X, Menu.Window.Y= getScreenResolution()
            Menu.Position.X= Menu.Window.X / 2 - 300 -- 600
            Menu.Position.Y= Menu.Window.Y / 2 - 200 -- 200
            Menu.Window.Pause= isPauseMenuActive()
            Menu.Cursor.Open= sampIsCursorActive()
           
            if isKeyDown(VK_CONTROL) then
                if Menu.Cursor.Open == false then sampToggleCursor(true) end
                Menu.Lock= TRUE
               
                if isKeyJustPressed(VK_1) then
                    Cheat.Enabled= Cheat.Enabled * FALSE
                    Menu.Open= FALSE
                end
            else if Menu.Lock == TRUE then
                sampToggleCursor(false)
                Menu.Open= FALSE
                Menu.Lock= FALSE
            end end
           
           
           
           
            if Menu.Window.Pause == false and Cheat.Enabled == TRUE then
               
                for ID= 0, SAMP_MAX_PLAYERS do
                if sampIsPlayerConnected(ID) then
                result, PLAYER_ACTOR= sampGetCharHandleBySampPlayerId(ID)
                if result then
                X, Y, Z= getOffsetFromCharInWorldCoords(PLAYER_ACTOR, 0.0, 0.0, 0.0)
                if isPointOnScreen(X, Y, Z, 0.0) then
                    x2, y2= convert3DCoordsToScreen(X, Y, Z)
                    local color= 0xFF000000
                    if Menu.Cursor.Open == true and Menu.Cursor.X > x2 and Menu.Cursor.X < x2 + 125 and Menu.Cursor.Y > y2 and Menu.Cursor.Y < y2 + 36 then
                        color= 0xFF1C1C1C
                        if isKeyJustPressed(VK_LBUTTON) then
                            if Cheat.A_Teleport == TRUE then setCharCoordinates(playerPed, X, Y+1.0, Z) end
                            if Cheat.A_Bullet == TRUE then
                                local selfX, selfY, selfZ= getOffsetFromCharInWorldCoords(playerPed, 0.0, 0.0, 0.0)
                                local struct = allocateMemory(40)
                                setStructElement(struct, 0, 1, 1)
                                setStructElement(struct, 1, 2, ID)
                                setStructElement(struct, 3, 4, selfX)
                                setStructElement(struct, 7, 4, selfY)
                                setStructElement(struct, 11, 4, selfZ)
                                setStructElement(struct, 15, 4, X)
                                setStructElement(struct, 19, 4, Y)
                                setStructElement(struct, 23, 4, Z)
                                setStructElement(struct, 27, 4, 0.0)
                                setStructElement(struct, 31, 4, 0.0)
                                setStructElement(struct, 35, 4, 0.5)
                                setStructElement(struct, 39, 1, getCurrentCharWeapon(PLAYER_ACTOR))
                                sampSendBulletData(struct)
                                freeMemory(struct)
                            end
                            if Cheat.A_FakeKill == TRUE then
                                if Cheat.B_FakeKill == 100 then sampSendDeathByPlayer(ID, getCurrentCharWeapon(PLAYER_ACTOR)) sampSendSpawn()
                                else sampSendDeathByPlayer(ID, Cheat.B_FakeKill) sampSendSpawn() end
                            end
                        end
                    end
                    local NICK= sampGetPlayerNickname(ID)
                    renderDrawBox(x2, y2, 125, 12, sampGetPlayerColor(ID))
                    renderFontDrawText(Cheat.d3dFont, string.format('%s[%d]', NICK, ID), x2 + 2, y2 - 1, 0xFFFFFFFF)
                    renderDrawBox(x2, y2+12, 125, 26, color)
                    renderFontDrawText(Cheat.d3dFont, string.format('Health: %d', sampGetPlayerHealth(ID)), x2 + 2, y2 + 12, 0xFFFFFFFF)
                    renderFontDrawText(Cheat.d3dFont, string.format('Armour: %d', sampGetPlayerArmor(ID)), x2 + 2, y2 + 24, 0xFFFFFFFF)
                    if sampIsPlayerPaused(ID) then renderFontDrawText(Cheat.d3dFont, "AFK", x2 + 100, y2 + 24, 0xFFFF0000) end
                end
                end
                end
                end
               
               
               
               
               
               
                if renderDrawButton(Menu.d3dFont, "RenderHack by ZeroXruS", Menu.Window.X / 2 - 100, Menu.Window.Y - 20, 200, 20, Menu.Cursor.X, Menu.Cursor.Y, 0xFF1E90FF, 0xFF6959CD, 0xFFFFFFFF, 0xFFFFFFFF, 10) then Menu.Open= Menu.Open * FALSE end
                if Menu.Open == TRUE and Menu.Cursor.Open == true then
                    renderDrawBox(Menu.Position.X, Menu.Position.Y, 600, 400, 0xFF1C1C1C)
                    renderDrawBox(Menu.Position.X + 30, Menu.Position.Y + 10, 540, 2, 0xFF4F4F4F)
                    renderDrawBox(Menu.Position.X + 30, Menu.Position.Y + 390, 540, 2, 0xFF4F4F4F)
                    renderDrawBox(Menu.Position.X + 10, Menu.Position.Y + 30, 2, 340, 0xFF4F4F4F)
                    renderDrawBox(Menu.Position.X + 590, Menu.Position.Y + 30, 2, 340, 0xFF4F4F4F)
                   
                    renderDrawBox(Menu.Position.X + 180, Menu.Position.Y + 30, 2, 340, 0xFF4F4F4F)
                    renderDrawBox(Menu.Position.X + 580, Menu.Position.Y + 30, 2, 340, 0xFF4F4F4F)
                    renderDrawBox(Menu.Position.X + 180, Menu.Position.Y + 30, 400, 2, 0xFF4F4F4F)
                    renderDrawBox(Menu.Position.X + 180, Menu.Position.Y + 370, 402, 2, 0xFF4F4F4F)
                   
                    local Teleport_Color= 0x00000000
                    local Bullet_Color= 0x00000000
                    local FakeKill_Color= 0x00000000
                    if Cheat.A_Teleport == TRUE then Teleport_Color= 0xFF6959CD end
                    if Cheat.A_Bullet == TRUE then Bullet_Color= 0xFF6959CD end
                    if Cheat.A_FakeKill == TRUE then FakeKill_Color= 0xFF6959CD end
                   
                    if renderDrawButtonW("Reconnect", Menu.Position.X + 100 - Cheat.TextReconnect / 2, Menu.Position.Y + 30, 0x00000000) then sampDisconnectWithReason(0) sampSetGamestate(1) end
                    if renderDrawButtonW("Teleport", Menu.Position.X + 100 - Cheat.TextTeleport / 2, Menu.Position.Y + 50, Teleport_Color) then
                        Cheat.A_Teleport=     TRUE
                        Cheat.A_Bullet=     FALSE
                        Cheat.A_FakeKill=     FALSE
                    end
                    if renderDrawButtonW("Bullet", Menu.Position.X + 100 - Cheat.TextBullet / 2, Menu.Position.Y + 70, Bullet_Color) then
                        Cheat.A_Teleport=     FALSE
                        Cheat.A_Bullet=     TRUE
                        Cheat.A_FakeKill=     FALSE
                    end
                    if renderDrawButtonW("FakeKill", Menu.Position.X + 100 - Cheat.TextFakeKill / 2, Menu.Position.Y + 90, FakeKill_Color) then
                        Cheat.A_Teleport=     FALSE
                        Cheat.A_Bullet=     FALSE
                        Cheat.A_FakeKill=     TRUE
                    end
                   
                    if Cheat.A_FakeKill == TRUE then
                        if renderDrawButtonW("First", Menu.Position.X + 185, Menu.Position.Y + 32, getCurrentWeaponColor(0)) then Cheat.B_FakeKill= 0 end
                        if renderDrawButtonW("Brass Knuckles", Menu.Position.X + 185, Menu.Position.Y + 52, getCurrentWeaponColor(1)) then Cheat.B_FakeKill= 1 end
                        if renderDrawButtonW("Golf Club", Menu.Position.X + 185, Menu.Position.Y + 72, getCurrentWeaponColor(2)) then Cheat.B_FakeKill= 2 end
                        if renderDrawButtonW("Nightstick", Menu.Position.X + 185, Menu.Position.Y + 92, getCurrentWeaponColor(3)) then Cheat.B_FakeKill= 3 end
                        if renderDrawButtonW("Knife", Menu.Position.X + 185, Menu.Position.Y + 112, getCurrentWeaponColor(4)) then Cheat.B_FakeKill= 4 end
                        if renderDrawButtonW("Baseball Bat", Menu.Position.X + 185, Menu.Position.Y + 132, getCurrentWeaponColor(5)) then Cheat.B_FakeKill= 5 end
                        if renderDrawButtonW("Shovel", Menu.Position.X + 185, Menu.Position.Y + 152, getCurrentWeaponColor(6)) then Cheat.B_FakeKill= 6 end
                        if renderDrawButtonW("Pool Cue", Menu.Position.X + 185, Menu.Position.Y + 172, getCurrentWeaponColor(7)) then Cheat.B_FakeKill= 7 end
                        if renderDrawButtonW("Katana", Menu.Position.X + 185, Menu.Position.Y + 192, getCurrentWeaponColor(8)) then Cheat.B_FakeKill= 8 end
                        if renderDrawButtonW("Chainsaw", Menu.Position.X + 185, Menu.Position.Y + 212, getCurrentWeaponColor(9)) then Cheat.B_FakeKill= 9 end
                        if renderDrawButtonW("Purple Dildo", Menu.Position.X + 185, Menu.Position.Y + 232, getCurrentWeaponColor(10)) then Cheat.B_FakeKill= 10 end
                        if renderDrawButtonW("Dildo", Menu.Position.X + 185, Menu.Position.Y + 252, getCurrentWeaponColor(11)) then Cheat.B_FakeKill= 11 end
                        if renderDrawButtonW("Vibrator", Menu.Position.X + 185, Menu.Position.Y + 272, getCurrentWeaponColor(12)) then Cheat.B_FakeKill= 12 end
                        if renderDrawButtonW("Silver Vibrator", Menu.Position.X + 185, Menu.Position.Y + 292, getCurrentWeaponColor(13)) then Cheat.B_FakeKill= 13 end
                        if renderDrawButtonW("Flowers", Menu.Position.X + 185, Menu.Position.Y + 312, getCurrentWeaponColor(14)) then Cheat.B_FakeKill= 14 end
                        if renderDrawButtonW("Cane", Menu.Position.X + 185, Menu.Position.Y + 332, getCurrentWeaponColor(15)) then Cheat.B_FakeKill= 15 end
                        if renderDrawButtonW("Grenade", Menu.Position.X + 185, Menu.Position.Y + 352, getCurrentWeaponColor(16)) then Cheat.B_FakeKill= 16 end
                       
                        renderDrawBox(Menu.Position.X + 320, Menu.Position.Y + 30, 2, 340, 0xFF4F4F4F)
                        if renderDrawButtonW("Tear Gas", Menu.Position.X + 325, Menu.Position.Y + 32, getCurrentWeaponColor(17)) then Cheat.B_FakeKill= 17 end
                        if renderDrawButtonW("Molotov Cocktail", Menu.Position.X + 325, Menu.Position.Y + 52, getCurrentWeaponColor(18)) then Cheat.B_FakeKill= 18 end
                        if renderDrawButtonW("9mm", Menu.Position.X + 325, Menu.Position.Y + 72, getCurrentWeaponColor(22)) then Cheat.B_FakeKill= 22 end
                        if renderDrawButtonW("Silenced 9mm", Menu.Position.X + 325, Menu.Position.Y + 92, getCurrentWeaponColor(23)) then Cheat.B_FakeKill= 23 end
                        if renderDrawButtonW("Desert Eagle", Menu.Position.X + 325, Menu.Position.Y + 112, getCurrentWeaponColor(24)) then Cheat.B_FakeKill= 24 end
                        if renderDrawButtonW("Shotgun", Menu.Position.X + 325, Menu.Position.Y + 132, getCurrentWeaponColor(25)) then Cheat.B_FakeKill= 25 end
                        if renderDrawButtonW("Sawnoff Shotgun", Menu.Position.X + 325, Menu.Position.Y + 152, getCurrentWeaponColor(26)) then Cheat.B_FakeKill= 26 end
                        if renderDrawButtonW("Combat Shotgun", Menu.Position.X + 325, Menu.Position.Y + 172, getCurrentWeaponColor(27)) then Cheat.B_FakeKill= 27 end
                        if renderDrawButtonW("Micro SMG/Uzi", Menu.Position.X + 325, Menu.Position.Y + 192, getCurrentWeaponColor(28)) then Cheat.B_FakeKill= 28 end
                        if renderDrawButtonW("MP5", Menu.Position.X + 325, Menu.Position.Y + 212, getCurrentWeaponColor(29)) then Cheat.B_FakeKill= 29 end
                        if renderDrawButtonW("AK-47", Menu.Position.X + 325, Menu.Position.Y + 232, getCurrentWeaponColor(30)) then Cheat.B_FakeKill= 30 end
                        if renderDrawButtonW("M4", Menu.Position.X + 325, Menu.Position.Y + 252, getCurrentWeaponColor(31)) then Cheat.B_FakeKill= 31 end
                        if renderDrawButtonW("Tec-9", Menu.Position.X + 325, Menu.Position.Y + 272, getCurrentWeaponColor(32)) then Cheat.B_FakeKill= 32 end
                        if renderDrawButtonW("Country Rifle", Menu.Position.X + 325, Menu.Position.Y + 292, getCurrentWeaponColor(33)) then Cheat.B_FakeKill= 33 end
                        if renderDrawButtonW("Sniper Rifle", Menu.Position.X + 325, Menu.Position.Y + 312, getCurrentWeaponColor(34)) then Cheat.B_FakeKill= 34 end
                        if renderDrawButtonW("RPG", Menu.Position.X + 325, Menu.Position.Y + 332, getCurrentWeaponColor(35)) then Cheat.B_FakeKill= 35 end
                        if renderDrawButtonW("HS Rocket", Menu.Position.X + 325, Menu.Position.Y + 352, getCurrentWeaponColor(36)) then Cheat.B_FakeKill= 36 end
                       
                        renderDrawBox(Menu.Position.X + 460, Menu.Position.Y + 30, 2, 340, 0xFF4F4F4F)
                        if renderDrawButtonW("Flamethrower", Menu.Position.X + 465, Menu.Position.Y + 32, getCurrentWeaponColor(37)) then Cheat.B_FakeKill= 37 end
                        if renderDrawButtonW("Minigun", Menu.Position.X + 465, Menu.Position.Y + 52, getCurrentWeaponColor(38)) then Cheat.B_FakeKill= 38 end
                        if renderDrawButtonW("Satchel Charge", Menu.Position.X + 465, Menu.Position.Y + 72, getCurrentWeaponColor(39)) then Cheat.B_FakeKill= 39 end
                        if renderDrawButtonW("Current", Menu.Position.X + 465, Menu.Position.Y + 92, getCurrentWeaponColor(100)) then Cheat.B_FakeKill= 100 end
                       
                    else renderFontDrawText(Menu.d3dFont, "Null", Menu.Position.X + 400 - Cheat.TextNull, Menu.Position.Y + 200, 0xFFFFFFFF) end
                end
            end
        end
    end
    
    
    
    
    
    
    
    
    
    
    
    
    
    function getCurrentWeaponColor(id)
        if Cheat.B_FakeKill == id then return 0xFF6959CD end
        return 0x00000000
    end
    
    function renderDrawButtonW(Title, posX, posY, trueVol) return renderDrawButtonA(Menu.d3dFont, Title, posX, posY, Menu.Cursor.X, Menu.Cursor.Y, trueVol, 0xFF1E90FF, 0xFFFFFFFF, 0xFFFFFFFF) end
    function renderDrawButtonA(d3dFont, Title, posX, posY, targetX, targetY, boxColor, targetBoxColor, textColor, targetTextColor) return renderDrawButton(d3dFont, Title, posX, posY, renderGetFontDrawTextLength(d3dFont, Title) + 5, renderGetFontDrawHeight(d3dFont), targetX, targetY, boxColor, targetBoxColor, textColor, targetTextColor, 2) end
    function renderDrawButton(d3dFont, Title, posX, posY, sizeX, sizeY, targetX, targetY, boxColor, targetBoxColor, textColor, targetTextColor, offset)
        local bool= false
        local currentBoxColor= boxColor
        local currentTextColor= textColor
       
        if targetX > posX and targetX < posX + sizeX and targetY > posY and targetY < posY + sizeY then
            currentBoxColor= targetBoxColor
            currentTextColor= targetTextColor
            if isKeyJustPressed(VK_LBUTTON) then bool= true end
        end
       
        renderDrawBox(posX, posY, sizeX + 2, sizeY, currentBoxColor)
        renderFontDrawText(d3dFont, Title, posX + offset, posY, currentTextColor)
        return bool
    end

    Ищем строку "isKeyDown(VK_CONTROL)"
    Если активация на нажатие или "isKeyJustPressed(VK_1)" - Если скрипт зажимной
    Меняем "(VK_CONTROL)" на "(VK_KNOPKA)" название клавиш можно найти в интернете
    Сохраняем скрипт

    Ссылка на RenderHack: tut
     
    JEEMBO нравится это.