Wysłany: 2022-06-08, 08:16
Toasty2000
Wiek: 25 Na forum: 1558 dni Posty: 18
Nick w MP: Toasty2000
Piwa : 1
Witam panel logowania nie dzia?a poprawnie nie wyskakuj? text kt?ry ma wyskakiwa? przez fonty
autch: Kod: ------------------------------------------------
-- Panel logowania
-- Autor: Wujaszek
-- discord: Wujaszek#1986
------------------------------------------------
if getElementData(localPlayer, "player:sid") then return end
local root = getRootElement()
local resourceRoot = getResourceRootElement(getThisResource())
local screenWidth, screenHeight = guiGetScreenSize()
addEventHandler("onClientResourceStop", resourceRoot,
function()
if blurShader and isElement(blurShader) then
destroyElement(blurShader)
blurShader = nil
end
end)
local data={ showed=nil, button={}, info=nil, misc=nil, }
function cursorPosition(x, y, w, h)
if (not isCursorShowing()) then
return false
end
local mx, my = getCursorPosition()
local fullx, fully = guiGetScreenSize()
cursorx, cursory = mx*fullx, my*fully
if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
return true
else
return false
end
end
-------------------------------------------------- scalowanie
local sx,sy=guiGetScreenSize()
local w, h = (sx/1360),(sy/768)
local time = 3000
local tick = getTickCount()
local scalaczcionki = (w+h)*0.5
local anim = 0
local anim_tick = nil
local zapamietaj = false
local alpha1 = 0
function roundedRectangle(x, y, w, h, color)
dxDrawRectangle(x, y, w, h, color, false)
dxDrawRectangle(x + 2, y - 1, w - 4, 1, color, false)
dxDrawRectangle(x + 2, y + h, w - 4, 1, color, false)
dxDrawRectangle(x - 1, y + 2, 1, h - 4, color, false)
dxDrawRectangle(x + w, y + 2, 1, h - 4, color, false)
end
-------------------------------------------------- interfejs/czcionka
local fonts = {
font = dxCreateFont("files/font.ttf", 13*scalaczcionki),
font2 = dxCreateFont("files/font.ttf", 18*scalaczcionki),
}
local textures = {
bg = dxCreateTexture('files/background.png', 'argb', false, 'clamp'),
bglogin = dxCreateTexture('files/bglogin.png', 'argb', false, 'clamp'),
button = dxCreateTexture('files/button.png', 'argb', false, 'clamp'),
icon3 = dxCreateTexture('files/icon3.png', 'argb', false, 'clamp'),
icon5 = dxCreateTexture('files/icon5.png', 'argb', false, 'clamp'),
remember1 = dxCreateTexture('files/remember1.png', 'argb', false, 'clamp'),
remember2 = dxCreateTexture('files/remember2.png', 'argb', false, 'clamp'),
logo = dxCreateTexture('files/logo.png', 'argb', false, 'clamp'),
editbox = dxCreateTexture('files/editbox.png', 'argb', false, 'clamp'),
light = dxCreateTexture('files/light.png', 'argb', false, 'clamp'),
}
colors = {
["default"] = tocolor(229, 229, 229,255),
["black"] = tocolor(0,0,0),
["green"] = tocolor(73, 127, 15,245),
}
function renderLoginBox()
r,g,b = interpolateBetween(130, 40, 40,84, 145, 68,(getTickCount()-tick)/2000,"SineCurve")
local bit_low = getSoundFFTData(data.misc,512,255)
for i,v in pairs(bit_low) do
visualizer = math.min(v*150,50)
end
-------------------------------------------------- Interfejs
dxDrawImage(0*w, 0*h, 1360*w, 768*h, textures.bg, 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawRectangle(434*w, 187*h, 418*w, 472*h, tocolor(19, 19, 19, 190), false)
dxDrawImage(0*w, 0*h, 1360*w, 768*h, textures.light, 0, 0, 0, tocolor(255, 255, 255, visualizer))
dxDrawRectangle(505*w, 343*h, 274*w, 31*h, tocolor(25, 25, 25, 255), false) -- edit
dxDrawRectangle(505*w, 384*h, 274*w, 31*h, tocolor(25, 25, 25, 255), false) -- edit
dxDrawImage(508*w, 385*h, 29*w, 29*h, textures.icon3, 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawImage(508*w, 345*h, 29*w, 29*h, textures.icon5, 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawText("TEST!",275*w, 185*h, 1008*w, 398*h, colors["default"],0.8, fonts.font2, "center", "center", false, false, false, true, false)
if cursorPosition(444*w, 613*h, 151*w, 36*h) then -- log
roundedRectangle(444*w, 613*h, 151*w, 36*h, tocolor(96, 3, 139, 205), false)
else
roundedRectangle(444*w, 613*h, 151*w, 36*h, tocolor(96, 3, 139, 255), false)
end
dxDrawText("Zaloguj sie",482*w, 866*h, 1008*w, 398*h, colors["default"],1, fonts.font, "left", "center", false, false, false, true, false)
if cursorPosition(691*w, 613*h, 151*w, 36*h) then -- reg
roundedRectangle(691*w, 613*h, 151*w, 36*h, tocolor(96, 3, 139, 205), false)
else
roundedRectangle(691*w, 613*h, 151*w, 36*h, tocolor(96, 3, 139, 255), false)
end
dxDrawText("Zarejestruj sie",725*w, 866*h, 1008*w, 398*h, colors["default"],1, fonts.font, "left", "center", false, false, false, true, false)
-------------------------------------------------- Napisy
if zapamietaj == false then
dxDrawImage(503*w, 473*h, 32*w, 32*h, textures.remember2, 0, 0, 0, tocolor(255,255,255,255), false) -- save
else
dxDrawImage(503*w, 473*h, 32*w, 32*h, textures.remember1, 0, 0, 0, tocolor(255, 255, 255,255), false) -- save
end
dxDrawText("Zapamietaj moje #b30802dane",540*w, 585*h, 1008*w, 398*h, colors["default"],0.8, fonts.font, "left", "center", false, false, false, true, false)
end
function math.round(number, decimals, method)
decimals = decimals or 0
local factor = 10 ^ decimals
if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor
else return tonumber(("%."..decimals.."f"):format(number)) end
end
addEventHandler('onClientClick', root, function(button, state, cx, cy)
tick5 = getTickCount()
cursorPosition2 = {cx, cy}
end)
addEventHandler("onClientClick", root, function(btn,state)
if btn=="left" and state=="down" then
if getElementData(localPlayer, "player:sid") then return end
if cursorPosition(444*w, 613*h, 151*w, 36*h) and data.showed then -- Logowanie
local login=exports['village_gui']:getCustomEditboxText('login:nick')
local pass=exports['village_gui']:getCustomEditboxText('login:haslo')
if string.len(login) < 2 or string.len(pass) < 2 then
triggerEvent('onClientAddNotification', 'Login i has?o Zawiera zbyt ma?o znak?w!', 'error')
end
triggerServerEvent("logging:checkAccount", resourceRoot, login, pass)
end
if cursorPosition(691*w, 613*h, 151*w, 36*h) and data.showed then -- rejestracja
local login=exports['village_gui']:getCustomEditboxText('login:nick')
local pass=exports['village_gui']:getCustomEditboxText('login:haslo')
if string.len(login) > 30 or string.len(pass) > 30 and string.len(login) < 3 or string.len(pass) < 3 then
triggerEvent('onClientAddNotification', 'Login i has?o Zawiera zbyt ma?o znak?w!', 'error')
end
triggerServerEvent("logging:newAccount", resourceRoot, login, pass)
end
if cursorPosition(503*w, 473*h, 32*w, 32*h) and data.showed then
if zapamietaj == true then
zapamietaj = false
elseif zapamietaj == false then
zapamietaj = true
end
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
exports['village_gui']:destroyCustomEditbox('login:nick')
exports['village_gui']:destroyCustomEditbox('login:haslo')
removeEventHandler("onClientRender", root, renderLoginBox)
local login=exports['village_gui']:getCustomEditboxText('login:nick')
local pass=exports['village_gui']:getCustomEditboxText('login:haslo')
else
data.info=tostring(info)
setTimer(function() data.info=nil end, 3000, 1)
end
end)
addEvent("zapamietajMnie", true)
addEventHandler( "zapamietajMnie", root, function( )
local login=exports['village_gui']:getCustomEditboxText('login:nick')
local pass=exports['village_gui']:getCustomEditboxText('login:haslo')
if zapamietaj == true then
if not xml then
xml = xmlCreateFile("zapamietaj.xml","login")
loginXML = xmlCreateChild(xml,"login")
passXML = xmlCreateChild(xml,"password")
checkboxXML = xmlCreateChild(xml,"checkboxState")
xmlNodeSetValue(loginXML, login)
xmlNodeSetValue(passXML, pass)
xmlNodeSetValue(checkboxXML, "1")
xmlSaveFile(xml)
else
loginXML = xmlFindChild(xml,"login",0)
passXML = xmlFindChild(xml,"password",0)
checkboxXML = xmlFindChild(xml,"checkboxState",0)
end
end
end)
addEvent("usunXML", true)
addEventHandler( "usunXML", root, function( )
if zapamietaj == false then
fileDelete ("zapamietaj.xml")
end
end)
addEventHandler("onClientResourceStart", resourceRoot, function()
showChat(false)
showCursor(true)
fadeCamera(true)
data.showed=true
setElementAlpha(localPlayer,0)
data.misc=playSound("files/intro.mp3",true)
setPlayerHudComponentVisible("radar",false)
addEventHandler("onClientRender", root, jumpinglogo)
setSoundVolume(data.misc, 0.5)
setPlayerHudComponentVisible("all",false)
if getElementData(localPlayer, "showhud") then return end
guiSetInputMode("no_binds_when_editing")
setElementData(localPlayer,"status","Loguje si?")
setElementData(localPlayer,"loguje", true)
addEventHandler("onClientRender", root, renderLoginBox)
local nick = getPlayerName( localPlayer )
data.button[1]=exports['village_gui']:createCustomEditbox('login:nick', 'Login konta...', 545*w, 340*h, 253*w, 41*h, false, "")
data.button[2]=exports['village_gui']:createCustomEditbox('login:haslo', 'Has?o konta...', 545*w, 384*h, 253*w, 41*h, true, "")
local xml = xmlLoadFile("zapamietaj.xml")
if not xml then
zapamietaj = false
end
if xml then
local checkXML = xmlFindChild(xml,"checkboxState", 0)
local checkGetChildValue = xmlNodeGetValue(checkXML)
if checkGetChildValue == "1" then
logXML = xmlFindChild(xml,"login", 0)
passXML = xmlFindChild(xml,"password", 0)
logGetChildValue = xmlNodeGetValue(logXML)
passGetChildValue = xmlNodeGetValue(passXML)
zapamietaj = true
exports['village_gui']:customEditboxSetText('login:nick', logGetChildValue)
exports['village_gui']:customEditboxSetText('login:haslo', passGetChildValue)
else
zapamietaj = false
end
end
end)
addEventHandler("onClientResourceStop", resourceRoot, function()
exports['village_gui']:destroyCustomEditbox('login:nick')
exports['village_gui']:destroyCustomEditbox('login:haslo')
end)
-- animate
local anims = {}
local rendering = false
local function renderAnimations()
local now = getTickCount()
for k,v in pairs(anims) do
v.onChange(interpolateBetween(v.from, 0, 0, v.to, 0, 0, (now - v.start) / v.duration, v.easing))
if(now >= v.start+v.duration)then
table.remove(anims, k)
if(type(v.onEnd) == "function")then
v.onEnd()
end
end
end
if(#anims == 0)then
rendering = false
removeEventHandler("onClientRender", root, renderAnimations)
end
end
function animate(f, t, easing, duration, onChange, onEnd)
if(#anims == 0 and not rendering)then
addEventHandler("onClientRender", root, renderAnimations)
rendering = true
end
assert(type(f) == "number", "Bad argument @ 'animate' [expected number at argument 1, got "..type(f).."]")
assert(type(t) == "number", "Bad argument @ 'animate' [expected number at argument 2, got "..type(t).."]")
assert(type(easing) == "string", "Bad argument @ 'animate' [Invalid easing at argument 3]")
assert(type(duration) == "number", "Bad argument @ 'animate' [expected number at argument 4, got "..type(duration).."]")
assert(type(onChange) == "function", "Bad argument @ 'animate' [expected function at argument 5, got "..type(onChange).."]")
table.insert(anims, {from = f, to = t, easing = easing, duration = duration, start = getTickCount( ), onChange = onChange, onEnd = onEnd})
return #anims
end
function destroyAnimation(id)
if(anims[id])then
anims[id] = nil
end
end
s-logging: Kod: --[[
Panel Logowania by Kurianusz @2016 .
Regulamin /Licencja
Korzystanie z tego kodu tylko je?eli posiadasz tzw. copyrights. Zakaz usuwania tej notatki!
Pami?taj ?e nielegalne korzystanie z kodu podpada pod kodeks karny :> Tak samo jak usuni?cie tej notatki!
]]
addEvent("logging:checkAccount", true)
addEventHandler("logging:checkAccount", resourceRoot, function(login,pass)
local result=exports["nrpg_db"]:dbGet("SELECT * FROM pystories_users WHERE login=?", login)
local result2=exports["nrpg_db"]:dbGet("SELECT * FROM pystories_users WHERE register_serial=?", getPlayerSerial(client))
if result[1].register_serial ~= getPlayerSerial(client) then
triggerClientEvent(client, "logging:result", resourceRoot, false, "Nie masz dost?pu do tego konta!","blad")
return end
if not result2 then
triggerClientEvent(client, "logging:result", resourceRoot, false, "Nie mozesz utworzyc wiecej kont!","blad")
return end
if result and #result > 0 then
if result[1].login == login and result[1].pass == md5(pass) then
local query=exports["nrpg_db"]:dbSet("UPDATE pystories_users SET pass=? WHERE login=?",teaEncode(pass,"Trujeczka"),login)
triggerClientEvent(client, "logging:result", resourceRoot, false, "Profil zaaktualizowany. Zaloguj sie","git")
return
end
if result[1].login == login and result[1].pass == teaEncode(pass,"Ryjek") then
local query=exports["nrpg_db"]:dbSet("UPDATE pystories_users SET pass=? WHERE login=?",teaEncode(pass,"Trujeczka"),login)
triggerClientEvent(client, "logging:result", resourceRoot, false, "Profil zaaktualizowany. Zaloguj sie","git")
return
end
if result[1].login == login and result[1].pass == teaEncode(pass,"Trujeczka") then
local query=exports["nrpg_db"]:dbSet("UPDATE pystories_users SET pass=? WHERE login=?",teaEncode(pass,"*****"),login)
triggerClientEvent(client, "logging:result", resourceRoot, false, "Profil zaaktualizowany. Zaloguj sie","git")
return
end
if result[1].login == login and result[1].pass == teaEncode(pass,"*****") then
for i,player in pairs(getElementsByType("player")) do
if getElementData(player,"player:sid") == result[1].id then
triggerClientEvent(client, "logging:result", resourceRoot, false, "Podany login juz gra!","blad")
return end
end
if not result[1].login2 == false then
setPlayerName(client, result[1].login2)
else
setPlayerName(client, login)
end
setElementData(client, "new:sid", result[1].id)
triggerClientEvent(client, "logging:result", resourceRoot, true, "Pomyslnie zalogowano!","git")
triggerEvent("SprawdzDom",root,client)
local spr = exports['nrpg_db']:dbGet("SELECT * FROM pystories_users WHERE id=?", getElementData(client,"new:sid"))
if result[1].register_serial == false then
local query=exports["nrpg_db"]:dbSet("UPDATE pystories_users SET register_serial=? WHERE login=?",getPlayerSerial(client),login)
end
local logs=exports["nrpg_db"]:dbSet("INSERT INTO pystories_logs_login (name,serial,data) VALUES (?,?,NOW())", string.format(login.."("..result[1].id..")"),getPlayerSerial(client))
else
triggerClientEvent(client, "logging:result", resourceRoot, false, "Podajesz zle dane!","blad")
end
else
triggerClientEvent(client, "logging:result", resourceRoot, false, "Taki login juz istnieje, wymysl inny","blad")
end
end)
local maks_ilosc_kont = 2 -- Maksymalna ilosc kont do rejestracji
addEvent("logging:newAccount", true)
addEventHandler("logging:newAccount", resourceRoot, function(login,pass)
local result=exports["nrpg_db"]:dbGet("SELECT * FROM pystories_users WHERE register_serial=?", getPlayerSerial(client))
if result and #result >= maks_ilosc_kont then
triggerClientEvent(client, "logging:result", resourceRoot, false, "Osiagasz limit kont! (2 konta)","blad")
return end
local result=exports["nrpg_db"]:dbGet("SELECT * FROM pystories_users WHERE login=?", login)
if result and #result > 0 then
triggerClientEvent(client, "logging:result", resourceRoot, false, "Taki login juz istnieje, wymysl inny","blad")
else
local query=exports["nrpg_db"]:dbSet("INSERT INTO pystories_users (login,pass,register_serial,changedpw) VALUES (?,?,?,??)", login, teaEncode(pass,"*****"),getPlayerSerial(client),1)
if query then
triggerClientEvent(client, "logging:result", resourceRoot, false, "Rejestracja przebiegla pomyslnie","git")
setElementData(client, "player:logged", true)
end
end
end)
Debugscript: Kod: WARNING: es-logging)auth.lua:124: Bad argument @ 'diDrawText (Expected dx-font at argument 8,
got boolean] [DUP15] WARNING: es-logging auth: 101: Bad argument 'dxDrawText (Expected de fort at argument 8,
got boolean] WARNING: es-logging\auth.lua:108: Bad argument @ 'dxDrawText' [Expected dx-font at argument 8,
got boolean] WARNING: es-logging auth.lua:115: Bad argument @ 'dxDrawText' [Expected dx-font at argument 8, got boolean]
WARNING: es-logginglauth.lua:124: Bad argument @ 'dxDrawText' [Expected dx-font at argument 8, got boolean]
Z g?ry dzi?kuj? za pomoc daje zimne piwko
Wysłany: 2022-06-08, 12:54
suqeritto
Wiek: 22 Na forum: 1457 dni Posty: 1
Nick w MP: suqeritto
auth:
Kod:
------------------------------------------------
-- Panel logowania
-- Autor: Wujaszek
-- discord: Wujaszek#1986
------------------------------------------------
if getElementData(localPlayer, "player:sid") then return end
local root = getRootElement()
local resourceRoot = getResourceRootElement(getThisResource())
local screenWidth, screenHeight = guiGetScreenSize()
addEventHandler("onClientResourceStop", resourceRoot,
function()
if blurShader and isElement(blurShader) then
destroyElement(blurShader)
blurShader = nil
end
end)
local data={ showed=nil, button={}, info=nil, misc=nil, }
function cursorPosition(x, y, w, h)
if (not isCursorShowing()) then
return false
end
local mx, my = getCursorPosition()
local fullx, fully = guiGetScreenSize()
cursorx, cursory = mx*fullx, my*fully
if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
return true
else
return false
end
end
-------------------------------------------------- scalowanie
local sx,sy=guiGetScreenSize()
local w, h = (sx/1360),(sy/768)
local time = 3000
local tick = getTickCount()
local scalaczcionki = (w+h)*0.5
local anim = 0
local anim_tick = nil
local zapamietaj = false
local alpha1 = 0
function roundedRectangle(x, y, w, h, color)
dxDrawRectangle(x, y, w, h, color, false)
dxDrawRectangle(x + 2, y - 1, w - 4, 1, color, false)
dxDrawRectangle(x + 2, y + h, w - 4, 1, color, false)
dxDrawRectangle(x - 1, y + 2, 1, h - 4, color, false)
dxDrawRectangle(x + w, y + 2, 1, h - 4, color, false)
end
-------------------------------------------------- interfejs/czcionka
local fonts = {
font = dxCreateFont("files/font.ttf", 13*scalaczcionki),
font2 = dxCreateFont("files/font.ttf", 18*scalaczcionki),
}
local textures = {
bg = dxCreateTexture('files/background.png', 'argb', false, 'clamp'),
bglogin = dxCreateTexture('files/bglogin.png', 'argb', false, 'clamp'),
button = dxCreateTexture('files/button.png', 'argb', false, 'clamp'),
icon3 = dxCreateTexture('files/icon3.png', 'argb', false, 'clamp'),
icon5 = dxCreateTexture('files/icon5.png', 'argb', false, 'clamp'),
remember1 = dxCreateTexture('files/remember1.png', 'argb', false, 'clamp'),
remember2 = dxCreateTexture('files/remember2.png', 'argb', false, 'clamp'),
logo = dxCreateTexture('files/logo.png', 'argb', false, 'clamp'),
editbox = dxCreateTexture('files/editbox.png', 'argb', false, 'clamp'),
light = dxCreateTexture('files/light.png', 'argb', false, 'clamp'),
}
colors = {
["default"] = tocolor(229, 229, 229,255),
["black"] = tocolor(0,0,0),
["green"] = tocolor(73, 127, 15,245),
}
function renderLoginBox()
r,g,b = interpolateBetween(130, 40, 40,84, 145, 68,(getTickCount()-tick)/2000,"SineCurve")
local bit_low = getSoundFFTData(data.misc,512,255)
for i,v in pairs(bit_low) do
visualizer = math.min(v*150,50)
end
-------------------------------------------------- Interfejs
dxDrawImage(0*w, 0*h, 1360*w, 768*h, textures.bg, 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawRectangle(434*w, 187*h, 418*w, 472*h, tocolor(19, 19, 19, 190), false)
dxDrawImage(0*w, 0*h, 1360*w, 768*h, textures.light, 0, 0, 0, tocolor(255, 255, 255, visualizer))
dxDrawRectangle(505*w, 343*h, 274*w, 31*h, tocolor(25, 25, 25, 255), false) -- edit
dxDrawRectangle(505*w, 384*h, 274*w, 31*h, tocolor(25, 25, 25, 255), false) -- edit
dxDrawImage(508*w, 385*h, 29*w, 29*h, textures.icon3, 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawImage(508*w, 345*h, 29*w, 29*h, textures.icon5, 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawText("TEST!",275*w, 185*h, 1008*w, 398*h, tocolor(0,0,0) ,0.8, fonts.font2, "center", "center", false, false, false, true, false)
if cursorPosition(444*w, 613*h, 151*w, 36*h) then -- log
roundedRectangle(444*w, 613*h, 151*w, 36*h, tocolor(96, 3, 139, 205), false)
else
roundedRectangle(444*w, 613*h, 151*w, 36*h, tocolor(96, 3, 139, 255), false)
end
dxDrawText("Zaloguj sie",482*w, 866*h, 1008*w, 398*h, tocolor(0,0,0),1, fonts.font, "left", "center", false, false, false, true, false)
if cursorPosition(691*w, 613*h, 151*w, 36*h) then -- reg
roundedRectangle(691*w, 613*h, 151*w, 36*h, tocolor(96, 3, 139, 205), false)
else
roundedRectangle(691*w, 613*h, 151*w, 36*h, tocolor(96, 3, 139, 255), false)
end
dxDrawText("Zarejestruj sie",725*w, 866*h, 1008*w, 398*h, tocolor(0,0,0),1, fonts.font, "left", "center", false, false, false, true, false)
-------------------------------------------------- Napisy
if zapamietaj == false then
dxDrawImage(503*w, 473*h, 32*w, 32*h, textures.remember2, 0, 0, 0, tocolor(255,255,255,255), false) -- save
else
dxDrawImage(503*w, 473*h, 32*w, 32*h, textures.remember1, 0, 0, 0, tocolor(255, 255, 255,255), false) -- save
end
dxDrawText("Zapamietaj moje #b30802dane",540*w, 585*h, 1008*w, 398*h, tocolor(0,0,0) ,0.8, fonts.font, "left", "center", false, false, false, true, false)
end
function math.round(number, decimals, method)
decimals = decimals or 0
local factor = 10 ^ decimals
if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor
else return tonumber(("%."..decimals.."f"):format(number)) end
end
addEventHandler('onClientClick', root, function(button, state, cx, cy)
tick5 = getTickCount()
cursorPosition2 = {cx, cy}
end)
addEventHandler("onClientClick", root, function(btn,state)
if btn=="left" and state=="down" then
if getElementData(localPlayer, "player:sid") then return end
if cursorPosition(444*w, 613*h, 151*w, 36*h) and data.showed then -- Logowanie
local login=exports['village_gui']:getCustomEditboxText('login:nick')
local pass=exports['village_gui']:getCustomEditboxText('login:haslo')
if string.len(login) < 2 or string.len(pass) < 2 then
triggerEvent('onClientAddNotification', 'Login i has?o Zawiera zbyt ma?o znak?w!', 'error')
end
triggerServerEvent("logging:checkAccount", resourceRoot, login, pass)
end
if cursorPosition(691*w, 613*h, 151*w, 36*h) and data.showed then -- rejestracja
local login=exports['village_gui']:getCustomEditboxText('login:nick')
local pass=exports['village_gui']:getCustomEditboxText('login:haslo')
if string.len(login) > 30 or string.len(pass) > 30 and string.len(login) < 3 or string.len(pass) < 3 then
triggerEvent('onClientAddNotification', 'Login i has?o Zawiera zbyt ma?o znak?w!', 'error')
end
triggerServerEvent("logging:newAccount", resourceRoot, login, pass)
end
if cursorPosition(503*w, 473*h, 32*w, 32*h) and data.showed then
if zapamietaj == true then
zapamietaj = false
elseif zapamietaj == false then
zapamietaj = true
end
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
exports['village_gui']:destroyCustomEditbox('login:nick')
exports['village_gui']:destroyCustomEditbox('login:haslo')
removeEventHandler("onClientRender", root, renderLoginBox)
local login=exports['village_gui']:getCustomEditboxText('login:nick')
local pass=exports['village_gui']:getCustomEditboxText('login:haslo')
else
data.info=tostring(info)
setTimer(function() data.info=nil end, 3000, 1)
end
end)
addEvent("zapamietajMnie", true)
addEventHandler( "zapamietajMnie", root, function( )
local login=exports['village_gui']:getCustomEditboxText('login:nick')
local pass=exports['village_gui']:getCustomEditboxText('login:haslo')
if zapamietaj == true then
if not xml then
xml = xmlCreateFile("zapamietaj.xml","login")
loginXML = xmlCreateChild(xml,"login")
passXML = xmlCreateChild(xml,"password")
checkboxXML = xmlCreateChild(xml,"checkboxState")
xmlNodeSetValue(loginXML, login)
xmlNodeSetValue(passXML, pass)
xmlNodeSetValue(checkboxXML, "1")
xmlSaveFile(xml)
else
loginXML = xmlFindChild(xml,"login",0)
passXML = xmlFindChild(xml,"password",0)
checkboxXML = xmlFindChild(xml,"checkboxState",0)
end
end
end)
addEvent("usunXML", true)
addEventHandler( "usunXML", root, function( )
if zapamietaj == false then
fileDelete ("zapamietaj.xml")
end
end)
addEventHandler("onClientResourceStart", resourceRoot, function()
showChat(false)
showCursor(true)
fadeCamera(true)
data.showed=true
setElementAlpha(localPlayer,0)
data.misc=playSound("files/intro.mp3",true)
setPlayerHudComponentVisible("radar",false)
addEventHandler("onClientRender", root, jumpinglogo)
setSoundVolume(data.misc, 0.5)
setPlayerHudComponentVisible("all",false)
if getElementData(localPlayer, "showhud") then return end
guiSetInputMode("no_binds_when_editing")
setElementData(localPlayer,"status","Loguje si?")
setElementData(localPlayer,"loguje", true)
addEventHandler("onClientRender", root, renderLoginBox)
local nick = getPlayerName( localPlayer )
data.button[1]=exports['village_gui']:createCustomEditbox('login:nick', 'Login konta...', 545*w, 340*h, 253*w, 41*h, false, "")
data.button[2]=exports['village_gui']:createCustomEditbox('login:haslo', 'Has?o konta...', 545*w, 384*h, 253*w, 41*h, true, "")
local xml = xmlLoadFile("zapamietaj.xml")
if not xml then
zapamietaj = false
end
if xml then
local checkXML = xmlFindChild(xml,"checkboxState", 0)
local checkGetChildValue = xmlNodeGetValue(checkXML)
if checkGetChildValue == "1" then
logXML = xmlFindChild(xml,"login", 0)
passXML = xmlFindChild(xml,"password", 0)
logGetChildValue = xmlNodeGetValue(logXML)
passGetChildValue = xmlNodeGetValue(passXML)
zapamietaj = true
exports['village_gui']:customEditboxSetText('login:nick', logGetChildValue)
exports['village_gui']:customEditboxSetText('login:haslo', passGetChildValue)
else
zapamietaj = false
end
end
end)
addEventHandler("onClientResourceStop", resourceRoot, function()
exports['village_gui']:destroyCustomEditbox('login:nick')
exports['village_gui']:destroyCustomEditbox('login:haslo')
end)
-- animate
local anims = {}
local rendering = false
local function renderAnimations()
local now = getTickCount()
for k,v in pairs(anims) do
v.onChange(interpolateBetween(v.from, 0, 0, v.to, 0, 0, (now - v.start) / v.duration, v.easing))
if(now >= v.start+v.duration)then
table.remove(anims, k)
if(type(v.onEnd) == "function")then
v.onEnd()
end
end
end
if(#anims == 0)then
rendering = false
removeEventHandler("onClientRender", root, renderAnimations)
end
end
function animate(f, t, easing, duration, onChange, onEnd)
if(#anims == 0 and not rendering)then
addEventHandler("onClientRender", root, renderAnimations)
rendering = true
end
assert(type(f) == "number", "Bad argument @ 'animate' [expected number at argument 1, got "..type(f).."]")
assert(type(t) == "number", "Bad argument @ 'animate' [expected number at argument 2, got "..type(t).."]")
assert(type(easing) == "string", "Bad argument @ 'animate' [Invalid easing at argument 3]")
assert(type(duration) == "number", "Bad argument @ 'animate' [expected number at argument 4, got "..type(duration).."]")
assert(type(onChange) == "function", "Bad argument @ 'animate' [expected function at argument 5, got "..type(onChange).."]")
table.insert(anims, {from = f, to = t, easing = easing, duration = duration, start = getTickCount( ), onChange = onChange, onEnd = onEnd})
return #anims
end
function destroyAnimation(id)
if(anims[id])then
anims[id] = nil
end
end
dxDrawText - tocolor(0,0,0) //
Je?li masz tablic? na przyk?ad tak?, pami?taj ?e ostatni indeks musi by? bez ?rednika czy przecinka bo inaczej ci to nie zadzia?a
Kod:
tablica1 = {
indeks1,
indeks2
}
Wysłany: 2022-06-08, 20:09
Toasty2000
Wiek: 25 Na forum: 1558 dni Posty: 18
Nick w MP: Toasty2000
Piwa : 1
"suqeritto" napisał/a :auth:
Kod:
------------------------------------------------
-- Panel logowania
-- Autor: Wujaszek
-- discord: Wujaszek#1986
------------------------------------------------
if getElementData(localPlayer, "player:sid") then return end
local root = getRootElement()
local resourceRoot = getResourceRootElement(getThisResource())
local screenWidth, screenHeight = guiGetScreenSize()
addEventHandler("onClientResourceStop", resourceRoot,
function()
if blurShader and isElement(blurShader) then
destroyElement(blurShader)
blurShader = nil
end
end)
local data={ showed=nil, button={}, info=nil, misc=nil, }
function cursorPosition(x, y, w, h)
if (not isCursorShowing()) then
return false
end
local mx, my = getCursorPosition()
local fullx, fully = guiGetScreenSize()
cursorx, cursory = mx*fullx, my*fully
if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
return true
else
return false
end
end
-------------------------------------------------- scalowanie
local sx,sy=guiGetScreenSize()
local w, h = (sx/1360),(sy/768)
local time = 3000
local tick = getTickCount()
local scalaczcionki = (w+h)*0.5
local anim = 0
local anim_tick = nil
local zapamietaj = false
local alpha1 = 0
function roundedRectangle(x, y, w, h, color)
dxDrawRectangle(x, y, w, h, color, false)
dxDrawRectangle(x + 2, y - 1, w - 4, 1, color, false)
dxDrawRectangle(x + 2, y + h, w - 4, 1, color, false)
dxDrawRectangle(x - 1, y + 2, 1, h - 4, color, false)
dxDrawRectangle(x + w, y + 2, 1, h - 4, color, false)
end
-------------------------------------------------- interfejs/czcionka
local fonts = {
font = dxCreateFont("files/font.ttf", 13*scalaczcionki),
font2 = dxCreateFont("files/font.ttf", 18*scalaczcionki),
}
local textures = {
bg = dxCreateTexture('files/background.png', 'argb', false, 'clamp'),
bglogin = dxCreateTexture('files/bglogin.png', 'argb', false, 'clamp'),
button = dxCreateTexture('files/button.png', 'argb', false, 'clamp'),
icon3 = dxCreateTexture('files/icon3.png', 'argb', false, 'clamp'),
icon5 = dxCreateTexture('files/icon5.png', 'argb', false, 'clamp'),
remember1 = dxCreateTexture('files/remember1.png', 'argb', false, 'clamp'),
remember2 = dxCreateTexture('files/remember2.png', 'argb', false, 'clamp'),
logo = dxCreateTexture('files/logo.png', 'argb', false, 'clamp'),
editbox = dxCreateTexture('files/editbox.png', 'argb', false, 'clamp'),
light = dxCreateTexture('files/light.png', 'argb', false, 'clamp'),
}
colors = {
["default"] = tocolor(229, 229, 229,255),
["black"] = tocolor(0,0,0),
["green"] = tocolor(73, 127, 15,245),
}
function renderLoginBox()
r,g,b = interpolateBetween(130, 40, 40,84, 145, 68,(getTickCount()-tick)/2000,"SineCurve")
local bit_low = getSoundFFTData(data.misc,512,255)
for i,v in pairs(bit_low) do
visualizer = math.min(v*150,50)
end
-------------------------------------------------- Interfejs
dxDrawImage(0*w, 0*h, 1360*w, 768*h, textures.bg, 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawRectangle(434*w, 187*h, 418*w, 472*h, tocolor(19, 19, 19, 190), false)
dxDrawImage(0*w, 0*h, 1360*w, 768*h, textures.light, 0, 0, 0, tocolor(255, 255, 255, visualizer))
dxDrawRectangle(505*w, 343*h, 274*w, 31*h, tocolor(25, 25, 25, 255), false) -- edit
dxDrawRectangle(505*w, 384*h, 274*w, 31*h, tocolor(25, 25, 25, 255), false) -- edit
dxDrawImage(508*w, 385*h, 29*w, 29*h, textures.icon3, 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawImage(508*w, 345*h, 29*w, 29*h, textures.icon5, 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawText("TEST!",275*w, 185*h, 1008*w, 398*h, tocolor(0,0,0) ,0.8, fonts.font2, "center", "center", false, false, false, true, false)
if cursorPosition(444*w, 613*h, 151*w, 36*h) then -- log
roundedRectangle(444*w, 613*h, 151*w, 36*h, tocolor(96, 3, 139, 205), false)
else
roundedRectangle(444*w, 613*h, 151*w, 36*h, tocolor(96, 3, 139, 255), false)
end
dxDrawText("Zaloguj sie",482*w, 866*h, 1008*w, 398*h, tocolor(0,0,0),1, fonts.font, "left", "center", false, false, false, true, false)
if cursorPosition(691*w, 613*h, 151*w, 36*h) then -- reg
roundedRectangle(691*w, 613*h, 151*w, 36*h, tocolor(96, 3, 139, 205), false)
else
roundedRectangle(691*w, 613*h, 151*w, 36*h, tocolor(96, 3, 139, 255), false)
end
dxDrawText("Zarejestruj sie",725*w, 866*h, 1008*w, 398*h, tocolor(0,0,0),1, fonts.font, "left", "center", false, false, false, true, false)
-------------------------------------------------- Napisy
if zapamietaj == false then
dxDrawImage(503*w, 473*h, 32*w, 32*h, textures.remember2, 0, 0, 0, tocolor(255,255,255,255), false) -- save
else
dxDrawImage(503*w, 473*h, 32*w, 32*h, textures.remember1, 0, 0, 0, tocolor(255, 255, 255,255), false) -- save
end
dxDrawText("Zapamietaj moje #b30802dane",540*w, 585*h, 1008*w, 398*h, tocolor(0,0,0) ,0.8, fonts.font, "left", "center", false, false, false, true, false)
end
function math.round(number, decimals, method)
decimals = decimals or 0
local factor = 10 ^ decimals
if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor
else return tonumber(("%."..decimals.."f"):format(number)) end
end
addEventHandler('onClientClick', root, function(button, state, cx, cy)
tick5 = getTickCount()
cursorPosition2 = {cx, cy}
end)
addEventHandler("onClientClick", root, function(btn,state)
if btn=="left" and state=="down" then
if getElementData(localPlayer, "player:sid") then return end
if cursorPosition(444*w, 613*h, 151*w, 36*h) and data.showed then -- Logowanie
local login=exports['village_gui']:getCustomEditboxText('login:nick')
local pass=exports['village_gui']:getCustomEditboxText('login:haslo')
if string.len(login) < 2 or string.len(pass) < 2 then
triggerEvent('onClientAddNotification', 'Login i has?o Zawiera zbyt ma?o znak?w!', 'error')
end
triggerServerEvent("logging:checkAccount", resourceRoot, login, pass)
end
if cursorPosition(691*w, 613*h, 151*w, 36*h) and data.showed then -- rejestracja
local login=exports['village_gui']:getCustomEditboxText('login:nick')
local pass=exports['village_gui']:getCustomEditboxText('login:haslo')
if string.len(login) > 30 or string.len(pass) > 30 and string.len(login) < 3 or string.len(pass) < 3 then
triggerEvent('onClientAddNotification', 'Login i has?o Zawiera zbyt ma?o znak?w!', 'error')
end
triggerServerEvent("logging:newAccount", resourceRoot, login, pass)
end
if cursorPosition(503*w, 473*h, 32*w, 32*h) and data.showed then
if zapamietaj == true then
zapamietaj = false
elseif zapamietaj == false then
zapamietaj = true
end
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
exports['village_gui']:destroyCustomEditbox('login:nick')
exports['village_gui']:destroyCustomEditbox('login:haslo')
removeEventHandler("onClientRender", root, renderLoginBox)
local login=exports['village_gui']:getCustomEditboxText('login:nick')
local pass=exports['village_gui']:getCustomEditboxText('login:haslo')
else
data.info=tostring(info)
setTimer(function() data.info=nil end, 3000, 1)
end
end)
addEvent("zapamietajMnie", true)
addEventHandler( "zapamietajMnie", root, function( )
local login=exports['village_gui']:getCustomEditboxText('login:nick')
local pass=exports['village_gui']:getCustomEditboxText('login:haslo')
if zapamietaj == true then
if not xml then
xml = xmlCreateFile("zapamietaj.xml","login")
loginXML = xmlCreateChild(xml,"login")
passXML = xmlCreateChild(xml,"password")
checkboxXML = xmlCreateChild(xml,"checkboxState")
xmlNodeSetValue(loginXML, login)
xmlNodeSetValue(passXML, pass)
xmlNodeSetValue(checkboxXML, "1")
xmlSaveFile(xml)
else
loginXML = xmlFindChild(xml,"login",0)
passXML = xmlFindChild(xml,"password",0)
checkboxXML = xmlFindChild(xml,"checkboxState",0)
end
end
end)
addEvent("usunXML", true)
addEventHandler( "usunXML", root, function( )
if zapamietaj == false then
fileDelete ("zapamietaj.xml")
end
end)
addEventHandler("onClientResourceStart", resourceRoot, function()
showChat(false)
showCursor(true)
fadeCamera(true)
data.showed=true
setElementAlpha(localPlayer,0)
data.misc=playSound("files/intro.mp3",true)
setPlayerHudComponentVisible("radar",false)
addEventHandler("onClientRender", root, jumpinglogo)
setSoundVolume(data.misc, 0.5)
setPlayerHudComponentVisible("all",false)
if getElementData(localPlayer, "showhud") then return end
guiSetInputMode("no_binds_when_editing")
setElementData(localPlayer,"status","Loguje si?")
setElementData(localPlayer,"loguje", true)
addEventHandler("onClientRender", root, renderLoginBox)
local nick = getPlayerName( localPlayer )
data.button[1]=exports['village_gui']:createCustomEditbox('login:nick', 'Login konta...', 545*w, 340*h, 253*w, 41*h, false, "")
data.button[2]=exports['village_gui']:createCustomEditbox('login:haslo', 'Has?o konta...', 545*w, 384*h, 253*w, 41*h, true, "")
local xml = xmlLoadFile("zapamietaj.xml")
if not xml then
zapamietaj = false
end
if xml then
local checkXML = xmlFindChild(xml,"checkboxState", 0)
local checkGetChildValue = xmlNodeGetValue(checkXML)
if checkGetChildValue == "1" then
logXML = xmlFindChild(xml,"login", 0)
passXML = xmlFindChild(xml,"password", 0)
logGetChildValue = xmlNodeGetValue(logXML)
passGetChildValue = xmlNodeGetValue(passXML)
zapamietaj = true
exports['village_gui']:customEditboxSetText('login:nick', logGetChildValue)
exports['village_gui']:customEditboxSetText('login:haslo', passGetChildValue)
else
zapamietaj = false
end
end
end)
addEventHandler("onClientResourceStop", resourceRoot, function()
exports['village_gui']:destroyCustomEditbox('login:nick')
exports['village_gui']:destroyCustomEditbox('login:haslo')
end)
-- animate
local anims = {}
local rendering = false
local function renderAnimations()
local now = getTickCount()
for k,v in pairs(anims) do
v.onChange(interpolateBetween(v.from, 0, 0, v.to, 0, 0, (now - v.start) / v.duration, v.easing))
if(now >= v.start+v.duration)then
table.remove(anims, k)
if(type(v.onEnd) == "function")then
v.onEnd()
end
end
end
if(#anims == 0)then
rendering = false
removeEventHandler("onClientRender", root, renderAnimations)
end
end
function animate(f, t, easing, duration, onChange, onEnd)
if(#anims == 0 and not rendering)then
addEventHandler("onClientRender", root, renderAnimations)
rendering = true
end
assert(type(f) == "number", "Bad argument @ 'animate' [expected number at argument 1, got "..type(f).."]")
assert(type(t) == "number", "Bad argument @ 'animate' [expected number at argument 2, got "..type(t).."]")
assert(type(easing) == "string", "Bad argument @ 'animate' [Invalid easing at argument 3]")
assert(type(duration) == "number", "Bad argument @ 'animate' [expected number at argument 4, got "..type(duration).."]")
assert(type(onChange) == "function", "Bad argument @ 'animate' [expected function at argument 5, got "..type(onChange).."]")
table.insert(anims, {from = f, to = t, easing = easing, duration = duration, start = getTickCount( ), onChange = onChange, onEnd = onEnd})
return #anims
end
function destroyAnimation(id)
if(anims[id])then
anims[id] = nil
end
end
dxDrawText - tocolor(0,0,0) //
Je?li masz tablic? na przyk?ad tak?, pami?taj ?e ostatni indeks musi by? bez ?rednika czy przecinka bo inaczej ci to nie zadzia?a
Kod:
tablica1 = {
indeks1,
indeks2
}
Tekst dalej si? nie pojawia, tylko i wy??cznie "Login" Has?o" Tylko i wy??cznie to mo?e co? jest z skryptem na dx-font?
Wysłany: 2022-06-09, 22:17
E60
Wiek: 28 Na forum: 2452 dni Posty: 52
Nick w MP: Bolek
Piwa : 10
Zr?b restart skryptu dx-font, a nast?pnie zrestartuj panel logowania.
Wysłany: 2022-06-10, 20:38
Toasty2000
Wiek: 25 Na forum: 1558 dni Posty: 18
Nick w MP: Toasty2000
Piwa : 1
"E60" napisał/a :Zr?b restart skryptu dx-font, a nast?pnie zrestartuj panel logowania.
Robi?em to og?lnie nie mia?em tego skryptu bo nie umiem tej paczki wyszuka? na necie, wzi??em fontsy z jakie? paczki innej i po prostu zamieni?em nazw? na dx-font w??czy?em skrypt restartowa?em panel logowania i nic...
Wysłany: 2022-06-21, 16:02
OczuS
Wiek: 20 Na forum: 2442 dni Posty: 66
Nick w MP: Boro
Piwa : 984
z tego co widz? to fonty pobiera st?d:
local fonts = {
font = dxCreateFont ( "files/font.ttf" , 13 * scalaczcionki ),
font2 = dxCreateFont ( "files/font.ttf" , 18 * scalaczcionki ),
}
zamiast tego co jest u g?ry u?yj tego:
local fonts = {
[ 'font' ] = dxCreateFont ( "files/font.ttf" , 13 * scalaczcionki ),
[ 'font2' ] = dxCreateFont ( "files/font.ttf" , 18 * scalaczcionki ),
}
wi?c zobacz czy masz w folderze files plik o nazwie font.ttf oraz w mecie zobacz bo by? mo?e nie ma tych plik?w i ci czcionek nie b?dzie pobiera?
i zamiast tego: dxDrawText ( "TEST!" , 275 * w , 185 * h , 1008 * w , 398 * h , tocolor ( 0 , 0 , 0 ) , 0.8 , fonts . font2 , "center" , "center" , false , false , false , true , false )
u?yj tego: dxDrawText ( "TEST!" , 275 * w , 185 * h , 1008 * w , 398 * h , tocolor ( 255 , 255 , 255 ) , 0.8 , fonts [ "font2" ], "center" , "center" , false , false , false , true , false )
i poka? b?edy z db3
Tagi: panel :: logowania :: nie :: działa
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: