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

Wysłany: 2015-11-01, 12:59


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4275 dni
Posty: 446
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1034

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
Witam. Mam problem z panelem logowania kt?ry ?ci?gn??em a nawet zg?osi?em ten b??d :p . Ale do rzeczy. Kiedy wejd? na serwer to t?o tego panelu logowania jest czarne a powinien by? ten efekt ruszaj?cej sie kamery. Wida? go tylko kiedy odpale go kiedy jestem w grze. Mo?e to kto? poprawi? bo nie wiem jak :eye:

mojeW,mojeH = 800, 600
sW,sH = guiGetScreenSize()
w, h = (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)
                setCameraTarget (sm.object1)
    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 musicSettings ( opcja )
    if opcja == "on" then
        sound = playSound ( "muza.mp3", true )
    elseif opcja == "off" then
        stopSound ( sound )
    end
end

--GUI
loguj = guiCreateButton(379*w, 346*h, 210*w, 40*h, "Zaloguj ", false)
rejestruj = guiCreateButton(379*w, 396*h, 210*w, 40*h, "Zarejestruj", false)
login = guiCreateEdit(379*w, 206*h, 214*w, 32*h, "", false)
haslo = guiCreateEdit(379*w, 296*h, 214*w, 32*h, "", false)
guiEditSetMasked(haslo, true)
guiSetVisible(loguj, false)
guiSetVisible(haslo, false)
guiSetVisible(rejestruj, false)
guiSetVisible(login, false)

--DX
function panelek()
dxDrawRectangle(236*w, 140*h, 367*w, 318*h, tocolor(0, 0, 0, 170), false)
dxDrawText("Login:", 379*w, 165*h, 446*w, 206*h, tocolor(0,200,0), 1.10*w, "pricedown", "left", "top", false, false, true, false, false)
dxDrawText("Has?o:", 379*w, 259*h, 454*w, 296*h, tocolor(0,200,0), 1.10*w, "pricedown", "left", "top", false, false, true, false, false)
dxDrawText("Center RPG", 302*w, 116*h, 530*w, 154*h, tocolor(0,200,0), 1.20*w, "bankgothic", "left", "top", false, false, true, false, false)
dxDrawText("Center RPG to serwer RPG kt?ry zaciekawi Ciebie i twoich znajomych! Zapro? ich do gry a Twoja rozgrywka b?dzie jeszcze lepsza!", 251*w, 269*h, 365*w, 306*h, tocolor(255, 255, 255, 255), 1.00*w, "default", "center", "top", false, true, true, false, false)
dxDrawRectangle(236*w, 458*h, 367*w, 18*h, tocolor(0,200,0), false)
end

--FUNKCJA WYCISZ    
function wycisz ()
 if getSoundVolume ( sound ) <= 0 then
  stopSound ( sound )
  killTimer ( timer )
 return end
 volume = tonumber ( getSoundVolume ( sound ) )
 volume = volume - 0.05
 setSoundVolume ( sound, volume )
end

addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), 
function()
addEventHandler ("onClientRender", getRootElement(), panelek)
guiSetVisible(loguj, true)
guiSetVisible(haslo, true)
guiSetVisible(rejestruj, true)
guiSetVisible(login, true)
showPlayerHudComponent ("all", false)
showCursor (true)
musicSettings ( "on" )
smoothMoveCamera(1561.7541503906, -1373.9388427734, 100, 0, -2500, 0, 1823.3835449219, -1820.5555419922, 36, -999999, -999999, -10000, 2*70000 )
end
)

function zaloguj(button, state)
       if button == "left" and state == "up" then
        local username = guiGetText(login)
         local password = guiGetText(haslo)
          if username and password then
           triggerServerEvent("submitLogin", getRootElement(), localPlayer, username, password)
          else
         outputChatBox ( "Wpisz login i has?o." )
      end    
   end
end
addEventHandler("onClientGUIClick", loguj, zaloguj, false)

function zarejestuj(button, state)
    if button == "left" and state == "up" then
        local username = guiGetText(login)
        local password = guiGetText(haslo)
        if username and password then
            if (string.len(username)>=4) then
                if (string.len(password)>=4) then             
                triggerServerEvent("submitRegister", getRootElement(), localPlayer, username, password)
                 else
                outputChatBox ( "Has?o musi zawiera? minimalnie 4 znaki" )
                end   
            else
            outputChatBox ( "Login musi zawiera? minimalnie 4 znaki." )
            end
        else
        outputChatBox ( "Wpisz sw?j login i has?o" )
        end
    end 
end
addEventHandler("onClientGUIClick", rejestruj, zarejestuj, false)

function hideLoginWindow()
removeEventHandler ("onClientRender", getRootElement(), panelek)
removeEventHandler ( "onClientPreRender", getRootElement(), camRender )
guiSetVisible(loguj, false)
guiSetVisible(haslo, false)
guiSetVisible(rejestruj, false)
guiSetVisible(login, false)
fadeCamera ( true )
timer = setTimer ( wycisz, 150, 0 )
setElementPosition (localPlayer,835.13849, -2831.10522, 243.55536)
setElementDimension (localPlayer, 0)
setCameraTarget ( localPlayer )
showCursor (false)
setElementFrozen ( localPlayer, false )
end
addEvent("schowajlogina", true)
addEventHandler("schowajlogina", getResourceRootElement(getThisResource()), hideLoginWindow)


Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-01, 14:22


#404







Wiek: 27
Na forum: 4913 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
Przy wej?ciu na serwer dodaj funkcj? fadeCamera


Więcej informacji znajdziesz w Wikipedii MTA:

fadeCamera


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-01, 14:24


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4275 dni
Posty: 446
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1034

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
"DestroY" napisał/a:

Przy wej?ciu na serwer dodaj funkcj? fadeCamera


Więcej informacji znajdziesz w Wikipedii MTA:

fadeCamera


Wiesz mniej-wi?cej gdzie? Bo pr?bowa?em do eventu "onClientPreRender" i grzyb z tego wyszed? ;)


PS. Zdublowa?e? posty xD

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-01, 14:26


#404







Wiek: 27
Na forum: 4913 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
jg2aviva1, a chocia?by do tego dodaj


addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), 
function()
addEventHandler ("onClientRender", getRootElement(), panelek)
guiSetVisible(loguj, true)
guiSetVisible(haslo, true)
guiSetVisible(rejestruj, true)
guiSetVisible(login, true)
showPlayerHudComponent ("all", false)
showCursor (true)
musicSettings ( "on" )
smoothMoveCamera(1561.7541503906, -1373.9388427734, 100, 0, -2500, 0, 1823.3835449219, -1820.5555419922, 36, -999999, -999999, -10000, 2*70000 )
end
)



PS: Jaki? lag i si? zdublowa?y xD

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-01, 14:35


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4275 dni
Posty: 446
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1034

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
Dalej czarne t?o. Ta funkcja wygl?da tak:

addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), 
function()
addEventHandler ("onClientRender", getRootElement(), panelek)
guiSetVisible(loguj, true)
fadeCamera ( source, false, 1.0, 255, 0, 0 ) 
guiSetVisible(haslo, true)
guiSetVisible(rejestruj, true)
guiSetVisible(login, true)
showPlayerHudComponent ("all", false)
showCursor (true)
musicSettings ( "on" )
smoothMoveCamera(1561.7541503906, -1373.9388427734, 100, 0, -2500, 0, 1823.3835449219, -1820.5555419922, 36, -999999, -999999, -10000, 2*70000 )
end
)


Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-01, 14:37


#404







Wiek: 27
Na forum: 4913 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
jg2aviva1, nie false a true...

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-01, 14:49


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4275 dni
Posty: 446
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1034

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
"DestroY" napisał/a:

jg2aviva1, nie false a true...


wci?? to samo ;(

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-01, 16:14


#404







Wiek: 27
Na forum: 4913 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
jg2aviva1, ehhh my?la?em, ?e rozr??niasz client a server i nie sprawdza?em szczeg??owo...


fadeCamera (true) 


Postaw piwo autorowi tego posta
 

 
Tagi: kamera
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Kamera 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