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

Wysłany: 2016-08-07, 17:09


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

Witam mo?e kto? mi pom?c z tym skryptem pr?bowa?em to sam zrobi? ale mi nie wychodzi i chyba co? pomiesza?em wi?c wklejam ca?y kod nie edytowany.Chodzi mi o to ?eby usun?? zapis i spawn tak jak napisa?em pr?bowa?em ale mi nie wychodzi?o
Za pomoc :piwo:
c_login:
mojeW,mojeH = 800, 600
sW,sH = guiGetScreenSize()
width, height = (sW/mojeW), (sH/mojeH)

local sm = {}
sm.moov = 0
sm.object1,sm.object2 = nil,nil
 
local function removeCamHandler()
    if(sm.moov == 1)then
        sm.moov = 0
    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)
    end
end
addEventHandler("onClientPreRender",root,camRender)
 
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)
    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")
    sm.moov = 1
    setTimer(removeCamHandler,time,1)
    setTimer(destroyElement,time,1,sm.object1)
    setTimer(destroyElement,time,1,sm.object2)
    return true
end


function muzyka ( opcja )
    if opcja == "on" then
        sound = playSound ( "dzwiek.mp3", true )
        setSoundVolume(sound, 1.0)
    elseif opcja == "off" then
        stopSound ( sound )
    end
end

onPanelShow = false
onTimerStart = false
onGUIHide = false

addEventHandler("onClientPreRender",root,function()
    if onPanelShow then
        local obrot=math.sin(getTickCount()/2500)*20
        setCameraMatrix ( 1500.18, -1638.99, 35, -13000, -30000-obrot, -5000 )
        dxDrawRectangle(0*width, 729*height, 1200*width, 127*height, tocolor(0, 0, 0, 234), false)
        dxDrawImage(260*width, 168*height, 342*width, 65*height, "logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawText("Login:", 147*width, 335*height, 254*width, 369*height, tocolor(255, 255, 255, 255), 2.10*width, "clear", "center", "top", false, false, false, false, false)
        dxDrawText("Has?o:", 147*width, 389*height, 254*width, 423*height, tocolor(255, 255, 255, 255), 2.10*width, "clear", "center", "top", false, false, false, false, false)
    end
    
    if onTimerStart then
        if not upTimer then
            upTimer = getTickCount ()
        end
        local tick = getTickCount()
        if tick - upTimer >= 6600 then
        guiSetVisible (okno2, true)
        guiSetText (nazwa, "Witaj na serwerze (nazwa twojego serwera) "..getPlayerName(localPlayer).."!")
        bindKey ( "enter", "down", onClientChoose )
        onTimerStart = false
        removeEventHandler("onClientPreRender", getRootElement(), camRender)
        end
    end
    
    if onGUIHide then
        local mnoznik = getTickCount()
        local wynik = mnoznik - startTime
        local duracja = endTime - startTime
        local progress = wynik / duracja

        local newX = interpolateBetween ( 
            533*width, 0, 0, 
            785*width, 0, 0, 
            progress, "Linear")
     
        guiSetPosition(okno2, newX - width/2, 116*height, false)
     
        if mnoznik >= endTime then
            onGUIHide = false
            guiSetVisible(okno2, false)
        end
    end
end)

loguj = guiCreateButton(571*width, 342*height, 174*width, 45*height, "Zaloguj", false)
rejestruj = guiCreateButton(571*width, 395*height, 174*width, 45*height, "Zarejestruj", false)
blad = guiCreateLabel(230*width, 427*height, 327*width, 25*height, "", false)
guiSetFont(blad, "clear-normal")
guiLabelSetColor(blad, 255, 0, 0)
guiLabelSetHorizontalAlign(blad, "center", false)
guiLabelSetVerticalAlign(blad, "center")
login = guiCreateEdit(244*width, 343*height, 303*width, 30*height, "", false)
haslo = guiCreateEdit(244*width, 393*height, 303*width, 30*height, "", false)
guiEditSetMasked(haslo, true)
guiSetVisible ( login, false )
guiSetVisible ( haslo, false )
guiSetVisible ( blad, false )
guiSetVisible ( loguj, false )
guiSetVisible ( rejestruj, false )

okno2 = guiCreateGridList(533*width, 116*height, 266*width, 368*height, false)
guiSetAlpha(okno2, 0.86)
nazwa = guiCreateLabel(0.02, 0.01, 0.97, 0.07, "Witaj, na (nazwa twojego serwera)", true, okno2)
guiSetFont(nazwa, "clear-normal")
guiLabelSetHorizontalAlign(nazwa, "center", false)
guiLabelSetVerticalAlign(nazwa, "center")
opis = guiCreateLabel(0.02, 0.09, 0.97, 0.89, "Kliknij enter aby rozpcz?? gr?. ", true, okno2)
guiSetFont(opis, "clear-normal")
guiLabelSetHorizontalAlign(opis, "center", false)
guiLabelSetVerticalAlign(opis, "center")
guiSetVisible (okno2, false)

addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), 
function()
    guiSetVisible ( login, true )
    guiSetVisible ( haslo, true )
    guiSetVisible ( blad, true )
    guiSetVisible ( loguj, true )
    guiSetVisible ( rejestruj, true )
    onPanelShow = true
    showCursor (true)
    muzyka ( "on" )
    showChat(false)
    fadeCamera ( true )
end
)

function onClientLogin(button, state)
       if button == "left" and state == "up" then
        local username = guiGetText(login)
         local password = guiGetText(haslo)
          if username and password then
           triggerServerEvent("login:zaloguj", getRootElement(), localPlayer, username, password)
          else
         guiSetText(blad, "Musisz napisac login i haslo aby zaczac gre.")
      end    
   end
end
addEventHandler("onClientGUIClick", loguj, onClientLogin, false)

function onClientRegister(button, state)
       if button == "left" and state == "up" then
        local username = guiGetText(login)
         local password = guiGetText(haslo)
          if username and password then
           triggerServerEvent("login:zarejestruj", getRootElement(), localPlayer, username, password)
          else
         guiSetText(blad, "Musisz wpisa? login i has?o.")
      end    
   end
end
addEventHandler("onClientGUIClick", rejestruj, onClientRegister, false)

addEvent ( "login:blad", true )
addEventHandler ( "login:blad", root, function ( text )
    if source == localPlayer then
        if guiGetVisible(blad) == false then
            guiSetVisible(blad, true)
        end
    guiSetText ( blad, text )
    end
end)

function onHideLoginWindow(skin)
    guiSetVisible ( login, false )
    guiSetVisible ( haslo, false )
    guiSetVisible ( blad, false )
    guiSetVisible ( loguj, false )
    guiSetVisible ( rejestruj, false )
    showCursor(false)
    onPanelShow = false
    ped = createPed (skin, 1507.85,-1747.84,13.55, 312.05767822266 )
    setPedAnimation ( ped, "ON_LOOKERS", "wave_loop", -1, true, false )
    setElementDimension (localPlayer, 0)
    setElementDimension (ped, 0)
    smoothMoveCamera ( 1500.18, -1638.99, 35, -13000, -30000, -5000, 1495.82, -1740.30, 15.44, 6500, -5000, 0, 7000 )
    onTimerStart = true
end
addEvent("login:schowaj", true)
addEventHandler("login:schowaj", getResourceRootElement(getThisResource()), onHideLoginWindow)


function onClientChoose()
  if getElementDimension (localPlayer) == 0 then
    local nick = getPlayerName ( localPlayer )
    triggerServerEvent("login:spawn", getRootElement(), localPlayer, nick)
    destroyElement (ped)
    unbindKey ( "enter", "down", onClientChoose )
    muzyka ("off")
    startTime = getTickCount()
    endTime = startTime + 3000
    onGUIHide = true
    showChat (true)
    setElementData ( localPlayer, "login:zalogowany", true)
  end
end

addEvent ( "login:opis", true )
addEventHandler ( "login:opis", root, function ( text )
    if source == localPlayer then
        guiSetText ( opis, text )
    end
end)

s_login:
function onPlayerLogin(gracz, username, haslo)
local account = getAccount(username, haslo)
    if (account ~= false) then
        if (logIn(gracz, account, haslo) == true) then
            triggerClientEvent(gracz,"login:schowaj",getRootElement(),getAccountData(getPlayerAccount(gracz),"zapis-skin"))
            outputChatBox ( "*Zalogowa?e? si? poprwanie.", gracz, 255, 255, 255, true)
            
            local hajs = getPlayerMoney ( gracz )
            local nick = getPlayerName ( gracz )
            local hp = getAccountData(getPlayerAccount(gracz),"funmodev2-health")
            local skin = getAccountData(getPlayerAccount(gracz),"zapis-skin")

            if not skin then
                skin = 0
            elseif not hp then
                hp = 0
            end
            
            triggerClientEvent("login:opis",gracz,"Hajs: "..hajs.."$\nNick Gracza: "..nick.."\n?ycie: "..hp.."%\nSkin: "..skin.."\n\n\nAby wej?? do gry kliknij ENTER.")

        else
            triggerClientEvent("login:blad",gracz,"B??d musisz zrobi? /reconnect ")
        end
    else
            triggerClientEvent("login:blad",gracz,"Poda?e? z?y login lub has?o, mo?liwe ze takie konto nie istnieje.")
    end
end
addEvent("login:zaloguj",true)
addEventHandler("login:zaloguj",getRootElement(),onPlayerLogin)

function onPlayerRegister(gracz, username, haslo)
local account = getAccount(username, haslo)
    if (account ~= false) then
        triggerClientEvent("login:blad",gracz,"Takie konto ju? istnieje na serwerze.")
    else
        account = addAccount(username, haslo)
    if (logIn(gracz, account, haslo) == true) then
        triggerClientEvent("login:blad",gracz,"Teraz mo?esz si? zalogowa? na serwer.")
    end
    if (account ~= false) then end
  end
end
addEvent("login:zarejestruj",true)
addEventHandler("login:zarejestruj",getRootElement(),onPlayerRegister)

function onPlayerSpawn(gracz)
    setCameraTarget ( gracz, gracz )
    setElementFrozen ( gracz, false )

    if getAccountData(getPlayerAccount(gracz),"zapis-x") then
        spawnPlayer(gracz, getAccountData(getPlayerAccount(gracz),"zapis-x"), getAccountData(getPlayerAccount(gracz),"zapis-y"), getAccountData(getPlayerAccount(gracz),"zapis-z"),getAccountData(getPlayerAccount(gracz),"zapis-skin"), 0, 0)
    else
        spawnPlayer(gracz, 1474.15234,-1700.55823,14.04688, 0, 0, 0) --spawn gracza. x,y,z Pocz?tkowe 3, reszty prosze nei zmienia?.
    end

    fadeCamera ( gracz, true )
    setCameraTarget ( gracz, gracz )
    toggleControl (gracz,"fire",false)
    toggleControl (gracz,"action",false)
    toggleControl (gracz,"aim_weapon",false)
end
addEvent("login:spawn",true)
addEventHandler("login:spawn",root,onPlayerSpawn)




function onPlayerQuit(quitType, reason)
  if not (isGuestAccount (getPlayerAccount (source))) then
    account = getPlayerAccount (source)
    if (account) then
        local x,y,z = getElementPositon ( source )
        setAccountData ( account, "zapis-x",x )
        setAccountData ( account, "zapis-y",y )
        setAccountData ( account, "zapis-z",z )
        setAccountData ( account, "zapis-skin",getElementModel(source) )
    end
  end
end
addEventHandler ("onPlayerQuit", getRootElement(), onPlayerQuit)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-07, 17:14


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4290 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4661

Respekt: 1436,8
Respekt: 1436,8

function onPlayerLogin(gracz, username, haslo) 
local account = getAccount(username, haslo) 
if (account ~= false) then 
if (logIn(gracz, account, haslo) == true) then 
triggerClientEvent(gracz,"login:schowaj",getRootElement(),getAccountData(getPlayerAccount(gracz),"zapis-skin")) 
outputChatBox ( "*Zalogowa?e? si? poprwanie.", gracz, 255, 255, 255, true) 

local hajs = getPlayerMoney ( gracz ) 
local nick = getPlayerName ( gracz ) 
local hp = getAccountData(getPlayerAccount(gracz),"funmodev2-health") 
local skin = getAccountData(getPlayerAccount(gracz),"zapis-skin") 

if not skin then 
skin = 0 
elseif not hp then 
hp = 0 
end 

triggerClientEvent("login:opis",gracz,"Hajs: "..hajs.."$\nNick Gracza: "..nick.."\n?ycie: "..hp.."%\nSkin: "..skin.."\n\n\nAby wej?? do gry kliknij ENTER.") 

else 
triggerClientEvent("login:blad",gracz,"B??d musisz zrobi? /reconnect ") 
end 
else 
triggerClientEvent("login:blad",gracz,"Poda?e? z?y login lub has?o, mo?liwe ze takie konto nie istnieje.") 
end 
end 
addEvent("login:zaloguj",true) 
addEventHandler("login:zaloguj",getRootElement(),onPlayerLogin) 

function onPlayerRegister(gracz, username, haslo) 
local account = getAccount(username, haslo) 
if (account ~= false) then 
triggerClientEvent("login:blad",gracz,"Takie konto ju? istnieje na serwerze.") 
else 
account = addAccount(username, haslo) 
if (logIn(gracz, account, haslo) == true) then 
triggerClientEvent("login:blad",gracz,"Teraz mo?esz si? zalogowa? na serwer.") 
end 
if (account ~= false) then end 
end 
end 
addEvent("login:zarejestruj",true) 
addEventHandler("login:zarejestruj",getRootElement(),onPlayerRegister) 

function onPlayerSpawn(gracz) 
setCameraTarget ( gracz, gracz ) 
setElementFrozen ( gracz, false ) 

--if getAccountData(getPlayerAccount(gracz),"zapis-x") then 
--spawnPlayer(gracz, getAccountData(getPlayerAccount(gracz),"zapis-x"), --getAccountData(getPlayerAccount(gracz),"zapis-y"), --getAccountData(getPlayerAccount(gracz),"zapis-z"),--getAccountData(getPlayerAccount(gracz),"zapis-skin"), 0, 0) 
else 
--spawnPlayer(gracz, 1474.15234,-1700.55823,14.04688, 0, 0, 0) --spawn gracza. x,y,z Pocz?tkowe 3, reszty prosze nei zmienia?. 
end 

fadeCamera ( gracz, true ) 
setCameraTarget ( gracz, gracz ) 
toggleControl (gracz,"fire",false) 
toggleControl (gracz,"action",false) 
toggleControl (gracz,"aim_weapon",false) 
end 
addEvent("login:spawn",true) 
addEventHandler("login:spawn",root,onPlayerSpawn) 




function onPlayerQuit(quitType, reason) 
if not (isGuestAccount (getPlayerAccount (source))) then 
account = getPlayerAccount (source) 
if (account) then 
local x,y,z = getElementPositon ( source ) 
--setAccountData ( account, "zapis-x",x ) 
--setAccountData ( account, "zapis-y",y ) 
--setAccountData ( account, "zapis-z",z ) 
--setAccountData ( account, "zapis-skin",getElementModel(source) ) 
end 
end 
end 
addEventHandler ("onPlayerQuit", getRootElement(), onPlayerQuit)


Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-07, 17:22


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

"marcin778" napisał/a:

function onPlayerLogin(gracz, username, haslo) 
local account = getAccount(username, haslo) 
if (account ~= false) then 
if (logIn(gracz, account, haslo) == true) then 
triggerClientEvent(gracz,"login:schowaj",getRootElement(),getAccountData(getPlayerAccount(gracz),"zapis-skin")) 
outputChatBox ( "*Zalogowa?e? si? poprwanie.", gracz, 255, 255, 255, true) 

local hajs = getPlayerMoney ( gracz ) 
local nick = getPlayerName ( gracz ) 
local hp = getAccountData(getPlayerAccount(gracz),"funmodev2-health") 
local skin = getAccountData(getPlayerAccount(gracz),"zapis-skin") 

if not skin then 
skin = 0 
elseif not hp then 
hp = 0 
end 

triggerClientEvent("login:opis",gracz,"Hajs: "..hajs.."$\nNick Gracza: "..nick.."\n?ycie: "..hp.."%\nSkin: "..skin.."\n\n\nAby wej?? do gry kliknij ENTER.") 

else 
triggerClientEvent("login:blad",gracz,"B??d musisz zrobi? /reconnect ") 
end 
else 
triggerClientEvent("login:blad",gracz,"Poda?e? z?y login lub has?o, mo?liwe ze takie konto nie istnieje.") 
end 
end 
addEvent("login:zaloguj",true) 
addEventHandler("login:zaloguj",getRootElement(),onPlayerLogin) 

function onPlayerRegister(gracz, username, haslo) 
local account = getAccount(username, haslo) 
if (account ~= false) then 
triggerClientEvent("login:blad",gracz,"Takie konto ju? istnieje na serwerze.") 
else 
account = addAccount(username, haslo) 
if (logIn(gracz, account, haslo) == true) then 
triggerClientEvent("login:blad",gracz,"Teraz mo?esz si? zalogowa? na serwer.") 
end 
if (account ~= false) then end 
end 
end 
addEvent("login:zarejestruj",true) 
addEventHandler("login:zarejestruj",getRootElement(),onPlayerRegister) 

function onPlayerSpawn(gracz) 
setCameraTarget ( gracz, gracz ) 
setElementFrozen ( gracz, false ) 

--if getAccountData(getPlayerAccount(gracz),"zapis-x") then 
--spawnPlayer(gracz, getAccountData(getPlayerAccount(gracz),"zapis-x"), --getAccountData(getPlayerAccount(gracz),"zapis-y"), --getAccountData(getPlayerAccount(gracz),"zapis-z"),--getAccountData(getPlayerAccount(gracz),"zapis-skin"), 0, 0) 
else 
--spawnPlayer(gracz, 1474.15234,-1700.55823,14.04688, 0, 0, 0) --spawn gracza. x,y,z Pocz?tkowe 3, reszty prosze nei zmienia?. 
end 

fadeCamera ( gracz, true ) 
setCameraTarget ( gracz, gracz ) 
toggleControl (gracz,"fire",false) 
toggleControl (gracz,"action",false) 
toggleControl (gracz,"aim_weapon",false) 
end 
addEvent("login:spawn",true) 
addEventHandler("login:spawn",root,onPlayerSpawn) 




function onPlayerQuit(quitType, reason) 
if not (isGuestAccount (getPlayerAccount (source))) then 
account = getPlayerAccount (source) 
if (account) then 
local x,y,z = getElementPositon ( source ) 
--setAccountData ( account, "zapis-x",x ) 
--setAccountData ( account, "zapis-y",y ) 
--setAccountData ( account, "zapis-z",z ) 
--setAccountData ( account, "zapis-skin",getElementModel(source) ) 
end 
end 
end 
addEventHandler ("onPlayerQuit", getRootElement(), onPlayerQuit)

Teraz to nie mog? si? nawet zalogowa?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-08, 00:11


MeeShuffle

Programista/Grafik






Wiek: 33
Na forum: 4536 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8578

Respekt: 535,3
Respekt: 535,3

w s-side usuwasz funkcj? onPlayerSpawn i onPlayerQuit kolego :)

A to twoj c-side

mojeW,mojeH = 800, 600
sW,sH = guiGetScreenSize()
width, height = (sW/mojeW), (sH/mojeH)

local sm = {}
sm.moov = 0
sm.object1,sm.object2 = nil,nil
 
local function removeCamHandler()
    if(sm.moov == 1)then
        sm.moov = 0
    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)
    end
end
addEventHandler("onClientPreRender",root,camRender)
 
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)
    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")
    sm.moov = 1
    setTimer(removeCamHandler,time,1)
    setTimer(destroyElement,time,1,sm.object1)
    setTimer(destroyElement,time,1,sm.object2)
    return true
end


function muzyka ( opcja )
    if opcja == "on" then
        sound = playSound ( "dzwiek.mp3", true )
        setSoundVolume(sound, 1.0)
    elseif opcja == "off" then
        stopSound ( sound )
    end
end

onPanelShow = false
onTimerStart = false
onGUIHide = false

addEventHandler("onClientPreRender",root,function()
    if onPanelShow then
        local obrot=math.sin(getTickCount()/2500)*20
        setCameraMatrix ( 1500.18, -1638.99, 35, -13000, -30000-obrot, -5000 )
        dxDrawRectangle(0*width, 729*height, 1200*width, 127*height, tocolor(0, 0, 0, 234), false)
        dxDrawImage(260*width, 168*height, 342*width, 65*height, "logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawText("Login:", 147*width, 335*height, 254*width, 369*height, tocolor(255, 255, 255, 255), 2.10*width, "clear", "center", "top", false, false, false, false, false)
        dxDrawText("Has?o:", 147*width, 389*height, 254*width, 423*height, tocolor(255, 255, 255, 255), 2.10*width, "clear", "center", "top", false, false, false, false, false)
    end
    
    if onTimerStart then
        if not upTimer then
            upTimer = getTickCount ()
        end
        local tick = getTickCount()
        if tick - upTimer >= 6600 then
        guiSetVisible (okno2, true)
        guiSetText (nazwa, "Witaj na serwerze (nazwa twojego serwera) "..getPlayerName(localPlayer).."!")
        bindKey ( "enter", "down", onClientChoose )
        onTimerStart = false
        removeEventHandler("onClientPreRender", getRootElement(), camRender)
        end
    end
    
    if onGUIHide then
        local mnoznik = getTickCount()
        local wynik = mnoznik - startTime
        local duracja = endTime - startTime
        local progress = wynik / duracja

        local newX = interpolateBetween ( 
            533*width, 0, 0, 
            785*width, 0, 0, 
            progress, "Linear")
     
        guiSetPosition(okno2, newX - width/2, 116*height, false)
     
        if mnoznik >= endTime then
            onGUIHide = false
            guiSetVisible(okno2, false)
        end
    end
end)

loguj = guiCreateButton(571*width, 342*height, 174*width, 45*height, "Zaloguj", false)
rejestruj = guiCreateButton(571*width, 395*height, 174*width, 45*height, "Zarejestruj", false)
blad = guiCreateLabel(230*width, 427*height, 327*width, 25*height, "", false)
guiSetFont(blad, "clear-normal")
guiLabelSetColor(blad, 255, 0, 0)
guiLabelSetHorizontalAlign(blad, "center", false)
guiLabelSetVerticalAlign(blad, "center")
login = guiCreateEdit(244*width, 343*height, 303*width, 30*height, "", false)
haslo = guiCreateEdit(244*width, 393*height, 303*width, 30*height, "", false)
guiEditSetMasked(haslo, true)
guiSetVisible ( login, false )
guiSetVisible ( haslo, false )
guiSetVisible ( blad, false )
guiSetVisible ( loguj, false )
guiSetVisible ( rejestruj, false )

okno2 = guiCreateGridList(533*width, 116*height, 266*width, 368*height, false)
guiSetAlpha(okno2, 0.86)
nazwa = guiCreateLabel(0.02, 0.01, 0.97, 0.07, "Witaj, na (nazwa twojego serwera)", true, okno2)
guiSetFont(nazwa, "clear-normal")
guiLabelSetHorizontalAlign(nazwa, "center", false)
guiLabelSetVerticalAlign(nazwa, "center")
opis = guiCreateLabel(0.02, 0.09, 0.97, 0.89, "Kliknij enter aby rozpcz?? gr?. ", true, okno2)
guiSetFont(opis, "clear-normal")
guiLabelSetHorizontalAlign(opis, "center", false)
guiLabelSetVerticalAlign(opis, "center")
guiSetVisible (okno2, false)

addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), 
function()
    guiSetVisible ( login, true )
    guiSetVisible ( haslo, true )
    guiSetVisible ( blad, true )
    guiSetVisible ( loguj, true )
    guiSetVisible ( rejestruj, true )
    onPanelShow = true
    showCursor (true)
    muzyka ( "on" )
    showChat(false)
    fadeCamera ( true )
end
)

function onClientLogin(button, state)
       if button == "left" and state == "up" then
        local username = guiGetText(login)
         local password = guiGetText(haslo)
          if username and password then
           triggerServerEvent("login:zaloguj", getRootElement(), localPlayer, username, password)
          else
         guiSetText(blad, "Musisz napisac login i haslo aby zaczac gre.")
      end    
   end
end
addEventHandler("onClientGUIClick", loguj, onClientLogin, false)

function onClientRegister(button, state)
       if button == "left" and state == "up" then
        local username = guiGetText(login)
         local password = guiGetText(haslo)
          if username and password then
           triggerServerEvent("login:zarejestruj", getRootElement(), localPlayer, username, password)
          else
         guiSetText(blad, "Musisz wpisa? login i has?o.")
      end    
   end
end
addEventHandler("onClientGUIClick", rejestruj, onClientRegister, false)

addEvent ( "login:blad", true )
addEventHandler ( "login:blad", root, function ( text )
    if source == localPlayer then
        if guiGetVisible(blad) == false then
            guiSetVisible(blad, true)
        end
    guiSetText ( blad, text )
    end
end)

function onHideLoginWindow(skin)
    guiSetVisible ( login, false )
    guiSetVisible ( haslo, false )
    guiSetVisible ( blad, false )
    guiSetVisible ( loguj, false )
    guiSetVisible ( rejestruj, false )
    showCursor(false)
    onPanelShow = false
    ped = createPed (skin, 1507.85,-1747.84,13.55, 312.05767822266 )
    setPedAnimation ( ped, "ON_LOOKERS", "wave_loop", -1, true, false )
    setElementDimension (localPlayer, 0)
    setElementDimension (ped, 0)
    smoothMoveCamera ( 1500.18, -1638.99, 35, -13000, -30000, -5000, 1495.82, -1740.30, 15.44, 6500, -5000, 0, 7000 )
    onTimerStart = true
end
addEvent("login:schowaj", true)
addEventHandler("login:schowaj", getResourceRootElement(getThisResource()), onHideLoginWindow)


function onClientChoose()
  if getElementDimension (localPlayer) == 0 then
    local nick = getPlayerName ( localPlayer )
    fadeCamera ( localPlayer, true )
    setCameraTarget ( localPlayer)
    toggleControl ("fire",false)
    toggleControl ("action",false)
    toggleControl ("aim_weapon",false)
    destroyElement (ped)
    unbindKey ( "enter", "down", onClientChoose )
    muzyka ("off")
    startTime = getTickCount()
    endTime = startTime + 3000
    onGUIHide = true
    showChat (true)
    setElementData ( localPlayer, "login:zalogowany", true)
  end
end

addEvent ( "login:opis", true )
addEventHandler ( "login:opis", root, function ( text )
    if source == localPlayer then
        guiSetText ( opis, text )
    end
end)



Nie testowa?em :)

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Tagi: logowanie
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