Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x,y=2313.58, 1282.80-- my width
- intro_step=math.random(0,850)
- local sm = {}
- sm.moov = 0
- sm.object1, sm.object2 = nil, nil
- local screenW, screenH = guiGetScreenSize()
- local sx,sy = guiGetScreenSize()
- local px,py = (sx/1366),(sy/768)
- local foncik = dxCreateFont("font.ttf", 15)
- local function camRender ()
- local x1, y1, z1 = getElementPosition ( sm.object1 )
- local x2, y2, z2 = getElementPosition ( sm.object2 )
- setCameraMatrix ( x1, y1, z1, x2, y2, z2 )
- end
- local function removeCamHandler ()
- if(sm.moov == 1) then
- sm.moov = 0
- removeEventHandler ( "onClientPreRender", getRootElement(), camRender )
- end
- end
- function smoothMoveCameraa ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time )
- if(sm.moov == 1) then return false end
- sm.object1 = createObject ( 1337, x1, y1, z1 )
- sm.object2 = createObject ( 1337, x1t, y1t, z1t )
- setElementAlpha ( sm.object1, 0 )
- setElementAlpha ( sm.object2, 0 )
- setObjectScale(sm.object1, 0.01)
- setObjectScale(sm.object2, 0.01)
- moveObject ( sm.object1, time, x2, y2, z2, 0, 0, 0, "InOutQuad" )
- moveObject ( sm.object2, time, x2t, y2t, z2t, 0, 0, 0, "InOutQuad" )
- addEventHandler ( "onClientPreRender", getRootElement(), camRender )
- sm.moov = 1
- setTimer ( removeCamHandler, time, 1 )
- setTimer ( destroyElement, time, 1, sm.object1 )
- setTimer ( destroyElement, time, 1, sm.object2 )
- return true
- end
- local sx,sy=guiGetScreenSize()
- local sw,sh=guiGetScreenSize()
- local screenW, screenH = 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
- function loadLoginFromXML()
- local XML = xmlLoadFile ("userdata.xml")
- if not XML then
- XML = xmlCreateFile("userdata.xml", "login")
- end
- local usernameNode = xmlFindChild (XML, "username", 0)
- if usernameNode then
- return xmlNodeGetValue(usernameNode)
- else
- return ""
- end
- xmlUnloadFile ( XML )
- end
- function saveLoginToXML(username)
- local XML = xmlLoadFile ("userdata.xml")
- if not XML then
- XML = xmlCreateFile("userdata.xml", "login")
- end
- if (username ~= "") then
- local usernameNode = xmlFindChild (XML, "username", 0)
- if not usernameNode then
- usernameNode = xmlCreateChild(XML, "username")
- end
- xmlNodeSetValue (usernameNode, tostring(username))
- end
- xmlSaveFile(XML)
- xmlUnloadFile (XML)
- end
- addEvent("saveLoginToXML", true)
- addEventHandler("saveLoginToXML", root, saveLoginToXML)
- local dist = 100
- local angler = 0
- function renderLoginBox()
- dxDrawImage(35*px, 66*py, 1366*px, 768*py, ":ogrpg-logging/panel.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
- if not isMouseIn(screenW * 0.5403, screenH * 0.5977, screenW * 0.1706, screenH * 0.0898) then dxDrawImage(156*px, -102*py, 1366*px, 768*py, ":ogrpg-logging/zar.png", 0, 0, 0, tocolor(255, 255, 255, 195), false)
- else dxDrawImage(156*px, -102*py, 1366*px, 768*py, ":ogrpg-logging/zar.png", 0, 0, 0, tocolor(255, 255, 255, 150), false)
- end
- if not isMouseIn(screenW * 0.3397, screenH * 0.6003, screenW * 0.1955, screenH * 0.0872) then dxDrawImage(-15*px, -19*py, 1177*px, 760*py, ":ogrpg-logging/zal.png", 0, 0, 0, tocolor(255, 255, 255, 195), false)
- else dxDrawImage(-15*px, -19*py, 1177*px, 760*py, ":ogrpg-logging/zal.png", 0, 0, 0, tocolor(255, 255, 255, 150), false)
- end
- local zone1=math.sin(intro_step/500)*9000
- local zone2=math.cos(intro_step/500)*9000
- setCameraMatrix ( -2448.72, 144.94, 35.12, zone1, zone2, 2)
- show = true
- dxDrawText(data.info, (screenW * 0.0001) - 1, (screenH * 0.9196) - 1, (screenW * 0.2910) - 1, (screenH * 0.7682) - 1, tocolor(255, 0, 0, 255), 1.50, foncik, "center", "center", false, false, false, false, false)
- end
- addEventHandler("onClientClick", root, function(btn,state)
- if btn=="left" and state=="down" then
- if isMouseIn(screenW * 0.3397, screenH * 0.6003, screenW * 0.1955, screenH * 0.0872) 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=""
- return
- end
- triggerServerEvent("logging:checkAccount", resourceRoot, login, pass)
- end
- if isMouseIn(screenW * 0.5403, screenH * 0.5977, screenW * 0.1706, screenH * 0.0898) 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="Login lub hasło muszą mieć więcej niż 2 znaki!"
- return
- end
- if string.len(login) > 22 or string.len(pass) > 20 then
- data.info="Login lub hasło nie mogą mieć więcej, niż 20 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
- removeEventHandler ( "onClientPreRender", getRootElement(), camRender )
- 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)
- addEventHandler("onClientResourceStart", resourceRoot, function()
- showChat(false)
- showCursor(true)
- fadeCamera(true)
- data.showed=true
- setElementAlpha(localPlayer,0)
- data.misc=playSound("misc/intro.mp3",true)
- setSoundVolume(data.misc, 3)
- showPlayerHudComponent("all",false)
- guiSetInputMode("no_binds_when_editing")
- setElementData(localPlayer,"status","Loguje siÄ™")
- setElementData(localPlayer,"player:logged",false)
- addEventHandler("onClientRender", root, renderLoginBox)
- local tekst = loadLoginFromXML() or ""
- data.button[1]=guiCreateEdit(0.39, 0.38, 0.27, 0.09, tekst, true)
- data.button[2]=guiCreateEdit(0.39, 0.48, 0.27, 0.09, tekst, true)
- guiEditSetMasked(data.button[2],true)
- end)
- function filedelet ()
- if fileExists("c_logging.lua") then
- fileDelete("c_logging.lua")
- end
- end
- addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), filedelet)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement