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

Wysłany: 2014-05-12, 23:21


zuraw13







Wiek: 27
Na forum: 5214 dni
Posty: 95
Nick w MP: zuraw113

Piwa: 191

Respekt: 50

Gdy wchodz? na serwer to nie ma kamery, kt?ra powinna by? podczas rejstracji/logiwania, dopiero po wej?ciu na serwer gdy si? zresetuj? ten skrypt, to b?dzie ta kamera, ale i tak przeskakuje. Gdy wyjd? z serwera, to zn?w jak wejd? to nie ma tej kamery.

Film poni?ej:
http://www.youtube.com/wa...eature=youtu.be


Skrypt strona klienta:
sWidth, sHeight = guiGetScreenSize()
anims = {"dnce_M_b","DAN_Left_A","DAN_Down_A","DAN_Loop_A"}
StartSkin = 0
NewSkin = false
local localPlayer = getLocalPlayer()
local x = 1024
local y = 768
local sm = {}
sm.moov = 0
sm.object1, sm.object2 = nil, nil
local months = {
        [0] = "stycznia",
        [1] = "lutego",
        [2] = "marca",
        [3] = "kwietnia",
        [4] = "maja",
        [5] = "czerwca",
        [6] = "lipca",
        [7] = "sierpnia",
        [8] = "wrze?nia",
        [9] = "pa?dziernika",
        [10] = "listopada",
        [11] = "grudnia"
        }

local function camRender ()
    if isElement(sm.object1) and (sm.object2) then
        local x1, y1, z1 = getElementPosition ( sm.object1 )
        local x2, y2, z2 = getElementPosition ( sm.object2 )
        setCameraMatrix ( x1, y1, z1, x2, y2, z2 )
    end
end

local function removeCamHandler ()
    if(sm.moov == 1) then
        sm.moov = 0
        removeEventHandler ( "onClientPreRender", getRootElement(), camRender )
    end
end
 

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" )
 
    addEventHandler ( "onClientPreRender", getRootElement(), camRender )
    sm.moov = 1
    return true
end

login_edit = guiCreateEdit((461/x)*sWidth, (400/y)*sHeight, (150/x)*sWidth, (30/y)*sHeight, ""..getPlayerName(getLocalPlayer()), false)
guiEditSetMaxLength(login_edit, 50)
haslo_edit = guiCreateEdit((461/x)*sWidth, (450/y)*sHeight, (150/x)*sWidth, (30/y)*sHeight, "", false)
guiEditSetMasked(haslo_edit, true)
guiEditSetMaxLength(haslo_edit, 50)
login_btn = guiCreateButton((250/x)*sWidth, (500/y)*sHeight, (200/x)*sWidth, (50/y)*sHeight, "Zaloguj si?", false)
guiSetProperty(login_btn, "NormalTextColour", "FFAAAAAA")
register_btn = guiCreateButton((550/x)*sWidth, (500/y)*sHeight, (200/x)*sWidth, (50/y)*sHeight, "Zarejestruj si?", false)
guiSetProperty(register_btn, "NormalTextColour", "FFAAAAAA")
gosc_btn = guiCreateButton((250/x)*sWidth, (575/y)*sHeight, (500/x)*sWidth, (50/y)*sHeight, "Wejd? jako Go??", false)
guiSetProperty(gosc_btn, "NormalTextColour", "FFAAAAAA")

function renderujemy()
        dxDrawRectangle((200/x)*sWidth, (220/y)*sHeight, (600/x)*sWidth, (430/y)*sHeight, tocolor(0, 0, 0, 200), false)
        dxDrawImage((300/x)*sWidth, (210/y)*sHeight, (350/x)*sWidth, (200/y)*sHeight, ":Polskie_Party/pliki/logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), true)
        dxDrawLine((200/x)*sWidth, (220/y)*sHeight, (800/x)*sWidth, (220/y)*sHeight, tocolor(255, 0, 0, 255), 2, true)
        dxDrawLine((200/x)*sWidth, (650/y)*sHeight, (800/x)*sWidth, (650/y)*sHeight, tocolor(255, 0, 0, 255), 2, true)        
        dxDrawLine((200/x)*sWidth, (220/y)*sHeight, (200/x)*sWidth, (650/y)*sHeight, tocolor(255, 0, 0, 255), 2, true)
        dxDrawLine((800/x)*sWidth, (220/y)*sHeight, (800/x)*sWidth, (650/y)*sHeight, tocolor(255, 0, 0, 255), 2, true)        
        dxDrawText("Nick:", (350/x)*sWidth, (390/y)*sHeight, (10/x)*sWidth, (10/y)*sHeight, tocolor(255, 0, 0, 255), 1.6, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Has?o:", (312/x)*sWidth, (440/y)*sHeight, (10/x)*sWidth, (10/y)*sHeight, tocolor(255, 0, 0, 255), 1.6, "bankgothic", "left", "top", false, false, true, false, false)
end
addEventHandler("onClientRender", root, renderujemy)

function callServerFunction(funcname, ...)
    local arg = { ... }
    if (arg[1]) then
        for key, value in next, arg do
            if (type(value) == "number") then arg[key] = tostring(value) end
        end
    end
    triggerServerEvent("onClientCallsServerFunction", resourceRoot , funcname, unpack(arg))
end

function init()
triggerServerEvent("destroyPP", root, getLocalPlayer())
smoothMoveCamera(-1592, 756, 80, -1592, 756, 80, 2140, 1348, 70, 2140, 1348, 70, 150000)
muzyka = playSound(":Polskie_Party/pliki/Long_and_Junior_-_Polskie_party.mp3")
setSoundVolume(muzyka, 0.70)
showCursor(true)
showPlayerHudComponent("all", false)
showChat(false)
guiSetInputEnabled(true)
removeEventHandler("onClientRender", getRootElement(), td)
end
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), init)

function tdInit()
addEventHandler("onClientRender", getRootElement(), td)
end
addEvent("renderTD", true)
addEventHandler("renderTD", getRootElement(), tdInit)

function login(button, state)
    if button == "left" and state == "up" then
        local username = guiGetText(login_edit)
        local password = guiGetText(haslo_edit)
            if string.len(username) < 5 or string.len(password) < 5 then
            showBox("error", "D?ugo?? nicku lub has?a jest zbyt kr?tka.")
            return 
            end
        if username and password then
            triggerServerEvent("probaLogowania", getRootElement(), localPlayer, username, password)
        else
        showBox("info","Wpisz sw?j login i has?o.")
        end
    end
end

function register(button, state)
    if button == "left" and state == "up" then
        local username = guiGetText(login_edit)
        local password = guiGetText(haslo_edit)
        if string.len(username) < 5 or string.len(password) < 5 then
            showBox("error", "D?ugo?? nicku lub has?a jest zbyt kr?tka.")
            return 
        end
        if username and password then
            triggerServerEvent("probaRejestracji", getRootElement(), localPlayer, username, password)
        else
            showBox("info","Wpisz sw?j login i has?o.")
        end
    end
end

function wybieralkaInfo()
dxDrawText("#ffffffWybierz sw?j model postaci. Aby przewija? modele - u?yj #FF9900strza?ek, #ffffffaby zatwierdzi? naci?nij klawisz #FF9900ENTER.", (0/1680)*sWidth, (856/1024)*sHeight, (1679/1680)*sWidth, (905/1024)*sHeight, tocolor(255, 255, 255, 255), 1.5, "default-bold", "left", "top", false, false, true, true, false)
dxDrawText("Wybierz sw?j model postaci. Aby przewija? modele - u?yj strza?ek, aby zatwierdzi? naci?nij klawisz ENTER.", (2/1680)*sWidth, (856/1024)*sHeight, (1681/1680)*sWidth, (905/1024)*sHeight, tocolor(0, 0, 0, 255), 1.5, "default-bold", "left", "top", false, false, false, false, false)
end

function wylaczPanelLogowania()
fadeCamera(false, 0, 0, 0, 0)
setTimer(fadeCamera, 2000, 1, true, 1.0)
removeEventHandler("onClientRender", getRootElement(), renderujemy)
showCursor(false)
guiSetInputEnabled(false)
setCameraTarget(getLocalPlayer())
destroyElement(login_btn)
destroyElement(register_btn)
destroyElement(gosc_btn) --------------------------------
destroyElement(login_edit)
destroyElement(haslo_edit)
destroyElement(sm.object1)
destroyElement(sm.object2)
removeCamHandler()
setCameraMatrix(1943, -2299, 27, 1943, -2302, 26)
skin = createPed(StartSkin, 1942.9174804688, -2303.1630859375, 24.935558319092, 0)
setPedAnimation( skin, "DANCING", anims[math.random(1,4)])
setElementFrozen(skin, true)
addEventHandler("onClientRender", root, wybieralkaInfo)
bindKey("arrow_r","down",NextSkin)
bindKey("arrow_l","down",LastSkin)
bindKey("enter", "down", zalogowany)
end

function NextSkin()
    if StartSkin == 312 then
        StartSkin = -1
    elseif StartSkin == 2 then
        StartSkin = 8
    end
        StartSkin = StartSkin + 1
        local x,y,z = getElementPosition(skin)
        setElementModel(skin,StartSkin)
        setPedAnimation( skin, "DANCING", anims[math.random(1,4)])
        fxAddGlass(x,y,z + 0.5, math.random(0, 255), math.random(0, 255), math.random(0, 255), 255, 0.15, 5)
        setElementPosition(skin, 1942.9174804688, -2303.1630859375, 24.935558319092)
end
function LastSkin()
    if StartSkin == 0 then
        StartSkin = 313
    elseif StartSkin == 9 then
        StartSkin = 3
    end
        StartSkin = StartSkin - 1
        local x,y,z = getElementPosition(skin)
        setElementModel(skin,StartSkin)
        setPedAnimation( skin, "DANCING", anims[math.random(1,4)] )
        fxAddGlass(x,y,z + 0.5, math.random(0, 255), math.random(0, 255), math.random(0, 255), 255, 0.15, 5)
        setElementPosition(skin, 1942.9174804688, -2303.1630859375, 24.935558319092)
end


function fadeOutAudio()
    if not muzyka then return end
    local vol=getSoundVolume(muzyka)
    vol=vol-0.1
    if (vol<0) then
    stopSound(muzyka)

    muzyka=nil
    return
    end
    setSoundVolume(muzyka,vol)
    setTimer(fadeOutAudio, 300, 1)
end

function zalogowany()
stopSound(muzyka)
unbindKey("arrow_r","down",NextSkin)
unbindKey("arrow_l","down",LastSkin)
unbindKey("enter","down",zalogowany)
showPlayerHudComponent("all", true)
--showPlayerHudComponent("vehicle_name", true)
setElementData(localPlayer, "skin", StartSkin)
setCameraTarget(getLocalPlayer())
setTimer(fadeOutAudio, 1000, 1)
removeEventHandler("onClientRender", root, wybieralkaInfo)
addEventHandler("onClientRender", root, td)
callServerFunction("spawn", localPlayer)
local teraz = getRealTime()
local lastonline = getRealTime(getElementData(localPlayer, "ostanioOnline")) or "To jest twoja pierwsza wizyta"
outputChatBox("Witaj, "..getPlayerName(localPlayer), 0, 102, 255)
outputChatBox("Twoja ranga : "..getElementData(localPlayer, "Ranga") or "Gracz", 0, 102, 255) 
outputChatBox("Ostatnio online: "..lastonline.monthday.." "..months[lastonline.month].." ".. 1900 + lastonline.year.." o "..("%02d"):format(lastonline.hour)..":"..("%02d"):format(lastonline.minute), 0, 102, 255)
outputChatBox("Mi?ej gry, ?yczy administracja.",  0, 102, 255)
setElementData(localPlayer, "ostatnioOnline", tonumber(teraz.timestamp))
end



addEvent("HideGUI", true)
addEventHandler("HideGUI", root, wylaczPanelLogowania)
addEventHandler("onClientGUIClick", login_btn, login, false)
addEventHandler("onClientGUIClick", register_btn, register, false)


Skrypt strona serwera:
function callServerFunction(funcname, ...)
    local arg = { ... }
    if (arg[1]) then
        for key, value in next, arg do arg[key] = tonumber(value) or value end
    end
    loadstring("return "..funcname)()(unpack(arg))
end
addEvent("onClientCallsServerFunction", true)
addEventHandler("onClientCallsServerFunction", resourceRoot , callServerFunction)

function logowanie(player, username, password)
    local account = getAccount(username, password)
    if (account ~= false) then
        if (logIn(player, account, password) == true) then
        setCameraTarget(player,player)
            triggerClientEvent (player, "HideGUI", getRootElement())
        else
            triggerClientEvent(player, "CreateBox", getRootElement(), "error", "Uzupe?nij pole 'login' i 'has?o'.")
    end
end
end

addEvent("probaLogowania", true)
addEventHandler("probaLogowania", getRootElement(), logowanie)

function rejestracja(player, username, password)
    local account = getAccount(username, password)
    if (account ~= false) then
    else
        account = addAccount(username, password)
        if (logIn(player, account, password) == true) then
        setCameraTarget(player,player)
        spawn(player)
        triggerClientEvent(player, "CreateBox", getRootElement(), "info", "Zarejestrowa?e? si? pomy?lnie! Witamy na serwerze Polskie Party.")
            triggerClientEvent(player, "HideGUI", getRootElement())
            
        end
    end
end

addEvent("probaRejestracji", true)
addEventHandler("probaRejestracji", getRootElement(), rejestracja)


function resourceStop ()
    setElementData(source, "admin", nil)
    setElementData(source, "vip", nil)
    setElementData(source, "Exp", nil)
    setElementData(source, "money", nil)
    setElementData(source, "datetime", nil)
    setElementData(source, "loggedin", nil)
end
addEventHandler("onResourceStop", getRootElement(), resourceStop)
addEventHandler("onPlayerQuit", getRootElement(), resourceStop)


addEventHandler("onPlayerJoin", root,
function(gracz)
    if isElement(gracz) and getElementType(gracz) == "player" then
    fadeCamera(gracz, true)
    showPlayerHudComponent(gracz, "all", true)
    setElementData(gracz, "Exp", 0)
    setElementData(gracz, "Level", 0)
    setElementData(gracz, "Ranga", "Gracz")
    serverDisplayo = textCreateDisplay()                            
    textDisplayAddObserver ( serverDisplay, gracz )                      
    serverTexto = textCreateTextItem ( "Witaj na serwerze Polskie Party!\nAktualnie trwa pobieranie zasob?w serwera.\nJeste? ciekaw co dla ciebie oferujemy? Chcesz pozna? atrakcje serwera?\nZosta? z nami i poczekaj :).", 0.75, 0.5, "high", 0, 153, 255, 255, 255, 1.5, "right", "bottom", 200 )  
    textDisplayAddText ( serverDisplay, serverText )                      
    spawn(gracz)
    end
end)

function destroyTextdispJoin(gracz)
    if isElement(gracz) and getElementType(gracz) == "player" then
    if serverDisplayo then
    textDisplayRemoveObserver(serverDisplayo, gracz)
    end
end
end
addEvent("destroyPP", true)
addEventHandler("destroyPP", root, destroyTextdispJoin)
function logoutAll ()
    local players = getElementsByType ( "player" ) 
        for k, player in ipairs ( players ) do
            account = getPlayerAccount ( player )
                if ( not isGuestAccount ( account ) ) then 
                    logOut ( player )
                end
        end
end

addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), logoutAll )


Podpis
Moje skrypty i mapy:
-Baza by Zuraw [SAMP]
-RC Vehicles enter by Zuraw [SAMP]
-Neony by zuraw [SAMP]
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-13, 07:02


Zgredek666

LUA






Wiek: 27
Na forum: 4863 dni
Posty: 251
Nick w MP: Zgredek

Piwa: 442

Respekt: 70,1

Do funkcji ktora pokazuje ci panel przy wejsciu na serwer uzyj setcameratarget, fade camera ewentualnie setcameramatrix

Podpis
Piszę skrypty lua na serwery Truck/RPG/Race/DayZ. Kontakt pw!

Pomogłem? Wystarczy jak postawisz :piwo:



Zapraszam na mój kanał na yt:
https://www.youtube.com/c...vgsF65M-Xw5hEDQ
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-13, 14:26


Vike4562

LUA <3






Wiek: 28
Na forum: 5078 dni
Posty: 144
Nick w MP: Vike4562

Piwa: 32

Respekt: 61

gdy zastosujesz setCameraTarget to camera nie b?dzie pod??a?a tylko pokazywa? twoja posta?

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-13, 14:53


zuraw13







Wiek: 27
Na forum: 5214 dni
Posty: 95
Nick w MP: zuraw113

Piwa: 191

Respekt: 50

Nie dzia?a

Podpis
Moje skrypty i mapy:
-Baza by Zuraw [SAMP]
-RC Vehicles enter by Zuraw [SAMP]
-Neony by zuraw [SAMP]
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-13, 15:01


Zgredek666

LUA






Wiek: 27
Na forum: 4863 dni
Posty: 251
Nick w MP: Zgredek

Piwa: 442

Respekt: 70,1

Pokaz kod.

Podpis
Piszę skrypty lua na serwery Truck/RPG/Race/DayZ. Kontakt pw!

Pomogłem? Wystarczy jak postawisz :piwo:



Zapraszam na mój kanał na yt:
https://www.youtube.com/c...vgsF65M-Xw5hEDQ
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-13, 15:10


Maximerr

Programmer PHP, LUA






Wiek: 25
Na forum: 4568 dni
Posty: 548

Piwa: 1051

Respekt: 365,3
Respekt: 365,3Respekt: 365,3Respekt: 365,3Respekt: 365,3

Mia?em ten sam problem ;/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-13, 16:47


Zgredek666

LUA






Wiek: 27
Na forum: 4863 dni
Posty: 251
Nick w MP: Zgredek

Piwa: 442

Respekt: 70,1


function init()
 fadeCamera(source, true, 5)
 setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316)
triggerServerEvent("destroyPP", root, getLocalPlayer())
smoothMoveCamera(-1592, 756, 80, -1592, 756, 80, 2140, 1348, 70, 2140, 1348, 70, 150000)
muzyka = playSound(":Polskie_Party/pliki/Long_and_Junior_-_Polskie_party.mp3")
setSoundVolume(muzyka, 0.70)
showCursor(true)
showPlayerHudComponent("all", false)
showChat(false)
guiSetInputEnabled(true)
removeEventHandler("onClientRender", getRootElement(), td)
end
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), init)


Tak powinno dzia?a?.

Podpis
Piszę skrypty lua na serwery Truck/RPG/Race/DayZ. Kontakt pw!

Pomogłem? Wystarczy jak postawisz :piwo:



Zapraszam na mój kanał na yt:
https://www.youtube.com/c...vgsF65M-Xw5hEDQ
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-13, 17:00


Vike4562

LUA <3






Wiek: 28
Na forum: 5078 dni
Posty: 144
Nick w MP: Vike4562

Piwa: 32

Respekt: 61

aha, to ju? wiem dlaczego nie dzia?a xD

napisa?e? to po stronie client'a a "source" stosuje si? po stronie server'a

to:
Kod:

fadeCamera(source, true, 5)
setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316)


zast?p tym:
Kod:

fadeCamera(true)
setCameraMatrix( 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316)


Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-13, 22:17


zuraw13







Wiek: 27
Na forum: 5214 dni
Posty: 95
Nick w MP: zuraw113

Piwa: 191

Respekt: 50

Dzia?a, kamera teraz ukazuje si? za ka?dym razem, ale kamera dalej "przeskakuje"

Podpis
Moje skrypty i mapy:
-Baza by Zuraw [SAMP]
-RC Vehicles enter by Zuraw [SAMP]
-Neony by zuraw [SAMP]
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-14, 15:59


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

co znaczy przeskakuje

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-14, 17:51


zuraw13







Wiek: 27
Na forum: 5214 dni
Posty: 95
Nick w MP: zuraw113

Piwa: 191

Respekt: 50

Nagra?em film, od 35 sekundy jest w spowolnionym tempie, wtedy to lepiej wida?:
http://www.youtube.com/wa...rZaQB0Bt474svDg

Podpis
Moje skrypty i mapy:
-Baza by Zuraw [SAMP]
-RC Vehicles enter by Zuraw [SAMP]
-Neony by zuraw [SAMP]
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-14, 19:00


Vike4562

LUA <3






Wiek: 28
Na forum: 5078 dni
Posty: 144
Nick w MP: Vike4562

Piwa: 32

Respekt: 61

Masz zapewne jakie? drobne b??dy w x y z

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-14, 20:39


Zgredek666

LUA






Wiek: 27
Na forum: 4863 dni
Posty: 251
Nick w MP: Zgredek

Piwa: 442

Respekt: 70,1

setCameraMatrix(1468.8785400391, -919.25317382813, 100.153465271)
Spr?buj tak

Podpis
Piszę skrypty lua na serwery Truck/RPG/Race/DayZ. Kontakt pw!

Pomogłem? Wystarczy jak postawisz :piwo:



Zapraszam na mój kanał na yt:
https://www.youtube.com/c...vgsF65M-Xw5hEDQ
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-14, 22:32


zuraw13







Wiek: 27
Na forum: 5214 dni
Posty: 95
Nick w MP: zuraw113

Piwa: 191

Respekt: 50

Uda?o mi si? naprawi?

Podpis
Moje skrypty i mapy:
-Baza by Zuraw [SAMP]
-RC Vehicles enter by Zuraw [SAMP]
-Neony by zuraw [SAMP]
Postaw piwo autorowi tego posta
 

 
Tagi: brak :: kamery :: podczas :: logowania/rejstaracji
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