Witam mam taki problem bo chcia?bym zaokr?gli? przycisk w panelu logowania lecz nie wiem jak to zrobi? wie ktos mo?e jak to zrobi?? nie chce majstrowa? przy tym by nie zmniejszy? przypadkiem przycisku lub zepsu? kodu za ka?d? pr?b? pomocy wynagradzam piwem <3
taki jest kod
else dxDrawRectangle(sx*305/1024, sy*506/768, sx*200/1024, sy*45/768, tocolor(255, 0, 0, 255), false) end
if not isMouseIn(sx*535/1024, sy*506/768, sx*200/1024, sy*45/768) then dxDrawRectangle(sx*535/1024, sy*506/768, sx*200/1024, sy*45/768, tocolor(255, 0, 0, 255), false)
function roundedRectangle(x, y, w, h, borderColor, bgColor, postGUI)
if (x and y and w and h) then
if (not borderColor) then
borderColor = tocolor(0, 0, 0, 200);
end
if (not bgColor) then
bgColor = borderColor;
end
--- Background
dxDrawRectangle(x, y, w, h, bgColor, postGUI);
--- Border
dxDrawRectangle(x + 2, y - 1, w - 4, 1, borderColor, postGUI); -- top
dxDrawRectangle(x + 2, y + h, w - 4, 1, borderColor, postGUI); -- bottom
dxDrawRectangle(x - 1, y + 2, 1, h - 4, borderColor, postGUI); -- left
dxDrawRectangle(x + w, y + 2, 1, h - 4, borderColor, postGUI); -- right
end
end
dxDrawImage(0, 0, screenWidth, screenHeight, blurShader)
end
end
addEventHandler("onClientRender", root, renderblur)
addEventHandler("onClientResourceStop", resourceRoot,
function()
if (blurShader) then
destroyElement(blurShader)
blurShader = nil
end
end)
x,y=2313.58, 1282.80-- my width
intro_step=math.random(0,850)
local sx,sy=guiGetScreenSize()
local data={ showed=nil, button={}, info=nil, misc=nil, }
function isMouseIn(psx,psy,pssx,pssy,abx,aby)
if not isCursorShowing() then return end
cx,cy=getCursorPosition()
cx,cy=cx*sx,cy*sy
if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
return true,cx,cy
else
return false
end
end
local dist = 100
local angler = 0
function getPointFromDistanceRotation(x, y, dist, angler)
local a = math.rad(90 - angler)
local dx = math.cos(a) * dist;
local dy = math.sin(a) * dist;
return x+dx, y+dy;
end
addEventHandler("onClientClick", root, function(btn,state)
if btn=="left" and state=="down" then
if isMouseIn(sx*305/1024, sy*506/768, sx*200/1024, sy*45/768) and data.showed then
local login=guiGetText(data.button[1])
local pass=guiGetText(data.button[2])
if string.len(login) < 2 or string.len(pass) < 2 then
data.info="Wype?nij wszystkie pola!"
return
end
triggerServerEvent("logging:checkAccount", resourceRoot, login, pass)
end
if isMouseIn(sx*535/1024, sy*506/768, sx*200/1024, sy*45/768) and data.showed then
local login=guiGetText(data.button[1])
local pass=guiGetText(data.button[2])
if string.len(login) > 22 or string.len(pass) > 22 and string.len(login) < 3 or string.len(pass) < 3 then
data.info="Login/Has?o musz? mie? mniej ni? od 3 do 22 znak?w."
return
end
triggerServerEvent("logging:newAccount", resourceRoot, login, pass)
end
end
end)
addEvent("logging:result", true)
addEventHandler("logging:result", resourceRoot, function(value,info)
if not info then info="" end
if value then
data.showed=false
showZones(data.misc)
-- Usuwamy elementy
destroyElement(data.button[1])
destroyElement(data.button[2])
removeEventHandler("onClientRender", root, renderLoginBox)
else
data.info=tostring(info)
setTimer(function() data.info=nil end, 3000, 1)
end
end)
function roundedRectangle(x, y, w, h, borderColor, bgColor, postGUI)
if (x and y and w and h) then
if (not borderColor) then
borderColor = tocolor(0, 0, 0, 200);
end
if (not bgColor) then
bgColor = borderColor;
end
--- Background
dxDrawRectangle(x, y, w, h, bgColor, postGUI);
--- Border
dxDrawRectangle(x + 2, y - 1, w - 4, 1, borderColor, postGUI); -- top
dxDrawRectangle(x + 2, y + h, w - 4, 1, borderColor, postGUI); -- bottom
dxDrawRectangle(x - 1, y + 2, 1, h - 4, borderColor, postGUI); -- left
dxDrawRectangle(x + w, y + 2, 1, h - 4, borderColor, postGUI); -- right
end
end
I potem zamiast dxDrawRectangle w swoim kodzie dajesz roundedRectangle
function dxCreateRoundedTexture(text_width,text_height,radius)
assert(text_width,"Missing argument 'text_width' at dxCreateRoundedTexture")
assert(text_height,"Missing argument 'height' at dxCreateRoundedTexture")
assert(radius,"Missing argument 'radius' at dxCreateRoundedTexture")
if type(text_width) ~= "number" then outputDebugString("Bad argument @ 'dxCreateRoundedTexture' [Excepted number at argument 1, got " .. type(text_width) .. "]",2) return false end
if type(text_height) ~= "number" then outputDebugString("Bad argument @ 'dxCreateRoundedTexture' [Excepted number at argument 2, got " .. type(text_height) .. "]",2) return false end
if type(radius) ~= "number" then outputDebugString("Bad argument @ 'dxCreateRoundedTexture' [Excepted number at argument 3, got " .. type(radius) .. "]",2) return false end
if text_width < 0 then outputDebugString("text_width can't be less than 0",1) return false end
if text_height < 0 then outputDebugString("text_height can't be less than 0",1) return false end
if radius < 0 or radius > 100 then outputDebugString("Parameter 'radius' can't be between 0 and 100",1) return false end
local texture = DxTexture(text_width,text_height)
local pix = texture:getPixels()
radius = (radius * (text_height / 2)) / 100
for x=0,text_width do
for y=0,text_height do
if x >= radius and x <= text_width - radius then
dxSetPixelColor(pix,x,y,255,255,255,255)
end
if y >= radius and y <= text_height - radius then
dxSetPixelColor(pix,x,y,255,255,255,255)
end
if math.sqrt((x - radius)^2 + (y - radius)^2) < radius then
dxSetPixelColor(pix,x,y,255,255,255,255) -- lewy gorny rog
end
if math.sqrt((x - (text_width - radius))^2 + (y - radius)^2) < radius then
dxSetPixelColor(pix,x,y,255,255,255,255) -- prawy gorny rog
end
if math.sqrt((x - radius)^2 + (y - (text_height - radius))^2) < radius then
dxSetPixelColor(pix,x,y,255,255,255,255) -- lewy dolny rog
end
if math.sqrt((x - (text_width - radius))^2 + (y - (text_height - radius))^2) < radius then
dxSetPixelColor(pix,x,y,255,255,255,255) -- prawy dolny rog
end
end
end
texture:setPixels(pix)
return texture
end
local texutra = dxCreateRoundedTexture( 400, 300, 20 )
addEventHandler("onClientRender",root,
function()
if texutra then
local screenWidth, screenHeight = guiGetScreenSize()
dxDrawImage ( screenWidth-400)/2, (screenHeight -300)/2, 400, 300, texture )
end)
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach