local screenW, screenH = guiGetScreenSize()
local showPainel = false
function renderStuff()
dxDrawRectangle((screenW - 340) / 2, (screenH - 326) / 2, 340, 326, tocolor(0, 0, 0, 165), false)
dxDrawRectangle((screenW - 283) / 2, (screenH - 118) / 2, 283, 118, tocolor(0, 0, 0, 150), false)
dxDrawText("SKIN", 432, 354, 644, 433, tocolor(255, 255, 255, 255), 2.00, "bankgothic", "left", "top", false, false, false, false, false)
end
function painelControl(button, state)
if showPainel == false then
addEventHandler("onClientRender", root, renderStuff)
showCursor(true)
showPainel = true
else
removeEventHandler("onClientRender", root, renderStuff)
showCursor(false)
showPainel = false
end
end
addCommandHandler("painel", painelControl)
function clickControl(button, state)
if button == "left" and state == "up" then
if showPainel == true then
if isMouseInPosition((screenW - 283) / 2, (screenH - 118) / 2, 283, 118) then
triggerServerEvent ("addSkinPlayer", root, source)
outputChatBox("Skin alterada com sucesso.")
end
end
end
end
addEventHandler("onClientClick", root, clickControl)
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
Este é meu primeiro script, mas queria pela perspectiva de pessoas mais experientes, o que eu poderia melhorá-lo. Aceito críticas construtivas e afins!