Jump to content

[HELP]Handling Panel


BYPATYAAA

Recommended Posts

Hello these days i made a pretty beginner handling panel but unfortunately i got stuck as i can't load my handling.who can help please thx [Im noob :(]

Script:

local hand1 = "#1 Drift"
local hand2 = "#2 Drift"
local hand3 = "#3 Drift"
local hand4 = "#4 Drift"
local hand5 = "#5 Drift"
local hand6 = "#6 Drift"
local hand7 = "#7 Drift"
local hand8 = "#8 Drift"
local hand9 = "#9 Drift"
local screenH, screenW = guiGetScreenSize()
local x, y = (screenH/1366), (screenW/768)
local Font = dxCreateFont("gfx/Roboto-Condensed.ttf", 13) ---<< Criando a fonte .. 


cor = {}
function PainelDc()
    --1sor
    cor[1] = tocolor(0, 0, 0, 180)
    if isCursorOnElement(x*460, y*320, x*100, y*30) then
        cor[1] = tocolor(255, 109, 0, 240)
    end

    cor[2] = tocolor(0, 0, 0, 180)
    if isCursorOnElement(x*460, y*370, x*100, y*30) then
        cor[2] = tocolor(255, 109, 0, 240)
    end

    cor[3] = tocolor(0, 0, 0, 180)
    if isCursorOnElement(x*460, y*420, x*100, y*30) then
        cor[3] = tocolor(255, 109, 0, 240)
    end

    --2sor

    cor[4] = tocolor(0, 0, 0, 180)
    if isCursorOnElement(x*580, y*320, x*100, y*30) then
        cor[4] = tocolor(255, 109, 0, 240)
    end

    cor[5] = tocolor(0, 0, 0, 180)
    if isCursorOnElement(x*580, y*370, x*100, y*30) then
        cor[5] = tocolor(255, 109, 0, 240)
    end

    cor[6] = tocolor(0, 0, 0, 180)
    if isCursorOnElement(x*580, y*420, x*100, y*30) then
        cor[6] = tocolor(255, 109, 0, 240)
    end

    --3sor

    cor[7] = tocolor(0, 0, 0, 180)
    if isCursorOnElement(x*700, y*320, x*100, y*30) then
        cor[7] = tocolor(255, 109, 0, 240)
    end

    cor[8] = tocolor(0, 0, 0, 180)
    if isCursorOnElement(x*700, y*370, x*100, y*30) then
        cor[8] = tocolor(255, 109, 0, 240)
    end

    cor[9] = tocolor(0, 0, 0, 180)
    if isCursorOnElement(x*700, y*420, x*100, y*30) then
        cor[9] = tocolor(255, 109, 0, 240)
    end


    dxDrawRectangle(x*450, y*312, x*400, y*150, tocolor(0, 0, 0, 180), false)
    dxDrawRectangle(x*450, y*290, x*400, y*22, tocolor(255, 109, 0, 240), false)
    dxDrawText("M.D.SZ - Handling Panel", x*520, y*291, x*800, y*312, tocolor(255, 255, 255, 255), x*0.9, Font, "center", "center", false, false, false, false, false)
    dxDrawRectangle(x*460, y*320, x*100, y*30, cor[1], false)--gomb 1
    dxDrawRectangle(x*460, y*370, x*100, y*30, cor[2], false)--gomb 2
    dxDrawRectangle(x*460, y*420, x*100, y*30, cor[3], false)--gomb 3
        dxDrawRectangle(x*580, y*320, x*100, y*30, cor[4], false)--gomb 2sor 4
        dxDrawRectangle(x*580, y*370, x*100, y*30, cor[5], false)--gomb 2sor 5
        dxDrawRectangle(x*580, y*420, x*100, y*30, cor[6], false)--gomb 2sor 6
            dxDrawRectangle(x*700, y*320, x*100, y*30, cor[7], false)--gomb 3sor 7
            dxDrawRectangle(x*700, y*370, x*100, y*30, cor[8], false)--gomb 3sor 8
            dxDrawRectangle(x*700, y*420, x*100, y*30, cor[9], false)--gomb 3sor 9

    dxDrawText("#1 Drift", x*200, y*358, x*820, y*312, tocolor(255, 255, 255, 255), x*1.00, Font, "center", "center", false, false, false, true, false)-- kiiras gombra 1
    dxDrawText("#2 Drift", x*200, y*460, x*820, y*312, tocolor(255, 255, 255, 255), x*1.00, Font, "center", "center", false, false, false, true, false)-- kiiras gombra 2
    dxDrawText("#3 Drift", x*200, y*560, x*820, y*312, tocolor(255, 255, 255, 255), x*1.00, Font, "center", "center", false, false, false, true, false)-- kiiras gombra 3
        dxDrawText("#4 Drift", x*445, y*358, x*820, y*312, tocolor(255, 255, 255, 255), x*1.00, Font, "center", "center", false, false, false, true, false)-- kiiras gombra 2sor 1
        dxDrawText("#5 Drift", x*445, y*460, x*820, y*312, tocolor(255, 255, 255, 255), x*1.00, Font, "center", "center", false, false, false, true, false)-- kiiras gombra 2sor 1
        dxDrawText("#6 Drift", x*445, y*560, x*820, y*312, tocolor(255, 255, 255, 255), x*1.00, Font, "center", "center", false, false, false, true, false)-- kiiras gombra 2sor 1
            dxDrawText("#7 Drift", x*690, y*358, x*820, y*312, tocolor(255, 255, 255, 255), x*1.00, Font, "center", "center", false, false, false, true, false)-- kiiras gombra 2sor 1
            dxDrawText("#8 Drift", x*690, y*460, x*820, y*312, tocolor(255, 255, 255, 255), x*1.00, Font, "center", "center", false, false, false, true, false)-- kiiras gombra 2sor 1
            dxDrawText("#9 Drift", x*690, y*560, x*820, y*312, tocolor(255, 255, 255, 255), x*1.00, Font, "center", "center", false, false, false, true, false)-- kiiras gombra 2sor 1

end


Painelstt = false --<<<<  Status do painel(PainelDc)

function OpenPainel()  --<<<<< Todo if significa == se for ..
    if Painelstt == false then --<<<< Verifica se o painel está fechado e logo após o abre e poe seu status como true(aberto)
        addEventHandler("onClientRender", getRootElement(), PainelDc)
        Painelstt = true
        showCursor(true)

    else --<<<< else(significa o contrario) se não for .. 
        removeEventHandler("onClientRender", getRootElement(), PainelDc)
        Painelstt = false
        showCursor(false)

    end 
end 
addCommandHandler("hpan", OpenPainel)

local handlings1 = "1300 2979.7 2 0 0.1 -0.8 70 0.6 0.66 0.66 5 150 25 10 4 p 5 0.66 false 75 0.85 0.15 0 0.15 -0.16 0.5 0 0.37 0 35000 A02800 730000C 1 1 0"

--1
function onClientButtonClick(Button, State)
    if Painelstt == true and Button == "left" and State == "down" then 
        if isCursorOnElement(x*460, y*320, x*100, y*30) then
            setVehicleHandling (element "429", string "property", "..handlings1..")
            outputChatBox("[#ff8f00Handling - Info#ffffff] #82f9fc"..hand1.." #ffffffHandling betöltve!", 255, 255, 255, true) 
            removeEventHandler("onClientRender", getRootElement(), PainelDc)
            Painelstt = false
            showCursor(false)

        elseif isCursorOnElement(x*797, y*290, x*23, y*22) then
            removeEventHandler("onClientRender", getRootElement(), PainelDc)
            Painelstt = false
            showCursor(false)
        else
        end 
    end 
end 
addEventHandler("onClientClick", getRootElement(), onClientButtonClick)

--2 

function onClientButtonClick(Button, State)
    if Painelstt == true and Button == "left" and State == "down" then 
        if isCursorOnElement(x*460, y*370, x*100, y*30) then
            setClipboard(""..hand2.."")
            outputChatBox("[#ff8f00Handling - Info#ffffff] #82f9fc"..hand2.." #ffffffHandling betöltve!", 255, 255, 255, true)
            removeEventHandler("onClientRender", getRootElement(), PainelDc)
            Painelstt = false
            showCursor(false)

        elseif isCursorOnElement(x*797, y*290, x*23, y*22) then
            removeEventHandler("onClientRender", getRootElement(), PainelDc)
            Painelstt = false
            showCursor(false)
        else
        end 
    end 
end 
addEventHandler("onClientClick", getRootElement(), onClientButtonClick)

--3

function onClientButtonClick(Button, State)
    if Painelstt == true and Button == "left" and State == "down" then 
        if isCursorOnElement(x*460, y*430, x*100, y*30) then
            setClipboard(""..hand2.."")
            outputChatBox("[#ff8f00Handling - Info#ffffff] #82f9fc"..hand3.." #ffffffHandling betöltve!", 255, 255, 255, true)
            removeEventHandler("onClientRender", getRootElement(), PainelDc)
            Painelstt = false
            showCursor(false)

        elseif isCursorOnElement(x*797, y*290, x*23, y*22) then
            removeEventHandler("onClientRender", getRootElement(), PainelDc)
            Painelstt = false
            showCursor(false)
        else
        end 
    end 
end 
addEventHandler("onClientClick", getRootElement(), onClientButtonClick)

--4

function onClientButtonClick(Button, State)
    if Painelstt == true and Button == "left" and State == "down" then 
        if isCursorOnElement(x*580, y*320, x*100, y*30) then
            setClipboard(""..hand2.."")
            outputChatBox("[#ff8f00Handling - Info#ffffff] #82f9fc"..hand4.." #ffffffHandling betöltve!", 255, 255, 255, true)
            removeEventHandler("onClientRender", getRootElement(), PainelDc)
            Painelstt = false
            showCursor(false)

        elseif isCursorOnElement(x*797, y*290, x*23, y*22) then
            removeEventHandler("onClientRender", getRootElement(), PainelDc)
            Painelstt = false
            showCursor(false)
        else
        end 
    end 
end 
addEventHandler("onClientClick", getRootElement(), onClientButtonClick)

--5

function onClientButtonClick(Button, State)
    if Painelstt == true and Button == "left" and State == "down" then 
        if isCursorOnElement(x*580, y*370, x*100, y*30) then
            setClipboard(""..hand2.."")
            outputChatBox("[#ff8f00Handling - Info#ffffff] #82f9fc"..hand5.." #ffffffHandling betöltve!", 255, 255, 255, true)
            removeEventHandler("onClientRender", getRootElement(), PainelDc)
            Painelstt = false
            showCursor(false)

        elseif isCursorOnElement(x*797, y*290, x*23, y*22) then
            removeEventHandler("onClientRender", getRootElement(), PainelDc)
            Painelstt = false
            showCursor(false)
        else
        end 
    end 
end 
addEventHandler("onClientClick", getRootElement(), onClientButtonClick)

--6

function onClientButtonClick(Button, State)
    if Painelstt == true and Button == "left" and State == "down" then 
        if isCursorOnElement(x*580, y*420, x*100, y*30) then
            setClipboard(""..hand2.."")
            outputChatBox("[#ff8f00Handling - Info#ffffff] #82f9fc"..hand6.." #ffffffHandling betöltve!", 255, 255, 255, true)
            removeEventHandler("onClientRender", getRootElement(), PainelDc)
            Painelstt = false
            showCursor(false)

        elseif isCursorOnElement(x*797, y*290, x*23, y*22) then
            removeEventHandler("onClientRender", getRootElement(), PainelDc)
            Painelstt = false
            showCursor(false)
        else
        end 
    end 
end 
addEventHandler("onClientClick", getRootElement(), onClientButtonClick)

--7

function onClientButtonClick(Button, State)
    if Painelstt == true and Button == "left" and State == "down" then 
        if isCursorOnElement(x*700, y*320, x*100, y*30) then
            setClipboard(""..hand2.."") 
            outputChatBox("[#ff8f00Handling - Info#ffffff] #82f9fc"..hand7.." #ffffffHandling betöltve!", 255, 255, 255, true)
            removeEventHandler("onClientRender", getRootElement(), PainelDc)
            Painelstt = false
            showCursor(false)

        elseif isCursorOnElement(x*797, y*290, x*23, y*22) then
            removeEventHandler("onClientRender", getRootElement(), PainelDc)
            Painelstt = false
            showCursor(false)
        else
        end 
    end 
end 
addEventHandler("onClientClick", getRootElement(), onClientButtonClick)

--8

function onClientButtonClick(Button, State)
    if Painelstt == true and Button == "left" and State == "down" then 
        if isCursorOnElement(x*700, y*370, x*100, y*30) then
            setClipboard(""..hand2.."")
            outputChatBox("[#ff8f00Handling - Info#ffffff] #82f9fc"..hand8.." #ffffffHandling betöltve!", 255, 255, 255, true)
            removeEventHandler("onClientRender", getRootElement(), PainelDc)
            Painelstt = false
            showCursor(false)

        elseif isCursorOnElement(x*797, y*290, x*23, y*22) then
            removeEventHandler("onClientRender", getRootElement(), PainelDc)
            Painelstt = false
            showCursor(false)
        else
        end 
    end 
end 
addEventHandler("onClientClick", getRootElement(), onClientButtonClick)

--9

function onClientButtonClick(Button, State)
    if Painelstt == true and Button == "left" and State == "down" then 
        if isCursorOnElement(x*700, y*420, x*100, y*30) then
            setClipboard(""..hand2.."")
            outputChatBox("[#ff8f00Handling - Info#ffffff] #82f9fc"..hand9.." #ffffffHandling betöltve!", 255, 255, 255, true)
            removeEventHandler("onClientRender", getRootElement(), PainelDc)
            Painelstt = false
            showCursor(false)

        elseif isCursorOnElement(x*797, y*290, x*23, y*22) then
            removeEventHandler("onClientRender", getRootElement(), PainelDc)
            Painelstt = false
            showCursor(false)
        else
        end 
    end 
end 
addEventHandler("onClientClick", getRootElement(), onClientButtonClick)


function isCursorOnElement( posX, posY, width, height ) --<< Funçao que verifica a posiçao do Cursor (mouse)
    if isCursorShowing( ) then
        local mouseX, mouseY = getCursorPosition( )
        local clientW, clientH = guiGetScreenSize( )
        local mouseX, mouseY = mouseX * clientW, mouseY * clientH
        if ( mouseX > posX and mouseX < ( posX + width ) and mouseY > posY and mouseY < ( posY + height ) ) then
            return true
        end
    end
    return false
end

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...