Jump to content

Me ajudem nesse script


Recommended Posts

Bom fiz um painel DX pro meu servidor de treino, mas estou com duvida em uma coisa. Qual a função de setar veículo?

O Script está assim atualmente:



local screenW, screenH = guiGetScreenSize()


local Exibir_Painel = false
function PainelDX ()
    dxDrawRectangle(screenW * 0.3219, screenH * 0.0755, screenW * 0.3633, screenH * 0.7643, tocolor(13, 0, 13, 255), false)
    dxDrawText("Painel Treino", screenW * 0.4578, screenH * 0.1055, screenW * 0.5359, screenH * 0.1432, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
    dxDrawRectangle(screenW * 0.4094, screenH * 0.2070, screenW * 0.1992, screenH * 0.1003, tocolor(213, 0, 213, 255), false)
    dxDrawRectangle(screenW * 0.4094, screenH * 0.3932, screenW * 0.1992, screenH * 0.1003, tocolor(213, 0, 213, 255), false)
    dxDrawRectangle(screenW * 0.4094, screenH * 0.5898, screenW * 0.1992, screenH * 0.1003, tocolor(213, 0, 213, 255), false)
    dxDrawText("By Baiano", screenW * 0.4578, screenH * 0.7630, screenW * 0.5359, screenH * 0.8008, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
    dxDrawText("GTR", screenW * 0.4094, screenH * 0.2070, screenW * 0.6086, screenH * 0.3073, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
    dxDrawText("Skin", screenW * 0.4094, screenH * 0.3932, screenW * 0.6086, screenH * 0.4935, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
    dxDrawText("Armas + Colete", screenW * 0.4094, screenH * 0.5898, screenW * 0.6086, screenH * 0.6901, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)


end


addCommandHandler("treino", function()
    if Exibir_Painel == false then
        addEventHandler("onClientRender", getRootElement(), PainelDX)
        Exibir_Painel = true
        showCursor(true)
    else
        removeEventHandler("onClientRender", getRootElement(), PainelDX)
        Exibir_Painel = false
        showCursor(false)
    end
end)

function isMouseInPosition ( x, y, width, height )
    if ( not isCursorShowing( ) ) then
        return false
    end
    local sx, sy = guiGetScreenSize ( )
    local cx, cy = getCursorPosition ( )
    local cx, cy = ( cx * sx ), ( cy * sy )
    
    return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) )
end

-- Modified version for DX Text
function isCursorOverText(posX, posY, sizeX, sizeY)
    if ( not isCursorShowing( ) ) then
        return false
    end
    local cX, cY = getCursorPosition()
    local screenWidth, screenHeight = guiGetScreenSize()
    local cX, cY = (cX*screenWidth), (cY*screenHeight)

    return ( (cX >= posX and cX <= posX+(sizeX - posX)) and (cY >= posY and cY <= posY+(sizeY - posY)) )
end

addEventHandler("onClientClick", getRootElement(), function(button, state)
    if button=="left" and state=="down" then
    	if Exibir_Painel == true then
        	if isMouseInPosition(screenW * 0.4094, screenH * 0.2070, screenW * 0.1992, screenH * 0.1003) then
        		(função de setar veículo aqui)
        	end
        end
    end
end)

addEventHandler("onClientClick", getRootElement(), function(button, state)
    if button=="left" and state=="down" then
    	if Exibir_Painel == true then
        	if isMouseInPosition(screenW * 0.4094, screenH * 0.3932, screenW * 0.1992, screenH * 0.1003) then
        		setElementModel(localPlayer, 73)
        	end
        end
    end
end)

addEventHandler("onClientClick", getRootElement(), function(button, state)
    if button=="left" and state=="down" then
    	if Exibir_Painel == true then
        	if isMouseInPosition(screenW * 0.4094, screenH * 0.5898, screenW * 0.1992, screenH * 0.1003) then
        		setPedArmor(localPlayer, 100)
        	end
        end
    end
end)




Se alguém poder ajudar ai agradeço mt

Edited by Gab MTA
Link to comment
local screenW, screenH = guiGetScreenSize()
 
local Exibir_Painel = false
function PainelDX ()
    dxDrawRectangle(screenW * 0.3219, screenH * 0.0755, screenW * 0.3633, screenH * 0.7643tocolor(13013255), false)
    dxDrawText("Painel Treino", screenW * 0.4578, screenH * 0.1055, screenW * 0.5359, screenH * 0.1432tocolor(255255255255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
    dxDrawRectangle(screenW * 0.4094, screenH * 0.2070, screenW * 0.1992, screenH * 0.1003tocolor(2130213255), false)
    dxDrawRectangle(screenW * 0.4094, screenH * 0.3932, screenW * 0.1992, screenH * 0.1003tocolor(2130213255), false)
    dxDrawRectangle(screenW * 0.4094, screenH * 0.5898, screenW * 0.1992, screenH * 0.1003tocolor(2130213255), false)
    dxDrawText("By Baiano", screenW * 0.4578, screenH * 0.7630, screenW * 0.5359, screenH * 0.8008tocolor(255255255255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
    dxDrawText("GTR", screenW * 0.4094, screenH * 0.2070, screenW * 0.6086, screenH * 0.3073tocolor(255255255255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
    dxDrawText("Skin", screenW * 0.4094, screenH * 0.3932, screenW * 0.6086, screenH * 0.4935tocolor(255255255255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
    dxDrawText("Armas + Colete", screenW * 0.4094, screenH * 0.5898, screenW * 0.6086, screenH * 0.6901tocolor(255255255255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
 
end
 
addCommandHandler("treino"function()
    if Exibir_Painel == false then
        addEventHandler("onClientRender"getRootElement(), PainelDX)
        Exibir_Painel = true
        showCursor(true)
    else
        removeEventHandler("onClientRender"getRootElement(), PainelDX)
        Exibir_Painel = false
        showCursor(false)
    end
end)
 
function isMouseInPosition ( xywidthheight )
    if ( not isCursorShowing( ) ) then
        return false
    end
    local sx, sy = guiGetScreenSize ( )
    local cx, cy = getCursorPosition ( )
    local cx, cy = ( cx * sx ), ( cy * sy )
    
    return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) )
end
 
-- Modified version for DX Text
function isCursorOverText(posXposYsizeXsizeY)
    if ( not isCursorShowing( ) ) then
        return false
    end
    local cX, cY = getCursorPosition()
    local screenWidth, screenHeight = guiGetScreenSize()
    local cX, cY = (cX*screenWidth), (cY*screenHeight)
 
    return ( (cX >= posX and cX <= posX+(sizeX - posX)) and (cY >= posY and cY <= posY+(sizeY - posY)) )
end
 
addEventHandler("onClientClick"getRootElement(), function(buttonstate)
    if button=="left" and state=="down" then
        if Exibir_Painel == true then
            if isMouseInPosition(screenW * 0.4094, screenH * 0.2070, screenW * 0.1992, screenH * 0.1003then
                local x,y,z = getElementPosition(localPlayer)
                veh = createVehicle(490, x,y,z)
                warpPedIntoVehicle(localPlayer, veh)
            end
        end
    end
end)
 
addEventHandler("onClientClick"getRootElement(), function(buttonstate)
    if button=="left" and state=="down" then
        if Exibir_Painel == true then
            if isMouseInPosition(screenW * 0.4094, screenH * 0.3932, screenW * 0.1992, screenH * 0.1003then
                setElementModel(localPlayer, 73)
            end
        end
    end
end)
 
addEventHandler("onClientClick"getRootElement(), function(buttonstate)
    if button=="left" and state=="down" then
        if Exibir_Painel == true then
            if isMouseInPosition(screenW * 0.4094, screenH * 0.5898, screenW * 0.1992, screenH * 0.1003then
                setPedArmor(localPlayer, 100)
            end
        end
    end
end)
 
 
Só tem um problema, na hora de destruir o veiculo, vai ter que criar a função para destrui-lo, vai ter que criar uma variavel e armarzenala em uma tabela vazia.
 
outra coisa, comece a usar elseif ❤️
Edited by VictorBRP
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...