Szerző Téma: [ HL 2018 ] Login problema  (Megtekintve 745 alkalommal)

[ HL 2018 ] Login problema
« Dátum: 2018. November 24. - 10:12:04 »
0
Sziasztok. Eloszor is leszogezem. Nem, nem szeretnek rp szertvert nyitni csak a haverokkal szorakzoni rajta.
 
Olyan problemam lenne a login panellel kapcsolatban, hogy akarhanyszor felcsatlakozok a szerverre lutri hogy megjelenik-e a panel vagy sem. De ha nem jelenik meg akkor egy resource restart utan mukodik normalisan par re-join-ig. Esetleg nem tudjatok mi a problema ? 
 
 
 
Koszi a valaszt.
 
 
 

local sx, sy = guiGetScreenSize()
local md55 = false
local emlekezz = false
local salt = \"vgrpkeyscotland\"
local defX, defY, defZ = 1479.4132080078, -1769.7408447266, 13.546875
local topOffset = sy*0.2
local browser = guiCreateBrowser(0, topOffset, sx, sy, true, true, false)
guiSetVisible(browser, false)
local tempPeds = {}
local pedData = {}
local isCameraOnMove = false
local selectedCharacter = 1
local rot = 0
local alpha = 200
local alphaState = \"down\"
local imgrot = 0
local img = 3
local destroyTimer
local loadingText = \"\"
local changeTextTo
local theTimer
local accountDatas = {}
function sendPasswordMail(username)
if isTimer(destroyTimer) then
   killTimer(destroyTimer)
end
img = 1
addEventHandler(\"onClientRender\", root, renderGTAVLoading)
triggerServerEvent(\"sendPasswordRecover\", localPlayer, username)
end
addEvent(\"receivePasswordRecover\", true)
addEventHandler(\"receivePasswordRecover\", root, function(data)
    if data == \"Done\" then
   img = 2
elseif data == \"Fail\" then
   img = 4
elseif data == \"Nomail\" then
   img = 5
    elseif data == \"Wait\" or data==\"Exists\" then
   img = 6
else
   img = 3
end
    if(isTimer(destroyTimer))then
        killTimer(destroyTimer)    
    end
destroyTimer = setTimer(function()
   removeEventHandler(\"onClientRender\", root, renderGTAVLoading)
end, 5000, 1)
end)
function renderGTAVLoading()
if img > 0 then
   dxDrawRectangle(sx-200,sy-25,200,25,tocolor(0,0,0,180), true)
   if img == 1 then
      imgrot = imgrot + 5
      dxDrawImage(sx-195,sy-23,20,20,\"assets/loading.png\", imgrot, 0, 0, nil, true)
      dxDrawText(\"Keresés folyamatban ...\",sx-165,sy-19,20,20,tocolor(255,255,255,255),1,\"default\",\"left\",\"top\",false,false,true)
   elseif img == 2 then
      dxDrawImage(sx-195,sy-22,20,20,\"assets/success.png\", 0, 0, 0, nil, true)
      dxDrawText(\"Email sikeresen elküldve!\",sx-165,sy-19,20,20,tocolor(255,255,255,255),1,\"default\",\"left\",\"top\",false,false,true)
   elseif img == 3 then
      dxDrawImage(sx-195,sy-22,20,20,\"assets/error.png\", 0, 0, 0, nil, true)
      dxDrawText(\"Sikertelen email küldés!\",sx-165,sy-19,20,20,tocolor(255,255,255,255),1,\"default\",\"left\",\"top\",false,false,true)
   elseif img == 4 then
      dxDrawImage(sx-195,sy-22,20,20,\"assets/error.png\", 0, 0, 0, nil, true)
      dxDrawText(\"Nincs találat!\",sx-165,sy-19,20,20,tocolor(255,255,255,255),1,\"default\",\"left\",\"top\",false,false,true)
   elseif img == 5 then
      dxDrawImage(sx-195,sy-22,20,20,\"assets/error.png\", 0, 0, 0, nil, true)
      dxDrawText(\"Nincs társított email cím!\",sx-165,sy-19,20,20,tocolor(255,255,255,255),1,\"default\",\"left\",\"top\",false,false,true)
        elseif img == 6 then
      dxDrawImage(sx-195,sy-22,20,20,\"assets/error.png\", 0, 0, 0, nil, true)
      dxDrawText(\"Már el lett küldve a levél!\",sx-165,sy-19,20,20,tocolor(255,255,255,255),1,\"default\",\"left\",\"top\",false,false,true)
   end
end
end
local theBrowser = guiGetBrowser(browser)
addEventHandler(\"onClientBrowserCreated\", theBrowser, function()
loadBrowserURL(source, \"http://mta/local/html/index.html\")
end)
local loginConfig = \"@loginData.json\"
function jsonGET(file)
local fileHandle
local jsonDATA = {}
if not fileExists(file) then
   fileHandle = fileCreate(file)
   fileWrite(fileHandle, toJSON({[\"username\"] = \"\", [\"password\"] = \"\"}))
   fileClose(fileHandle)
   fileHandle = fileOpen(file)
else
   fileHandle = fileOpen(file)
end
if fileHandle then
   local buffer
   local allBuffer = \"\"
   while not fileIsEOF(fileHandle) do
      buffer = fileRead(fileHandle, 500)
      allBuffer = allBuffer..buffer
   end
   jsonDATA = fromJSON(allBuffer)
   fileClose(fileHandle)
end
return jsonDATA
end
function jsonSAVE(file, data)
if fileExists(file) then
   fileDelete(file)
end
local fileHandle = fileCreate(file)
fileWrite(fileHandle, toJSON(data))
fileFlush(fileHandle)
fileClose(fileHandle)
return true
end
local initedBrowser = false
function refreshAccountDatas()
    if isElement(theBrowser) and initedBrowser then
        for i, k in pairs(accountDatas) do
            local avatar = k[1] and tonumber(k[1][\"avatar\"] or 1) or 1
            local username = k[2][2][\"username\"] or \"Unknown\"
            local lastlogin = k[2][2][\"lastlogin\"] or \"Most\"
            local email = k[2][2][\"email\"] or \"Nincs megadva!\"
            executeBrowserJavascript(theBrowser, \"addUser(\'\"..username..\"\', \'\"..lastlogin..\"\', \"..avatar..\", \'\"..email..\"\');\")
        end
    end
end
addEventHandler(\"onClientBrowserDocumentReady\", theBrowser, function()
local data = jsonGET(loginConfig)
if data then
   if data[\"username\"] and data[\"username\"] ~= \"\" and data[\"password\"] and data[\"password\"] ~= \"\" then
      executeBrowserJavascript(theBrowser, \"setUsername(\'\"..data[\"username\"]..\"\'); setPassword(\'\"..data[\"password\"]..\"\'); setChecked(); show(\'login\');\")
      md55 = true
      emlekezz = true
   end
end
    initedBrowser = true
    refreshAccountDatas()
end)
function showLoginPanel()
showChat(false)
showCursor(true)
fadeCamera(false)
createRandomIntro()
guiSetVisible(browser, true)
exports.ex_core:toggleComponents(true)
end
addEvent(\"loginPlayer\", true)
addEventHandler(\"loginPlayer\", getRootElement(), showLoginPanel)
function removeLoginBox()
showCursor(false)
destroyIntro()
guiSetVisible(browser, false)
exports.ex_core:toggleComponents(false)
end
function clearChatBox()
for i=1, getChatboxLayout()[\"chat_lines\"] do
   outputChatBox(\" \")
end
end
addCommandHandler(\"clearchat\", clearChatBox)
addCommandHandler(\"clear\", clearChatBox)
addCommandHandler(\"cc\", clearChatBox)
addEvent(\"onClientChangeLoginCheck\", true, true)
addEventHandler(\"onClientChangeLoginCheck\", root, function(state)
local state = tonumber(state) or 0
if state == 1 then
   emlekezz = true
else
   emlekezz = false
end
end)
addEvent(\"onClientInputChange\", true, true)
addEventHandler(\"onClientInputChange\", root, function(val)
md55 = false
end)
addEvent(\"client->showFactor\", true)
addEventHandler(\"client->showFactor\", getRootElement(), function()
    exports.ex_gui:showInfoBox(\"Add meg a 2 faktoros belépési kódodat!\")
    executeBrowserJavascript(theBrowser, \"show(\'2fact\');\")
end)
local factSpam = nil;
addEvent(\"onClientStartFact\", true, true)
addEventHandler(\"onClientStartFact\", getRootElement(), function(fact)
if isTimer(factSpam) then
   exports.ex_gui:showInfoBox(\"Várj 2 másodpercet két próbálkozás között!\");
   return;
end
factSpam = setTimer(function() end, 2000, 1);
fact = tostring(fact);
local fact_num = tonumber(fact);
if(string.len(fact) == 6 and fact_num > 0)then
   triggerServerEvent(\"checkPlayer2Fact\", localPlayer, fact_num);
else
   exports.ex_gui:showInfoBox(\"Hibás a 2 faktoros kód! 6 karakterből és csak számokból állhat!\");
end
end)
addEvent(\"client->showPasswordChangePanel\", true)
addEventHandler(\"client->showPasswordChangePanel\", getRootElement(), function()
    exports.ex_gui:showInfoBox(\"Biztonsági okokból kérlek frissítsd a jelszavadat!\")
    executeBrowserJavascript(theBrowser, \"show(\'newpw\');\")
end)
addEvent(\"showlogin\", true)
addEventHandler(\"showlogin\", getRootElement(), function()
    exports.ex_gui:showInfoBox(\"Sikeresen frissítetted a jelszavadat, most kérlek jelentkezz be!\\nTovábbi jó játékot!\")
    executeBrowserJavascript(theBrowser, \"show(\'accounts\');\")
end)
addEvent(\"login->show\", true)
addEventHandler(\"login->show\", getRootElement(), function(show)
    executeBrowserJavascript(theBrowser, \"show(\'\" .. show .. \"\');\")
end)
addEvent(\"onClientStartNewpw\", true, true)
addEventHandler(\"onClientStartNewpw\", getRootElement(), function(password, password2)
    if password == password2 then
        local hashedPassword = createHash(password)
        if hashedPassword then
            triggerServerEvent(\"server->changePassword\", localPlayer, hashedPassword)    
        end
    end
end)
addEvent(\"onClientStartLogin\", true, true)
addEventHandler(\"onClientStartLogin\", root, function(username, password)
-- outputChatBox(\"sad\")
if isTimer(theTimer) then
   exports.ex_gui:showInfoBox(\"Várj 3 másodpercet két próbálkozás között!\")
   return
end
theTimer = setTimer(function() end, 3000, 1)
if username and password then
   if username:len() > 0 and password:len() > 0 then
      if not md55 then
         triggerServerEvent(\"serverLoginAttempt\", localPlayer, username, password)
      else
         triggerServerEvent(\"serverLoginAttempt\", localPlayer, username, password, password)
      end
   else
      exports.ex_gui:showInfoBox(\"Felhasználónév és jelszó megadása kötelező!\")
   end
else
   exports.ex_gui:showInfoBox(\"Felhasználónév és jelszó megadása kötelező!\")
end
end)
addEvent(\"onClientStartRecover\", true, true)
addEventHandler(\"onClientStartRecover\", root, function(username)
if isTimer(theTimer) then
   exports.ex_gui:showInfoBox(\"Várj 3 másodpercet két próbálkozás között!\")
   return
end
theTimer = setTimer(function() end, 3000, 1)
if username then
   if username:len() > 4 then
      sendPasswordMail(username)
   else
      exports.ex_gui:showInfoBox(\"Felhasználónév / email cím minimum 4 karakterből kell álljon!\")
   end
else
   exports.ex_gui:showInfoBox(\"Felhasználónév / email cím megadása kötelező!\")
end
end)
addEvent(\"onClientStartRegister\", true, true)
addEventHandler(\"onClientStartRegister\", root, function(username, password, password2, email)
if isTimer(theTimer) then
   exports.ex_gui:showInfoBox(\"Várj 3 másodpercet két próbálkozás között!\")
   return
end
theTimer = setTimer(function() end, 3000, 1)
if username and password and password2 and email then
   if username:len() > 0 and password:len() > 0 and password2:len() > 0 and email:len() > 0 then
      if password ~= password2 then
         exports.ex_gui:showInfoBox(\"A két jelszó nem egyezik!\")
      elseif username:len() < 4 then
         exports.ex_gui:showInfoBox(\"A felhasználónév minimum 4 karakterből kell álljon!\")
      elseif password:len() < 6 then
         exports.ex_gui:showInfoBox(\"A jelszó minimum 6 karakterből kell álljon!\")
      else
         triggerServerEvent(\"registerPlayer\", localPlayer, username, createHash(password), getPlayerSerial(localPlayer), email)
      end
   else
      exports.ex_gui:showInfoBox(\"Minden mező kitöltése kötelező!\")
   end
else
   exports.ex_gui:showInfoBox(\"Minden mező kitöltése kötelező!\")
end
end)
addEventHandler(\"onClientResourceStart\", resourceRoot, function()
guiSetInputMode(\"no_binds\")
triggerServerEvent(\"login->checkApplication\", localPlayer)
end)
local loginTimer
function isLoadingDone()
return not isTransferBoxActive()
end
addEvent(\"login->showLoginPanel\", true)
addEventHandler(\"login->showLoginPanel\", getRootElement(), function()
if not getElementData(localPlayer, \"spawned\") then
   if isLoadingDone() then
      showLoginPanel()
      triggerServerEvent(\"server->getAccountDatas\", localPlayer)
   else
      loginTimer = setTimer(function()
         if isLoadingDone() then
            killTimer(loginTimer)
            showLoginPanel()
            triggerServerEvent(\"server->getAccountDatas\", localPlayer)
         end
      end, 50, 0)
   end
end
end)
addEvent(\"app->onFinish\", true)
addEventHandler(\"app->onFinish\", getRootElement(), function()
if not getElementData(localPlayer, \"spawned\") then
        showLoginPanel()
        triggerServerEvent(\"server->getAccountDatas\", localPlayer)
end
end)
addEvent(\"client->getAccountData\", true)
addEventHandler(\"client->getAccountData\", getRootElement(), function(table)
    accountDatas = table
    refreshAccountDatas()
end)
local chatBlockTime = 0
addEvent(\"receiveServerCharacterData\", true)
addEventHandler(\"receiveServerCharacterData\", root, function(data, username, password)
if not emlekezz then
   username = \"\"
   password = \"\"
end
jsonSAVE(loginConfig, {[\"username\"] = username, [\"password\"] = password})

exports.ex_job_core:applyJob(data.job)
chatBlockTime = data.chatblocktime
setElementData(localPlayer, \"char:Chattime\", chatBlockTime)
if data.chatblocked == 1 then
   if chatBlockTime ~= 0 then
      startChatBlockTimer(chatBlockTime)
   end
end

setElementData(localPlayer, \"spawned\", true)
exports.ex_core:toggleComponents(false)
triggerEvent(\"spawnVehiclesFunction\", localPlayer)

if getElementDimension(localPlayer) > 0 then -- custom interiorok miatt
   local x, y, z = getElementPosition(localPlayer)
   
   -- collisionba lépés fix (mtabug)
   setElementPosition(localPlayer, x+0.1, y, z)
   setElementPosition(localPlayer, x, y, z)
   setTimer(setElementFrozen, 2000, 1, localPlayer, false)
else
   setElementFrozen(localPlayer, false)
end

setCameraTarget(localPlayer)
toggleAllControls(true, true, true)
local res = getResourceFromName(\"ex_christmas\")
if res and getResourceState(res) == \"running\" then
   local boxes = fromJSON(getElementData(localPlayer, \"char:openedBoxes\") or \"[[]]\")
   exports.ex_christmas:showBoxes(boxes)
end

if data.adolevonas == 0 then
   setTimer(function()
      triggerEvent(\"initTax\", localPlayer)
   end, 60*1000, 1)
end
-- exports.ex_inventory:loadPlayerItems(data.id)
exports.ex_drogplants:countDownPlantTime(data.plantTime)
setCharacterLoadingState(false)
exports.ex_gui:showInfoBox(\"Sikeresen bejelentkeztél, jó szórakozást kivánunk a HL-en!\")

-- changelog

end)
local syncWithServer = false
local syncTimer
local chatBlockTime
function startChatBlockTimer(time)
if isTimer(syncTimer) then killTimer(syncTimer) end
if isTimer(timer1) then killTimer(timer1) end
syncTimer = setTimer(function()
   syncWithServer = true
end, 60000, 0)

chatBlockTime = time
timer1 = setTimer(function()
   if chatBlockTime > 0 then
      chatBlockTime = chatBlockTime - 1
      if syncWithServer then
         setElementData(localPlayer, \"char:Chattime\", chatBlockTime)
      else
         setElementData(localPlayer, \"char:Chattime\", chatBlockTime, false)
      end
   else
      if isTimer(timer1) then killTimer(timer1) end
      if isTimer(syncTimer) then killTimer(syncTimer) end
      setElementData(localPlayer, \"char:Chatblocked\", nil)
      setElementData(localPlayer, \"char:Chattime\", 0)
      outputChatBox(\"[HL] #FFFFFFLejárt a chat tiltásod!\", 255, 0, 0, true)
   end
end, 1000, time+1)
end
addEventHandler(\"onClientResourceStart\", resourceRoot, function()
if getElementData(localPlayer, \"spawned\") then
   local chatBlocked = tonumber(getElementData(localPlayer, \"char:Chatblocked\"))
   chatBlockTime = tonumber(getElementData(localPlayer, \"char:Chattime\")) or 0
   if chatBlocked == 1 then
      if chatBlockTime > 0 then
         startChatBlockTimer(chatBlockTime)
      else
         outputChatBox(\"[HL] #FFFFFFLejárt a chat tiltásod!\", 255, 0, 0, true)
         setElementData(localPlayer, \"char:Chatblocked\", 0)
      end
   end
end
end)
addEvent(\"initChatBanCountDown\", true)
addEventHandler(\"initChatBanCountDown\", root, function(t)
if t > 0 then
   startChatBlockTimer(t)
else
   if isTimer(timer1) then killTimer(timer1) end
   if isTimer(syncTimer) then killTimer(syncTimer) end
end
end)
--- KARAKTER VÁLASZTÓ BY XENIUS 2015
local sm = {}
local addedCameraRender = false
sm.moov = 0
sm.object1,sm.object2 = nil,nil
local function removeCamHandler()
if(sm.moov == 1)then
   sm.moov = 0
   if addedCameraRender then
      addedCameraRender = false
      removeEventHandler(\"onClientPreRender\",root,camRender)
   end
end
end
local function camRender()
if (sm.moov == 1) then
   local x1,y1,z1 = getElementPosition(sm.object1)
   local x2,y2,z2 = getElementPosition(sm.object2)
   setCameraMatrix(x1,y1,z1,x2,y2,z2,0,exports.ex_core:getPlayerFov())
end
end
local function smoothMoveCamera(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)

setElementDimension(sm.object1, getElementDimension(localPlayer))
setElementDimension(sm.object2, getElementDimension(localPlayer))

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\")
setElementAlpha(localPlayer, 0)
moveObject(sm.object2,time,x2t,y2t,z2t,0,0,0,\"InOutQuad\")
sm.moov = 1
setTimer(removeCamHandler,time,1)
setTimer(destroyElement,time,1,sm.object1)
setTimer(destroyElement,time,1,sm.object2)
if not addedCameraRender then
   addedCameraRender = true
   addEventHandler(\"onClientPreRender\",root,camRender)
end
return true
end
local pedPositions = {
[1] = {
   pos = {402.17541503906, -1532.3784179688, 32.2734375},
   rot = {0, 0, 217.42056274414},
   cam = {405.01971435547, -1535.5256347656, 33.379688262939, 342.66143798828, -1460.1274414063, 12.726487159729},
},
}
function checkCursor()
if isCursorShowing() then
   return true
else
   return false
end
end
function getCursorPos()
if checkCursor() then
   cx,cy = getCursorPosition()
   cx,cy = cx*sx,cy*sy
else
   cx,cy = -500,-500
end
return cx,cy
end
function isInBox(x, y, xmin, xmax, ymin, ymax)
if checkCursor() then
   return x >= xmin and x <= xmax and y >= ymin and y <= ymax
else
   return false
end
end
local tempPed = nil
local selectedChar = 0
local characters = {}
local FONT = exports.ex_core:getFont(\"roboto.ttf\")
local FONT2 = exports.ex_core:getFont(\"montserrat.ttf\")
addEvent(\"onClientServerCoreRestarted\", true)
addEventHandler(\"onClientServerCoreRestarted\", getRootElement(), function()
FONT = exports.ex_core:getFont(\"roboto.ttf\")
FONT2 = exports.ex_core:getFont(\"montserrat.ttf\")
end)
local width, height = 350, 350
local pX = 0
local pX2 = sx-width
local pY = sy/2-height/2
local loadCharacterCreation = false
local characterCreationErrorMessage = \"\"
local errorFields = {}
local characterCount = 0
addEvent(\"receiveCharacters\", true)
addEventHandler(\"receiveCharacters\", root, function(tbl, test, created, switch)
if created then
   spawnCharacters(tbl, test, created)
else
   removeLoginBox()
   fadeCamera(false, 0.01)
   setCharacterLoadingState(true, \"Sikeres bejelentkezés!\")
        if not switch then
            changeTextTo = \"Karakterek betöltése folyamatban ...\"
        else
            changeTextTo = \"Betöltés folyamatban ...\"
        end
   setTimer(function(tbl, test, created)
      setCharacterLoadingState(false)
      spawnCharacters(tbl, test, created)
   end, 2000, 1, tbl, test, created)
end
end)
function spawnCharacters(tbl, test, created)
if isElement(tempPed) then
   destroyElement(tempPed)
end
if created then
   removeEventHandler(\"onClientRender\", root, renderCharacterCreationUI)
   destroyCharacterCreatioGUI()
   addEventHandler(\"onClientRender\", root, renderCharacterSelectInterface)
else
   showCursor(true)
   exports.ex_core:toggleComponents(true)
end
characters = tbl
characterCount = 0
local position = pedPositions[1]
tempPed = createPed(1, unpack(position.pos))
setElementRotation(tempPed, unpack(position.rot))
setElementDimension(tempPed, getElementDimension(localPlayer))
for k,v in pairs(characters) do
   characterCount=characterCount+1
   if characterCount == 1 then
      setElementModel(tempPed, v[3])
   end
   local x,y,z,dim
   if v[4] then
      x,y,z,dim = v[4][1],v[4][2],v[4][3],v[4][4]
   else
      x,y,z,dim = defX, defY, defZ, 0
   end
   local zone = getZoneName(x,y,z)
   v[4] = zone
   if dim > 0 then
      local id, entrance = exports.ex_interior:findInterior(dim)
      if id > 0 and entrance then
         v[4] = getElementData(entrance, \"name\")
      end
   end
   if v[5] == 0 or not v[5] then
      v[5] = \"a mai napon\"
   else
      v[5] = v[5]..\" nappal ezelőtt\"
   end
end
if not created then
   if test then
      moveCameraToCharacter(1, 2000, true)
      addEventHandler(\"onClientClick\", root, spawnCharacter)
   end
end
end
addEvent(\"testSuccessful\", true)
addEventHandler(\"testSuccessful\", root, function()
moveCameraToCharacter(1, 2000, true)
addEventHandler(\"onClientClick\", root, spawnCharacter)
end)
function moveCameraToCharacter(id, time, first)
if pedPositions[id] then
   local x2,y2,z2,x2t,y2t,z2t = unpack(pedPositions[id].cam)
   setCameraMatrix(x2,y2,z2,x2t,y2t,z2t,0,exports.ex_core:getPlayerFov())
   if first then
      addEventHandler(\"onClientRender\", root, renderCharacterSelectInterface)
   end
end
end
local nameEdit, descriptionText, genderCombos, nationalityCombos
function createCharacterCreatioGUI()
nameEdit = guiCreateEdit(pX+140,pY+40-5,width-150,30,\"\",false)
guiSetAlpha(nameEdit, 0.8)

descriptionText = guiCreateMemo(pX+140,pY+160-5,width-150,80,\"\",false)
guiSetAlpha(descriptionText, 0.8)

genderCombos = guiCreateComboBox(pX+140,pY+80-2,width-150,80,\"\",false)
guiSetAlpha(genderCombos, 0.8)
guiComboBoxAddItem(genderCombos, \"Férfi\")
guiComboBoxAddItem(genderCombos, \"Nő\")

nationalityCombos = guiCreateComboBox(pX+140,pY+120-2,width-150,80,\"\",false)
guiSetAlpha(nationalityCombos, 0.8)
guiComboBoxAddItem(nationalityCombos, \"Fekete\")
guiComboBoxAddItem(nationalityCombos, \"Fehér\")
guiComboBoxAddItem(nationalityCombos, \"Ázsiai\")
addEventHandler(\"onClientGUIComboBoxAccepted\", root, guiComboChange)
end
function createAccountSettings()
nameEdit = guiCreateEdit(pX2+140,pY+40-5,width-150,30,\"\",false)
guiSetAlpha(nameEdit, 0.8)
end
function destroyCharacterCreatioGUI()
removeEventHandler(\"onClientGUIComboBoxAccepted\", root, guiComboChange)
if isElement(nameEdit) then
   destroyElement(nameEdit)
end
if isElement(descriptionText) then
   destroyElement(descriptionText)
end
if isElement(genderCombos) then
   destroyElement(genderCombos)
end
if isElement(nationalityCombos) then
   destroyElement(nationalityCombos)
end
end
function destroyAccountSettings()
if isElement(nameEdit) then
   destroyElement(nameEdit)
end
end
addEvent(\"receiveCharacterCreationError\", true)
addEventHandler(\"receiveCharacterCreationError\", root, function(err)
loadCharacterCreation = false
characterCreationErrorMessage = err
end)
function guiComboChange()
local gender = guiComboBoxGetItemText(genderCombos, guiComboBoxGetSelected(genderCombos))
local nationality = guiComboBoxGetItemText(nationalityCombos, guiComboBoxGetSelected(nationalityCombos))
local skin = 0
if gender == \"Férfi\" then
   if nationality == \"Fekete\" then
      skin = 31
   elseif nationality == \"Fehér\" then
      skin = 29
   elseif nationality == \"Ázsiai\" then
      skin = 59
   end
elseif gender == \"Nő\" then
   if nationality == \"Fekete\" then
      skin = 10
   elseif nationality == \"Fehér\" then
      skin = 12
   elseif nationality == \"Ázsiai\" then
      skin = 7
   end
end
if skin > 0 then
   setElementModel(tempPed, skin)
end
end
function spawnCharacter(button, state)
if isCameraOnMove then return end
if button == \"left\" and state == \"down\" then
   if selectedChar == \"new\" then
      loadCharacterCreation = false
      characterCreationErrorMessage = \"\"
      removeEventHandler(\"onClientRender\", root, renderCharacterSelectInterface)
      createCharacterCreatioGUI()
      addEventHandler(\"onClientRender\", root, renderCharacterCreationUI)
   elseif selectedChar == \"newchardeny\" then
      removeEventHandler(\"onClientRender\", root, renderCharacterCreationUI)
      destroyCharacterCreatioGUI()
      addEventHandler(\"onClientRender\", root, renderCharacterSelectInterface)
   elseif selectedChar == \"newchardone\" then
      if loadCharacterCreation then return end
      loadCharacterCreation = true
      setTimer(function()
         local name = guiGetText(nameEdit)
         local description = guiGetText(descriptionText)
         local gender = guiComboBoxGetItemText(genderCombos, guiComboBoxGetSelected(genderCombos))
         local nationality = guiComboBoxGetItemText(nationalityCombos, guiComboBoxGetSelected(nationalityCombos))
         local state, msg = exports.ex_utility:checkValidCharacterName(name)
         name = name:gsub(\" \", \"_\")
         if not state then
            loadCharacterCreation = false
            characterCreationErrorMessage = msg
         elseif #description < 100 then
            loadCharacterCreation = false
            characterCreationErrorMessage = \"A karaktered leírása minimum 100 karakter kell álljon!\"
         elseif #description > 500 then
            loadCharacterCreation = false
            characterCreationErrorMessage = \"A karaktered leírása maximum 500 karakter lehet!\"
         elseif gender == \"\" then
            loadCharacterCreation = false
            characterCreationErrorMessage = \"Nem választottál a karakterednek nemet!\"
         elseif nationality == \"\" then
            loadCharacterCreation = false
            characterCreationErrorMessage = \"Nem választottál a karakterednek bőrszínt!\"
         else
            local skin = 0
            if gender == \"Férfi\" then
               if nationality == \"Fekete\" then
                  skin = 29
               elseif nationality == \"Fehér\" then
                  skin = 31
               elseif nationality == \"Ázsiai\" then
                  skin = 58
               end
            elseif gender == \"Nő\" then
               if nationality == \"Fekete\" then
                  skin = 10
               elseif nationality == \"Fehér\" then
                  skin = 12
               elseif nationality == \"Ázsiai\" then
                  skin = 7
               end
            end
            triggerServerEvent(\"createCharacter\", localPlayer, name, description, skin, getElementData(localPlayer, \"char:gameaccountid\"))
         end
      end, 1000, 1)
   elseif characters[selectedChar] then
      showCursor(false)
      triggerServerEvent(\"spawnCharacter\", localPlayer, selectedChar)
      removeEventHandler(\"onClientRender\", root, renderCharacterSelectInterface)
      removeEventHandler(\"onClientClick\", root, spawnCharacter)
      characters = {}
      destroyElement(tempPed)
      tempPed = nil
      changeTextTo = nil
      setCharacterLoadingState(true, \"Várakozás a szerverre ...\")
      if(isElement(loginSong))then
         destroyElement(loginSong)
      end
   end
end
end
function renderCharacterCreationUI()
selectedChar = 0
local cursorX, cursorY = getCursorPos()
dxDrawRectangle(pX,pY,width,height,tocolor(0,0,0,150))
dxDrawRectangle(pX,pY,width,30,tocolor(0,0,0,150))
dxDrawText(\"Karakter létrehozás\",pX+width/2,pY+7,pX+width/2,pY+7,tocolor(255,255,255,255),0.4,FONT,\"center\")

dxDrawText(\"Karakter neve:\",pX+10,pY+40,pX+10,pY+40,tocolor(255,255,255,255),0.4,FONT)
dxDrawText(\"Karakter neme:\",pX+10,pY+80,pX+10,pY+80,tocolor(255,255,255,255),0.4,FONT)
dxDrawText(\"Karakter bőrszíne:\",pX+10,pY+120,pX+10,pY+120,tocolor(255,255,255,255),0.4,FONT)
dxDrawText(\"Karakter leírása:\",pX+10,pY+185,pX+10,pY+185,tocolor(255,255,255,255),0.4,FONT)
if errorFields[1] then
   dxDrawRectangle(pX+140,pY+40-5+30,width-150,1,tocolor(255,0,0,150))
end

if errorFields[2] then
   dxDrawRectangle(pX+140,pY+80-5+25,width-150,1,tocolor(255,0,0,150))
end

if errorFields[3] then
   dxDrawRectangle(pX+140,pY+120-5+25,width-150,1,tocolor(255,0,0,150))
end

if errorFields[4] then
   dxDrawRectangle(pX+140,pY+160-5+80,width-150,1,tocolor(255,0,0,150))
end

if loadCharacterCreation then
   imgrot = imgrot + 5
   if imgrot > 360 then
      imgrot = 0
   end
   dxDrawImage(pX+width/2-10,pY+height-115+5,20,20,\"assets/loading.png\", imgrot, 0, 0, nil, true)
elseif characterCreationErrorMessage ~= \"\" then
   dxDrawText(characterCreationErrorMessage,pX+width/2,pY+height-115+7,pX+width/2,pY+height-115+7,tocolor(255,0,0,255),0.4,FONT,\"center\")
end

dxDrawRectangle(pX+10,pY+height-80,width-20,30,tocolor(0,0,0,100))
if isInBox(cursorX, cursorY, pX+10, pX+10+width-20, pY+height-80, pY+height-80+30) then
   dxDrawRectangle(pX+10,pY+height-80,width-20,30,tocolor(0,0,0,100))
   selectedChar = \"newchardone\"
end
dxDrawText(\"Létrehoz\",pX+width/2,pY+height-80+7,pX+width/2,pY+height-80+7,tocolor(255,255,255,255),0.4,FONT,\"center\")

dxDrawRectangle(pX+10,pY+height-40,width-20,30,tocolor(0,0,0,100))
if isInBox(cursorX, cursorY, pX+10, pX+10+width-20, pY+height-40, pY+height-40+30) then
   dxDrawRectangle(pX+10,pY+height-40,width-20,30,tocolor(0,0,0,100))
   selectedChar = \"newchardeny\"
end
dxDrawText(\"Mégsem\",pX+width/2,pY+height-40+7,pX+width/2,pY+height-40+7,tocolor(255,255,255,255),0.4,FONT,\"center\")

dxDrawRectangle(pX,pY+height-2,width,2,tocolor(50,125,200,255))
end
function renderCharacterSelectInterface()
-- baloldal
local cursorX, cursorY = getCursorPos()
dxDrawRectangle(pX,pY,width,height,tocolor(0,0,0,150))
dxDrawRectangle(pX,pY,width,30,tocolor(0,0,0,150))
dxDrawText(\"Karakter választás\",pX+width/2,pY+7,pX+width/2,pY+7,tocolor(255,255,255,255),0.4,FONT,\"center\")

selectedChar = 0
local y = pY+35
for k,v in pairs(characters) do
   dxDrawRectangle(pX+10,y,width-20,60,tocolor(0,0,0,100))
   local skin = tonumber(v[3]) or 0
   if isInBox(cursorX, cursorY, pX+10, pX+10+width-20, y, y+60) then
      dxDrawRectangle(pX+10,y,width-20,60,tocolor(0,0,0,100))
      selectedChar = k
      setElementModel(tempPed, skin)
   end
   if fileExists(\":ex_core/img/\"..skin..\".jpg\") then
      dxDrawImage(pX+10,y,90,60,\":ex_core/img/\"..skin..\".jpg\")
   end
   
   dxDrawText(v[2]:gsub(\"_\", \" \"),pX+width/2+60,y+5,pX+width/2+30,y+5,tocolor(255,255,255,255),0.4,FONT2,\"center\")
   dxDrawText(\"Utoljára a \'\"..v[4]..\"\'-on látták,\\n\"..v[5]..\".\",pX+width/2+60,y+20,pX+width/2+30,y+20,tocolor(255,255,255,255),0.4,FONT,\"center\")
   y = y + 65
end

dxDrawRectangle(pX+10,pY+height-40,width-20,30,tocolor(0,0,0,100))
if characterCount >= 4 then
   if isInBox(cursorX, cursorY, pX+10, pX+10+width-20, pY+height-40, pY+height-40+30) then
      dxDrawRectangle(pX+10,pY+height-40,width-20,30,tocolor(0,0,0,100))
   end
   dxDrawText(\"Nem hozhatsz létre több karaktert\",pX+width/2,pY+height-40+7,pX+width/2,pY+height-40+7,tocolor(255,255,255,100),0.4,FONT,\"center\")
else
   if isInBox(cursorX, cursorY, pX+10, pX+10+width-20, pY+height-40, pY+height-40+30) then
      dxDrawRectangle(pX+10,pY+height-40,width-20,30,tocolor(0,0,0,100))
      selectedChar = \"new\"
   end
   dxDrawText(\"Új karakter létrehozása\",pX+width/2,pY+height-40+7,pX+width/2,pY+height-40+7,tocolor(255,255,255,255),0.4,FONT,\"center\")
end
dxDrawRectangle(pX,pY+height-2,width,2,tocolor(50,125,200,255))
end
function renderCharacterLoading()
if getElementData(localPlayer, \"spawned\") then
   setCharacterLoadingState()
   return
end
if alphaState == \"down\" then
   alpha = alpha - 2
   if alpha <= 100 then
      alphaState = \"up\"
      if changeTextTo then
         loadingText = changeTextTo
      end
   end
else
   alpha = alpha + 2
   if alpha >= 200 then
      alphaState = \"down\"
   end
end
dxDrawText(loadingText,0,0,sx,sy,tocolor(255,255,255,alpha),0.5,FONT,\"center\",\"center\")
if rot > 360 then rot = 0 end
rot = rot + 5
local minusX = dxGetTextWidth(loadingText)
dxDrawImage(sx/2-minusX/2-45,sy/2-8,16,16,\"loading.png\",rot)
end
local addedRenderLoginState
function setCharacterLoadingState(to, text)
if to then
   loadingText = text
   if isElement(label1) then
      guiSetAlpha(label1, 0)
   end
   if isElement(label2) then
      guiSetAlpha(label2, 0)
   end
   if not addedRenderLoginState then
      addedRenderLoginState = true
      fadeCamera(false,0.5)
      setTimer(function()
         addEventHandler(\"onClientRender\", root, renderCharacterLoading)
      end, 500, 1)
   end
else
   if addedRenderLoginState then
      addedRenderLoginState = nil
      removeEventHandler(\"onClientRender\", root, renderCharacterLoading)
      fadeCamera(true,0.5)
   end
end
end
addEvent(\"login->setCharacterLoadingState\", true)
addEventHandler(\"login->setCharacterLoadingState\", root, setCharacterLoadingState)

Nem elérhető Dia

[ HL 2018 ] Login problema
« Válasz #1 Dátum: 2019. Április 09. - 10:31:32 »
0
Lopott mod-ot használsz? Grat.. Senki nem fog segíteni..

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal