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

Wysłany: 2018-04-28, 09:26


WolvesDrift







Wiek: 26
Na forum: 2960 dni
Posty: 14



Respekt: 50

Ostrzeżeń: 100%
Witam,dodalby ktos tutaj spawn po zalogowaniu?
chodzi mi ze po kliknieciu zaloguj poprostu loguje nas na podane kordy
local sWsH guiGetScreenSize()
local sxsy = (sW/1366), (sH/768)

local selectedLanguage false 
local dxfont0_roboto dxCreateFont(":br_font/roboto.ttf"35false"antialiased")

function isCursorOnElement(x,y,w,h)
    local mx,my getCursorPosition ()
    local fullx,fully guiGetScreenSize()
    cursorx,cursory mx*fullx,my*fully
    if cursorx and cursorx and cursory and cursory h then
        return true
    else
        return false
    end
end


function moveCamera(xyzx2y2z2time)
    obj1=createObject(1337x,y,z)
    setElementAlpha(obj10)
    setObjectScale(obj10.01)
    moveObject(obj1time*1000x2y2z20,0,0"InOutQuad")
    
    setElementPosition(getCamera(), 000)
    attachElements(getCamera(), obj1)
end 

function fadeMusic()
    if isElement(musicthen 
        local vol getSoundVolume(music)
        if vol <= 0.05 then
            stopSound(music)
        else
            setSoundVolume(musicvol-0.05)
            setTimer(fadeMusic1001)
        end 
    end 
end 

function handleKeys(keypress)
    if key == "mouse1" then 
        if press then 
            if selectedLanguage then 
                if isCursorOnElement(504*sx444*sy155*sx37*sythen 
                    triggerEvent("onPlayerTryLogin"localPlayerguiGetText(loginEdit), guiGetText(passEdit))
                elseif isCursorOnElement(701*sx444*sy155*sx37*sythen 
                    triggerEvent("onPlayerTryRegister"localPlayerguiGetText(loginEdit), guiGetText(passEdit))
                end
            end
        end
    end
end 

function renderLogin()
    local localization exports["br_localization"]
    
    if not selectedLanguage then 
        dxDrawRectangle(381*sx268*sy604*sx235*sytocolor(000202), false)
        if isCursorOnElement(405*sx313*sy254*sx143*sythen 
            dxDrawImage(405*sx313*sy254*sx143*sy":br_login/i/english.png"000tocolor(255255255255), false)
            if getKeyState("mouse1"then 
                selectedLanguage "english"
                localization:setPlayerLocalization(localPlayer"english")
                guiSetVisible(loginEdittrue)
                guiSetVisible(passEdittrue)
                guiSetInputEnabled(true)
                guiBringToFront(loginEdit)
            end
        else 
            dxDrawImage(405*sx313*sy254*sx143*sy":br_login/i/english.png"000tocolor(255255255155), false)
        end 
        
        if isCursorOnElement(705*sx313*sy254*sx143*sythen 
            dxDrawImage(705*sx313*sy254*sx143*sy":br_login/i/polish.png"000tocolor(255255255255), false)
            if getKeyState("mouse1"then 
                selectedLanguage "polish"
                localization:setPlayerLocalization(localPlayer"polish")
                guiSetVisible(loginEdittrue)
                guiSetVisible(passEdittrue)
                guiSetInputEnabled(true)
                guiBringToFront(loginEdit)
            end
        else 
            dxDrawImage(705*sx313*sy254*sx143*sy":br_login/i/polish.png"000tocolor(255255255155), false)
        end
        dxDrawText(localization:getText(localPlayer"login-title2"), 465*sx218*sy727*sx276*sytocolor(255255255255), 0.7*sxdxfont0_roboto"left""top"falsefalsefalsefalsefalse)
        dxDrawLine(381*sx267*sy984*sx267*sytocolor(14000), 4*sxfalse)
    else 
        -- login
        dxDrawRectangle(465*sx266*sy437*sx237*sytocolor(000202), false)
        dxDrawText(localization:getText(localPlayer"login-title"), (465 1)*sx, (218 1)*sy, (727 1)*sx, (276 1)*sytocolor(000255), 0.7*sxdxfont0_roboto"left""top"falsefalsefalsefalsefalse)
        dxDrawText(localization:getText(localPlayer"login-title"), 465*sx218*sy727*sx276*sytocolor(255255255255), 0.7*sxdxfont0_roboto"left""top"falsefalsefalsefalsefalse)
        if isCursorOnElement(504*sx444*sy155*sx37*sythen 
            dxDrawRectangle(504*sx444*sy155*sx37*sytocolor(14000), false)
        else 
            dxDrawRectangle(504*sx444*sy155*sx37*sytocolor(14000150), false)
        end 
        
        if isCursorOnElement(701*sx444*sy155*sx37*sythen 
            dxDrawRectangle(701*sx444*sy155*sx37*sytocolor(14000), false)
        else 
            dxDrawRectangle(701*sx444*sy155*sx37*sytocolor(14000150), false)
        end 
        
        dxDrawText(localization:getText(localPlayer"login-login_btn"), 541*sx449*sy620*sx481*sytocolor(255255255255), 0.45*sxdxfont0_roboto"center""top"falsefalsefalsefalsefalse)
        dxDrawText(localization:getText(localPlayer"login-register_btn"), 724*sx449*sy830*sx481*sytocolor(255255255255), 0.45*sxdxfont0_roboto"center""top"falsefalsefalsefalsefalse)
        dxDrawText(localization:getText(localPlayer"login-login_info"), 480*sx294*sy562*sx326*sytocolor(255255255255), 0.4*sxdxfont0_roboto"right""top"falsefalsefalsefalsefalse)
        dxDrawText(localization:getText(localPlayer"login-pass_info"), 480*sx354*sy562*sx386*sytocolor(255255255255), 0.4*sxdxfont0_roboto"right""top"falsefalsefalsefalsefalse)
        --dxDrawText(localization:getText(localPlayer"login-remember"), 541*sx404*sy681*sx422*sytocolor(255255255255), 0.35*sxdxfont0_roboto"center""top"falsefalsefalsefalsefalse)
        dxDrawLine(465*sx266*sy901*sx266*sytocolor(14000), 4*sxfalse)
        
        local postepZDJ math.sin((getTickCount()/360)*4)
                dxDrawImage(914*sx0*sy379*sx209*sy"i/logo.png",postepZDJ ,tocolor(255255255255))
      
        -- changelog
    dxDrawRectangle(957*sx179*sy283*sx299*sytocolor(000160), false)
         dxDrawLine(958*sx178*sy1238*sx178*sytocolor(14000255), 4*sxfalse)
        dxDrawText("Changelog"1030*sx180*sy1186*sx226*sytocolor(255255255255), .50*sxdxfont0_roboto"center""top"falsefalsefalsefalsefalse)
        dxDrawText(localization:getText(localPlayer"login-changelog"), 957*sx241*sy1240*sx478*sytocolor(255255255255), 0.30*sxdxfont0_roboto"left""top"falsefalsefalsefalsefalse)
    end
end 

function destroy()
    removeEventHandler("onClientRender"rootrenderLogin)
    removeEventHandler("onClientKey"roothandleKeys)
    exports["br_blur"]:destroyBlurBox(blur)
    
    destroyElement(loginEdit)
    destroyElement(passEdit)
    destroyElement(dxfont0_roboto)
    
    detachElements(getCamera(), obj1)
    destroyElement(obj1)
    
    showCursor(false)
    guiSetInputMode("allow_binds")
    
    showChat(true)
    
    fadeMusic()
end 

addEvent("onPlayerTryLogin"true)
addEventHandler("onPlayerTryLogin"root, 
    function(loginpassword)
        if #login < 3 then 
            exports["br_notifications"]:addNotification("Tw?j login musi wynosi? conajmniej 3 znaki.""error")
            return 
        end 
        
        if #password < 6 then 
            exports["br_notifications"]:addNotification("Twoje has?o musi mie? conajmniej 6 znak?w.""error")
            return 
        end 
        
        fadeCamera(false1.5)
        triggerServerEvent("onPlayerEnterAccount"localPlayerloginpassword)
    end 
)

addEvent("onPlayerTryRegister"true)
addEventHandler("onPlayerTryRegister"root, 
    function(loginpassword)
        if #login < 3 then 
            exports["br_notifications"]:addNotification("Tw?j login musi wynosi? conajmniej 3 znaki.""error")
            return 
        end 
        
        if #password < 6 then 
            exports["br_notifications"]:addNotification("Twoje has?o musi mie? conajmniej 6 znak?w.""error")
            return 
        end 
        
        fadeCamera(false1.5)
        triggerServerEvent("onPlayerCreateAccount"localPlayerloginpassword)
    end 
)

addEvent("onPlayerRegisterSuccess"true)
addEventHandler("onPlayerRegisterSuccess"root,
    function()
        destroy()
        setTimer(triggerServerEvent15001"onPlayerEnterGame"localPlayerlocalPlayer)
    end 
)

addEvent("onPlayerLoginSuccess"true)
addEventHandler("onPlayerLoginSuccess"root, 
    function()
        destroy()
        setTimer(triggerServerEvent15001"onPlayerEnterGame"localPlayerlocalPlayer)
    end 
)
    
addEventHandler("onClientResourceStart"resourceRoot,
    function()
        --if getElementData(localPlayer"player:uid"then return end -- gracz jest zalogowany 
        loginEdit guiCreateEdit(572*sx289*sy284*sx37*sy""false)
        guiEditSetMaxLength(loginEdit40)
        guiSetVisible(loginEditfalse)
        
        passEdit =  guiCreateEdit(572*sx349*sy284*sx37*sy""false)
        guiEditSetMasked(passEdittrue)
        guiEditSetMaxLength(passEdit30)    
        guiSetVisible(passEditfalse)
        
        exports["br_blur"]:setBlurIntensity(1.3)
        blur exports["br_blur"]:createBlurBox(00sWsH255255255255false)
            
        moveCamera(19361628801606.15, -1595.12103.31150)
        setFarClipDistance(1250)
        
        showChat(false)
            
        fadeCamera(false0)
        setTimer(fadeCamera10001true1.5)
            
        music playSound("s/music.mp3")
        setSoundVolume(music0.7)
        
        addEventHandler("onClientRender"rootrenderLogin)
        addEventHandler("onClientKey"roothandleKeys)
        
        showCursor(true)
        guiSetInputMode("no_binds")
        
        setPlayerHudComponentVisible("all"false)
    end
)

addEventHandler("onClientResourceStop"resourceRoot,
    function()
        destroy()
    end
)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-28, 09:37


Kalizman







Wiek: 23
Na forum: 3652 dni
Posty: 1394

Piwa: 4619

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

U?yj
Więcej informacji znajdziesz w Wikipedii MTA:

spawnPlayer
lub
Więcej informacji znajdziesz w Wikipedii MTA:

setElementPosition


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-28, 10:08


WolvesDrift







Wiek: 26
Na forum: 2960 dni
Posty: 14



Respekt: 50

Ostrzeżeń: 100%
Nie wiem gdzie to u?y?,i chc? by po kliknieciu tego buttona zaloguj to by mnie respawnowa?o a tam jest po wejsciu na serwer,mozesz to doda? i tyle? ;x

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-28, 11:06


Ciastuuś

Truck soon...






Wiek: 26
Na forum: 3071 dni
Posty: 799
Nick w MP: Ciastuuś

Piwa: 4297

Respekt: 640
Respekt: 640Respekt: 640

Takow? funkcj? setElementPosition wsadzasz do warunku, gdy wpisze poprawne dane po czym przenosi go na podan? pozycj?, czyli

setElementPosition localPlayer00)


Podpis
Truck soon...
Ostatnio zmieniony przez Ciastuuś 2018-04-28, 14:32, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-28, 11:14


WolvesDrift







Wiek: 26
Na forum: 2960 dni
Posty: 14



Respekt: 50

Ostrzeżeń: 100%
Czyli na dole do tego kawalku koduj dodaj?:

addEvent("onPlayerLoginSuccess", true)
addEventHandler("onPlayerLoginSuccess", root,
function()
destroy()
SetElementPosition ( localPlayer, 0, 0, 0 )
setTimer(triggerServerEvent, 1500, 1, "onPlayerEnterGame", localPlayer, localPlayer)
end
)
powiesz dokladnie gdzie? ;p

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-28, 11:14


neku^







Wiek: 24
Na forum: 3522 dni
Posty: 461
Nick w MP: neku^

Piwa: 1186

Respekt: 320,5
Respekt: 320,5Respekt: 320,5Respekt: 320,5

Ciastuu?, je?li ju? to

setElementPosition localPlayer00)

ale niekt?re funkcje nie b?d? dzia?a?, wi?c polecam

Więcej informacji znajdziesz w Wikipedii MTA:

spawnPlayer


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-28, 11:32


WolvesDrift







Wiek: 26
Na forum: 2960 dni
Posty: 14



Respekt: 50

Ostrzeżeń: 100%
addEvent("onPlayerLoginSuccess", true)
addEventHandler("onPlayerLoginSuccess", root,
function()
destroy()
spawnPlayer ( playerValue, 0.0, 0.0, 5.0, 90.0, 0 )
setTimer(triggerServerEvent, 1500, 1, "onPlayerEnterGame", localPlayer, localPlayer)
end
)
Takie co? zadzia?a? bo doda?em na samym dole t? linijke i nie wiem czy zadziala to

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-28, 11:47


jagoreq







Wiek: 24
Na forum: 3221 dni
Posty: 221
Nick w MP: dwd

Piwa: 18

Respekt: 66,3

Ostrzeżeń: 20%
WolvesDrift, bo?e bierzesz linijke z przyk?adu z mta wiki, ale playerValue oznacza value z p?tli w przyk?adzie, czyli poprawnie dodaj localPlayer

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-28, 12:13


WolvesDrift







Wiek: 26
Na forum: 2960 dni
Posty: 14



Respekt: 50

Ostrzeżeń: 100%
jagoreq, Wiem o tym,ale pytam czy jesli tam dodam to zadzia?a,trudno zrozumie??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-28, 12:30


jagoreq







Wiek: 24
Na forum: 3221 dni
Posty: 221
Nick w MP: dwd

Piwa: 18

Respekt: 66,3

Ostrzeżeń: 20%
Napewno tego nie wiedzia?e? i nie, nie zadzia?a.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-28, 14:34


Ciastuuś

Truck soon...






Wiek: 26
Na forum: 3071 dni
Posty: 799
Nick w MP: Ciastuuś

Piwa: 4297

Respekt: 640
Respekt: 640Respekt: 640

Dodawaj znaczniki [lua] [ /lua]

To masz poprawny kod,

addEvent("onPlayerLoginSuccess"trueaddEventHandler("onPlayerLoginSuccess"root, 
function() 
destroy() 
spawnPlayer localPlayer0.00.05.090.0setTimer(triggerServerEvent15001"onPlayerEnterGame"localPlayerlocalPlayerend 
)


Podpis
Truck soon...
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 Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

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