Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2019-10-11, 17:29


RudyTMM
[Usunięty]










o to ostatnie chodzi!
nie wiem jak podmienic pod ogrpg

 

 
Więcej szczegółów
Wystawiono 1 piw(a):
QustomeR12
Wysłany: 2019-10-11, 18:44


Pr0One







Wiek: 24
Na forum: 3139 dni
Posty: 18
Nick w MP: Pr0One



Respekt: 60

Wy?lij linijke 434 i te 2 eventy

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-10-11, 20:23


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

434: pr?ba por?wnania liczby z nieistniej?c? warto?ci? ('nil')
18: z?y #1 argument getElementData
brak eventu logging:checkAccount
brak eventu logging:Account

Musisz te 2 eventy doda? lub odpowiednio je zmodyfikowa? (np. liter?wka lub s? w og?le inaczej nazwane).

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-10-11, 21:29


RudyTMM
[Usunięty]









kod:

[lua]if getElementData(localPlayer, "player:sid") then return end
local sx,sy = guiGetScreenSize()
zoom = 1920/sx
tick = getTickCount()
local angler = 0
local minesY = 0
local dist = 120
setTimer(function()
local dist = 20
end,3000,1)
player = root
local gui = {
logo = {
x = sx/2+100/zoom ,
y = sy/2-200/zoom,
width = 400/zoom,
height = 400/zoom,
},

lights = {
x = sx/2-0/zoom,
y = sy/2-300/zoom,
width = 600/zoom,
height = 600/zoom,
},

button = {
text = "Zaloguj",
x = sx/2-790/zoom,
y = sy/2+200/zoom,
width = 228/zoom,
height = 68/zoom,
},
button_2 = {
text = "Zarejestruj",
x = sx/2-790/zoom,
y = sy/2+300/zoom,
width = 228/zoom,
height = 68/zoom,
},
background = {
x = sx/2-1000/zoom,
y = sy/2-1320/zoom,
width = 625/zoom,
height = 1920/zoom,
},
news = {
x = sx/2-790/zoom,
y = sy/2-400/zoom,
width = 228/zoom,
height = 68/zoom,
},

newsy = [[
Nowo?ci :
1. Oficjalne rozpocz?cie prac - 28.09.2019

]]

}

font = dxCreateFont('font.ttf',17/zoom)





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
function logo()
if (data.misc) then
interpolation = interpolateBetween(400,0,0,0,0,0,(getTickCount()-tick)/3000,'OutQuad');
local bt = getSoundFFTData(data.misc,2048, 230)
if (not bt) then return end

for i,v in pairs(bt) do
jumps = round((v * 80), 0) > 100 and 100 or round((v * 100), 0)
opacity = round((v * 400), 0) > 540 and 540 or round((v * 540), 0)
end

if logo == false then
alpha = interpolateBetween(255,0,0,0,0,0,(getTickCount()-tick)/3000,"InQuad")
else
alpha = interpolateBetween(0,0,0,255,0,0,(getTickCount()-tick)/3000,"InQuad")
end

if logo == false then
dxDrawImage(gui.lights.x - (jumps / 2)+interpolation, gui.lights.y - (jumps / 2), gui.lights.width + jumps, gui.lights.height + jumps, "img/light.png", 0, 0, 0, tocolor(255, 255, 255, alpha), true)
dxDrawImage(gui.logo.x - (jumps / 2) + interpolation,gui.logo.y - (jumps / 2), gui.logo.width + jumps,gui.logo.height + jumps, "img/logo.png", 0, 0, 0, tocolor(255, 255, 255, alpha), true)
else
dxDrawImage(gui.lights.x - (jumps / 2)+interpolation, gui.lights.y - (jumps / 2), gui.lights.width + jumps, gui.lights.height + jumps, "img/light.png", 0, 0, 0, tocolor(255, 255, 255, opacity + alpha), true)
dxDrawImage(gui.logo.x - (jumps / 2) + interpolation,gui.logo.y - (jumps / 2), gui.logo.width + jumps,gui.logo.height + jumps, "img/logo.png", 0, 0, 0, tocolor(255, 255, 255, alpha), true)
end
end
end

function renderLoginBox()
backgroundCamera()
local interpolation = interpolateBetween(-400,0,0,0,0,0,(getTickCount()-tick)/3000,'OutQuad');
dxDrawImage(gui.background.x + interpolation, gui.background.y, gui.background.width, gui.background.height,'img/background.png', 0, 0, 0, tocolor(255, 255, 255, alpha), false)
if not isMouseIn(gui.button_2.x,gui.button_2.y,gui.button_2.width,gui.button_2.height) then
dxDrawImage(gui.button_2.x + interpolation,gui.button_2.y,gui.button_2.width,gui.button_2.height,'img/button.png', 0, 0, 0, tocolor(255, 255, 255, alpha), false)
else
dxDrawImage(gui.button_2.x,gui.button_2.y,gui.button_2.width,gui.button_2.height, 'img/button_active.png', 0, 0, 0, tocolor(255, 255, 255, alpha), false)
end
if not isMouseIn(gui.button.x, gui.button.y, gui.button.width, gui.button.height) then
dxDrawImage(gui.button.x + interpolation, gui.button.y, gui.button.width, gui.button.height, 'img/button.png', 0, 0, 0, tocolor(255, 255, 255, alpha), false)
else
dxDrawImage(gui.button.x, gui.button.y, gui.button.width, gui.button.height, 'img/button_active.png', 0, 0, 0, tocolor(255, 255, 255, alpha), false)
end
dxDrawText(gui.button.text, gui.button.x + interpolation, gui.button.y, gui.button.x + gui.button.width, gui.button.y + gui.button.height, tocolor(255, 255, 255, 255), 1, font, "center", "center")
dxDrawText(gui.button_2.text, gui.button_2.x + interpolation, gui.button_2.y, gui.button_2.x + gui.button_2.width, gui.button_2.y + gui.button_2.height, tocolor(255, 255, 255, 255), 1, font, "center", "center")
dxDrawText(gui.newsy,gui.news.x + interpolation, gui.news.y,gui.news.x + gui.news.width, gui.news.y + gui.news.height, tocolor(255, 255, 255, 255), 1, font, "center", "center")
end


addEventHandler("onClientClick", root, function(btn,state)
if btn=="left" and state=="down" then
if isMouseIn(gui.button.x,gui.button.y,gui.button.width,gui.button.height) and data.showed then
local login = edit.login:getText()
local pass = edit.pass:getText()
if string.len(login) < 1 or string.len(pass) < 1 then
data.info="Nale?y wype?ni? wszystkie pola."
return
end
triggerServerEvent("logging:Account", resourceRoot, login, pass)
end
if isMouseIn(gui.button_2.x,gui.button_2.y,gui.button_2.width,gui.button_2.height) and data.showed then
local login= edit.login:getText()
local pass= edit.pass:getText()
if string.len(login) > 22 or string.len(pass) > 22 and string.len(login) < 3 or string.len(pass) < 3 then
data.info="Login i has?o powinno zawiera? 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
edit.login:setVisible(false)
edit.pass:setVisible(false)
showZones(data.misc)
removeEventHandler("onClientRender", root, renderLoginBox)
removeEventHandler("onClientRender", root, logo)
else
data.info=exports['sc_noti']:noti(info,'info')
setTimer(function() data.info=nil end, 3000, 1)
end
end)

addEventHandler("onClientResourceStart", resourceRoot, function()
showChat(false)
showCursor(false)
setTimer(function()
showCursor(true)
end,3000,1)
fadeCamera(true)
data.showed=true
setElementAlpha(localPlayer,0)
setElementData(localPlayer,'shaderBW',true)
edit.pass.masked = true

data.misc=playSound("misc/intro.mp3",true)
showPlayerHudComponent("radar",false)
setSoundVolume(data.misc, 1.0)
showPlayerHudComponent("all",false)
guiSetInputMode("no_binds_when_editing")
setElementData(localPlayer,"status","Loguje si?")
--setElementData(localPlayer,"player:logged",false)
addEventHandler("onClientRender", root, renderLoginBox)
addEventHandler("onClientRender", root, logo)
end)


function backgroundCamera ()
local cameraX, cameraY = getPointFromDistanceRotation(1691.22827, -1549.43811, dist, angler)

if minesY > 59.99 then
minesY = 60
else
minesY = (minesY + 0.0100)
end

setCameraMatrix(cameraX, cameraY, 107.72 + 0.9, 1481.33105, -1749.21191, 90.72 + 0.7)

angler = (angler + 0.5)

end


-- round utils
function 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

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


-- editboxy z mojego starego gm'a

sx,sy = guiGetScreenSize()
x,y = (sx/1920), (sy/1080)
editBox = {}
editBox.__index = editBox
editBox.instances = {}
font = dxCreateFont('font.ttf',13)
function isMouseIn ( 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 )
if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
return true
else
return false
end
end

function sw(value)

return sx*value/1920

end

function sh(value)

return sy*value/1080

end



local numbers = {
["0"] = true,
["1"] = true,
["2"] = true,
["3"] = true,
["4"] = true,
["5"] = true,
["6"] = true,
["7"] = true,
["8"] = true,
["9"] = true,
}

local strange = {
["0"] = true,
["1"] = true,
["2"] = true,
["3"] = true,
["4"] = true,
["5"] = true,
["6"] = true,
["7"] = true,
["8"] = true,
["9"] = true,
["!"] = true,
["@"] = true,
["#"] = true,
["$"] = true,
["%"] = true,
["^"] = true,
["&"] = true,
["*"] = true,
["("] = true,
[")"] = true,
["_"] = true,
["-"] = true,
["="] = true,
["+"] = true,
["["] = true,
["]"] = true,
["{"] = true,
["}"] = true,
["`"] = true,
["~"] = true,
[";"] = true,
[":"] = true,
["'"] = true,
['"'] = true,
[","] = true,
["."] = true,
["<"] = true,
[">"] = true,
["|"] = true,
[" \ "] = true,
["/"] = true,
}

function onClientCharacter(character)
if not isCursorShowing() then
return
end
for k,self in pairs(editBox.instances) do
if self.visible and self.input then
if (string.len(self.text)) < self.maxLength then
if self.onlyNumbers and not numbers[character] then return end
if self.onlyLetters and strange[character] then return end
self.text = self.text..character
end
end
end
end
addEventHandler("onClientCharacter", root, onClientCharacter)

function editBox.new()
local self = setmetatable({}, editBox)
self.text = ""
self.textshow = self.text
self.maxLength = 32
self.scale = 1
self.state = "normal"
self.font = font
self.color = {255,255,255,220}
self.textColor = {255,255,255,220}
table.insert(editBox.instances, self)
return self
end

function editBox:getPosition()
return self.x, self.y, self.w, self.h
end

function editBox:getPositionY()
return self.startPos[2]
end

function editBox:getText()
if self.text == self.textshow then
return ''
end
return self.text
end

function editBox:addPosY(how_much)
self.y=self:getPositionY()+how_much
return true
end

function editBox:setPosition(x,y,w,h)
self.x, self.y, self.w, self.h = x,y,w,h
return true
end

function editBox:setVisible(visible)
self.visible = visible
return true
end

function onClientClick(button,state,cX,cY)
if not isCursorShowing() then
return
end
if button == "left" and state == "up" then
for k,self in pairs(editBox.instances) do
if self.visible then
if self.input then
self.input = nil
self.getOut = true
self.tick = getTickCount()
self.onOutput()
if self.text == "" or self.text == self.textshow then
self.text = self.textshow
self.masked=false
end
end
local x,y,w,h = self:getPosition()
if isMouseIn(x,y,w,h) then
self.input = true
self.onInput()
tick222 = getTickCount()
self.tick = getTickCount()

if self.text == self.textshow then
self.text = ""
if self.masking == true then
self.masked=true
end
end

end
end
end
end
end
addEventHandler("onClientClick", root, onClientClick)

local alpha = 255

set_editboxes_alpha = function(new_number)
alpha = new_number
end

function renderEDIT()
for k,self in pairs(editBox.instances) do
if self.visible then
local px,py,pw,ph = self:getPosition()
local text = self.masked and string.gsub(self.text,".","•") or self.text
local alignX = dxGetTextWidth(text,self.scale,self.font) <= pw and "left" or "left"
-- roundedRectangle(px, py, pw, ph, tocolor(unpack(self.color)), false)
dxDrawText(text,px+x*5, py,px-x*5+pw, py+ph,tocolor(255, 255, 255, alpha),self.scale,self.font, alignX, "center",true, false, true, false, false)

local bit = self.tick or 0

local bit = self.tick or 0

local xd = interpolateBetween(0, 0, 0, pw, 0, 0, (getTickCount()-bit)/350, "OutQuad")

dxDrawRectangle(px, py+ph-sh(5), pw, sh(5), tocolor(99, 99, 99, alpha), true)

if self.input then
self.getOut=nil


dxDrawRectangle(px+pw/2 - xd/2, py+ph-sh(5), xd, sh(5), tocolor(38,206,180,alpha), true)

end

if self.getOut then
local xd2 = interpolateBetween(pw, 0, 0, 0, 0, 0, (getTickCount()-bit)/350, "OutQuad")
--exports["ac-guiLib"]:dxCreateGradient(px, py+ph-sh(5), xd2, sh(5), tocolor(255,255,255,alpha), true)
dxDrawRectangle(px+pw/2 - xd2/2, py+ph-sh(5), xd2, sh(5), tocolor(38,206,180,alpha), true)
if getTickCount()-bit >= 700 then
self.getOut=nil
end
end

if self.input and dxGetTextWidth(text,self.scale,self.font) <= pw then
local lx = dxGetTextWidth(text,self.scale,self.font)+px+x*8
local lx = dxGetTextWidth(text,self.scale,self.font)+px+x*8
dxDrawLine(lx, py+y*10, lx, py+ph-y*10, tocolor(255,255,255,math.abs(math.sin(getTickCount()/300))*200), 2, true)
end
end
end
---
if getKeyState("backspace") then
for k,self in pairs(editBox.instances) do
if self.visible and self.input then
if not keyState then
keyState = getTickCount() + 400
self.text = string.sub(self.text,1,string.len(self.text)-1)
elseif keyState and keyState < getTickCount() then
keyState = getTickCount()+100
self.text = string.sub(self.text,1,string.len(self.text)-1)
end
return
end
end
keyState = nil
end
end
addEventHandler("onClientRender",root,renderEDIT)
--[[editbox={}
editbox.edit = editBox.new()
editbox.edit:editBox.setPosition(sx/2-790/zoom,sy/2+200/zoom,350/zoom,5/zoom)
editbox.edit.editBox.startPos(sx/2-790/zoom,sy/2+200/zoom,350/zoom,5/zoom)
editbox.edit.editBox.setVisible(true)

]]
edit = {}

edit.login = editBox.new()
addEventHandler('onClientRender',root,function()
interpolation = interpolateBetween(-400,0,0,0,0,0,(getTickCount()-tick)/3000,'OutQuad');
edit.login:setPosition(sw(75)+interpolation, sh(479), sw(410), sh(50))
edit.login.startPos = {sw(75)+interpolation, sh(479), sw(410), sh(50)}
end)
edit.login:setVisible(true)
edit.login.color = {26, 177, 133, 130}
edit.login.font = font
edit.login.onlyNumbers = false

edit.login.text = 'Login...'
edit.login.textshow = 'Login...'

edit.login.onInput = function()
edit.login.color = {26, 177, 133, 220}
end
edit.login.onOutput = function()
edit.login.color = {26, 177, 133, 130}
end

edit.pass = editBox.new()
addEventHandler('onClientRender',root,function()
interpolation = interpolateBetween(-400,0,0,0,0,0,(getTickCount()-tick)/3000,'OutQuad');
edit.pass:setPosition(sw(75)+interpolation, sh(586), sw(410), sh(48))
edit.pass.startPos = {sw(75)+interpolation, sh(586), sw(410), sh(48)}
end)

edit.pass.color = {26, 177, 133, 130}
edit.pass.font = font
edit.pass.onlyNumbers = false

edit.pass:setVisible(true)
edit.pass.textshow = 'Has?o..'
edit.pass.text = 'Has?o...'


edit.pass.onInput = function()
edit.pass.color = {26, 177, 133, 220}
end
edit.pass.onOutput = function()
edit.pass.color = {26, 177, 133, 130}
end[/lua]


jak podmienic pod ogrpg?

 

 
Wysłany: 2019-10-11, 21:48


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

No nie ma tych event?w. Musisz je doda? po stronie servera.

Postaw piwo autorowi tego posta
 

 
Tagi: panel :: logowania
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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
Dodaj temat do Ulubionych
Wersja do druku