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

Wysłany: 2017-07-22, 16:17


P.Wiśnia

Programista LUA






Wiek: 25
Na forum: 4185 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 378

Respekt: 100
Respekt: 100

Mam problem poniewa? jak gracz wejdzie na serwer to pojawia si? mu gui
https://zapodaj.net/5cf4b6bed36ed.png.html

Server


function refreshgui(element)
    local uid=getElementData(element,"player:uid")
    if not uid then return end
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE ownedPlayer=?", uid)
    triggerClientEvent(element, "org:refresh", resourceRoot, result)
end

addEvent("org:check", true)
addEventHandler("org:check", resourceRoot, function(id,name)
    -- Pobieramy UID gracza
    local uid=getElementData(client,"player:uid")
    if not uid then return end
    -- Sprawdzamy czy jest jeszcze w?‚a?›cicielem
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND ownedPlayer=?", id, uid)
    if #result < 0 then 
        outputChatBox("* Nie jeste?&#8250; w?&#8218;a?&#8250;cicielem pojazdu.", client, 255, 0, 0)
        return
    end
    local org = getElementData(client,"player:organization")
    if not org then outputChatBox("Nie jeste?&#8250; w frakcji!",client,255,0,0) return end
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND parking=0", id, org)
    if #result > 0 then 
        outputChatBox("* Pojazd nie jest w przechowalni!.", client, 255, 0, 0)
        return
    end
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND ownedPlayer=?", id, uid)
    if #result > 0 then 
        if result[1].ownedGroup ~= "0" then 
            local query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET ownedGroup=0 WHERE id=? AND ownedPlayer=?", id, uid)
            outputChatBox("* Zmieni?&#8218;e?&#8250; pojazdowi "..name.."("..id..") przypis na siebie", client)
            refreshgui(client)
            return
        end
    local query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET ownedGroup=? WHERE id=? AND ownedPlayer=?", org, id, uid)
    if query then
        outputChatBox("* Zmieni?&#8218;e?&#8250; pojazdowi "..name.."("..id..") przypis na frakcje", client)
        refreshgui(client)
    end
    end
end)

addEvent("org:download", true)
addEventHandler("org:download", resourceRoot, refreshgui)

Client

local marker=createMarker(358.26,185.35,1008.38-0.9, "cylinder", 1, 255, 255, 255, 155)
setElementInterior(marker, 3)

local screenW, screenH = guiGetScreenSize()
panelorga = false

function PanelUrzad49() 
local Alpha, Alpha2 = interpolateBetween(0, 0, 0, 255, 180, 0, ((getTickCount() - tickorga) / 2500), "Linear") 
dxDrawImage(screenW * 0.0743, screenH * 0.0804, screenW * 0.9400, screenH * 0.8352, ":ogrpg-core/okn.png", 0, 0, 0, tocolor(0, 0, 0, Alpha2), false)
dxDrawText("PRZEPISYWANIE POJAZDOW NA ORGANIZACJE!", screenW * 0.1038, screenH * 0.2702, screenW * 0.9625, screenH * 0.1500, tocolor(255,0,0), 3.00, "default", "center", "center", false, false, false, false, false)        
end

local wmor={}
wmor.window=guiCreateStaticImage(0.12, 0.037, 0.84, 0.9, ":ogrpg-core/okn1.png", true)
guiSetVisible(wmor.window, false)
wmor.label=guiCreateLabel(0.02, 0.19, 0.96, 0.05, "Z ponizszej listy wybierz pojazd ktory chesz przepisac na organizacje a nastepnie kliknij przycisk Przepisz/Wypisz", true, wmor.window)
guiLabelSetHorizontalAlign(wmor.label, "center", false)
guiLabelSetVerticalAlign(wmor.label, "center")
wmor.gridlist=guiCreateGridList(0.25, 0.23, 0.53, 0.5, true, wmor.window)
guiGridListAddColumn(wmor.gridlist, "ID", 0.2)
guiGridListAddColumn(wmor.gridlist, "Nazwa", 0.5)
guiGridListAddColumn(wmor.gridlist, "Organizacja", 0.5)
wmor.submit=guiCreateButton(0.04, 0.74, 0.27, 0.11, "Przepisz / Wypisz", true, wmor.window)
wmor.close=guiCreateButton(0.68, 0.74, 0.28, 0.11, "Zamknij Panel", true, wmor.window)

addEventHandler("onClientGUIClick", root, function(btn,state)
    if source == wmor.submit then
        local selectedRow=guiGridListGetSelectedItem(wmor.gridlist)
        if selectedRow < 0 then return end
        local id=tostring(guiGridListGetItemText(wmor.gridlist, selectedRow, 1))
        local name=tostring(guiGridListGetItemText(wmor.gridlist, selectedRow, 2))
        triggerServerEvent("org:check", resourceRoot, id, name)
    end
    if source == wmor.close then
        if guiGetVisible(wmor.window) == true then
            showCursor(false)
              removeEventHandler("onClientRender",root,PanelUrzad49)
            panelorga = false
            guiSetVisible(wmor.window, false)
        end
    end
end)
 
addEvent("org:refresh", true)
addEventHandler("org:refresh", resourceRoot, function(result)
    guiGridListClear(wmor.gridlist)
    for i,v in pairs(result) do
        if string.len(v.plateText) < 1 then v.plateText="Brak" end
        local row=guiGridListAddRow(wmor.gridlist)
        if tostring(v.ownedGroup) == "0" then v.ownedGroup = "Brak" end
        guiGridListSetItemText(wmor.gridlist, row, 1, v.id, false, false)
        guiGridListSetItemText(wmor.gridlist, row, 2, getVehicleNameFromModel(v.model), false, false)
        guiGridListSetItemText(wmor.gridlist, row, 3, v.ownedGroup , false, false)
    end
end)

addEventHandler("onClientMarkerHit", marker, function(el,md)
    if el~=localPlayer then return end
    if not getElementData(el,"player:organization") then outputChatBox("* Nie posiadasz organizacji!") return end
    if not guiGetVisible(wmor.gridlist) then
        tickorga = getTickCount()
        panelorga = true
        addEventHandler("onClientRender",root,PanelUrzad49)
        guiSetVisible(wmor.window, true)
        showCursor(true)
        triggerServerEvent("org:download", resourceRoot, el)
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-22, 16:21


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

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

Jakie? b??dy DB3

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-22, 16:22


P.Wiśnia

Programista LUA






Wiek: 25
Na forum: 4185 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 378

Respekt: 100
Respekt: 100

Brak

Jest tylko w innym skrypcie w tym folderze.

Error: Loading script failed" ogrpg-offices\c_org4.lua:102:')' expected (to close '(' at line 92) near 'end'

Ostatnio zmieniony przez P.Wiśnia 2017-07-22, 16:24, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-22, 16:24


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

tutaj nigdzie nie masz guiCreateWindow.

[ Dodano: 2017-07-22, 16:25 ]
je?eli jest to w?a?nie to ustaw na false

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-22, 16:25


P.Wiśnia

Programista LUA






Wiek: 25
Na forum: 4185 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 378

Respekt: 100
Respekt: 100

guiCreateStaticImage

[ Dodano: 2017-07-22, 16:32 ]
wmor.window=guiCreateStaticImage(0.12, 0.037, 0.84, 0.9, ":ogrpg-core/okn1.png", true)
guiSetVisible(wmor.window, false)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-22, 16:43


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

to nie jest okno tylko obrazek

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-22, 18:15


P.Wiśnia

Programista LUA






Wiek: 25
Na forum: 4185 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 378

Respekt: 100
Respekt: 100

A da si? zrobi? zeby tworzy?o niewidzialne okno zamiast obrazka?>

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-22, 20:13


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

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

Aidis, no pewnie ?e tak

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-22, 23:55


P.Wiśnia

Programista LUA






Wiek: 25
Na forum: 4185 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 378

Respekt: 100
Respekt: 100

A mo?na pokaza? jak to wygl?da.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-23, 00:07


psychol.







Wiek: 23
Na forum: 3643 dni
Posty: 225
Nick w MP: psychol.

Piwa: 3003

Respekt: 244,5
Respekt: 244,5Respekt: 244,5

"Aidis" napisał/a:

Mam problem poniewa? jak gracz wejdzie na serwer to pojawia si? mu gui
https://zapodaj.net/5cf4b6bed36ed.png.html

Server


function refreshgui(element)
    local uid=getElementData(element,"player:uid")
    if not uid then return end
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE ownedPlayer=?", uid)
    triggerClientEvent(element, "org:refresh", resourceRoot, result)
end

addEvent("org:check", true)
addEventHandler("org:check", resourceRoot, function(id,name)
    -- Pobieramy UID gracza
    local uid=getElementData(client,"player:uid")
    if not uid then return end
    -- Sprawdzamy czy jest jeszcze w?&#8218;a?&#8250;cicielem
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND ownedPlayer=?", id, uid)
    if #result < 0 then 
        outputChatBox("* Nie jeste?&#8250; w?&#8218;a?&#8250;cicielem pojazdu.", client, 255, 0, 0)
        return
    end
    local org = getElementData(client,"player:organization")
    if not org then outputChatBox("Nie jeste?&#8250; w frakcji!",client,255,0,0) return end
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND parking=0", id, org)
    if #result > 0 then 
        outputChatBox("* Pojazd nie jest w przechowalni!.", client, 255, 0, 0)
        return
    end
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND ownedPlayer=?", id, uid)
    if #result > 0 then 
        if result[1].ownedGroup ~= "0" then 
            local query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET ownedGroup=0 WHERE id=? AND ownedPlayer=?", id, uid)
            outputChatBox("* Zmieni?&#8218;e?&#8250; pojazdowi "..name.."("..id..") przypis na siebie", client)
            refreshgui(client)
            return
        end
    local query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET ownedGroup=? WHERE id=? AND ownedPlayer=?", org, id, uid)
    if query then
        outputChatBox("* Zmieni?&#8218;e?&#8250; pojazdowi "..name.."("..id..") przypis na frakcje", client)
        refreshgui(client)
    end
    end
end)

addEvent("org:download", true)
addEventHandler("org:download", resourceRoot, refreshgui)

Client

local marker=createMarker(358.26,185.35,1008.38-0.9, "cylinder", 1, 255, 255, 255, 155)
setElementInterior(marker, 3)

local screenW, screenH = guiGetScreenSize()
panelorga = false

function PanelUrzad49() 
local Alpha, Alpha2 = interpolateBetween(0, 0, 0, 255, 180, 0, ((getTickCount() - tickorga) / 2500), "Linear") 
dxDrawImage(screenW * 0.0743, screenH * 0.0804, screenW * 0.9400, screenH * 0.8352, ":ogrpg-core/okn.png", 0, 0, 0, tocolor(0, 0, 0, Alpha2), false)
dxDrawText("PRZEPISYWANIE POJAZDOW NA ORGANIZACJE!", screenW * 0.1038, screenH * 0.2702, screenW * 0.9625, screenH * 0.1500, tocolor(255,0,0), 3.00, "default", "center", "center", false, false, false, false, false)        
end

local wmor={}
wmor.window=guiCreateStaticImage(0.12, 0.037, 0.84, 0.9, ":ogrpg-core/okn1.png", true)
guiSetVisible(wmor.window, false)
wmor.label=guiCreateLabel(0.02, 0.19, 0.96, 0.05, "Z ponizszej listy wybierz pojazd ktory chesz przepisac na organizacje a nastepnie kliknij przycisk Przepisz/Wypisz", true, wmor.window)
guiLabelSetHorizontalAlign(wmor.label, "center", false)
guiLabelSetVerticalAlign(wmor.label, "center")
wmor.gridlist=guiCreateGridList(0.25, 0.23, 0.53, 0.5, true, wmor.window)
guiGridListAddColumn(wmor.gridlist, "ID", 0.2)
guiGridListAddColumn(wmor.gridlist, "Nazwa", 0.5)
guiGridListAddColumn(wmor.gridlist, "Organizacja", 0.5)
wmor.submit=guiCreateButton(0.04, 0.74, 0.27, 0.11, "Przepisz / Wypisz", true, wmor.window)
wmor.close=guiCreateButton(0.68, 0.74, 0.28, 0.11, "Zamknij Panel", true, wmor.window)

addEventHandler("onClientGUIClick", root, function(btn,state)
    if source == wmor.submit then
        local selectedRow=guiGridListGetSelectedItem(wmor.gridlist)
        if selectedRow < 0 then return end
        local id=tostring(guiGridListGetItemText(wmor.gridlist, selectedRow, 1))
        local name=tostring(guiGridListGetItemText(wmor.gridlist, selectedRow, 2))
        triggerServerEvent("org:check", resourceRoot, id, name)
    end
    if source == wmor.close then
        if guiGetVisible(wmor.window) == true then
            showCursor(false)
              removeEventHandler("onClientRender",root,PanelUrzad49)
            panelorga = false
            guiSetVisible(wmor.window, false)
        end
    end
end)
 
addEvent("org:refresh", true)
addEventHandler("org:refresh", resourceRoot, function(result)
    guiGridListClear(wmor.gridlist)
    for i,v in pairs(result) do
        if string.len(v.plateText) < 1 then v.plateText="Brak" end
        local row=guiGridListAddRow(wmor.gridlist)
        if tostring(v.ownedGroup) == "0" then v.ownedGroup = "Brak" end
        guiGridListSetItemText(wmor.gridlist, row, 1, v.id, false, false)
        guiGridListSetItemText(wmor.gridlist, row, 2, getVehicleNameFromModel(v.model), false, false)
        guiGridListSetItemText(wmor.gridlist, row, 3, v.ownedGroup , false, false)
    end
end)

addEventHandler("onClientMarkerHit", marker, function(el,md)
    if el~=localPlayer then return end
    if not getElementData(el,"player:organization") then outputChatBox("* Nie posiadasz organizacji!") return end
    if not guiGetVisible(wmor.gridlist) then
        tickorga = getTickCount()
        panelorga = true
        addEventHandler("onClientRender",root,PanelUrzad49)
        guiSetVisible(wmor.window, true)
        showCursor(true)
        triggerServerEvent("org:download", resourceRoot, el)
    end
end)


Wystarczy ?e dodasz pod tworzeniem obrazka:
guiSetVisible(wmor.window, false)

Schowa to okno, a one si? pojawi kiedy gracz wejdzie w marker.

Podpis


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-23, 13:05


P.Wiśnia

Programista LUA






Wiek: 25
Na forum: 4185 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 378

Respekt: 100
Respekt: 100

Ale ja to ju? mam.

Dodam ze to si? pojawia na laptopie u mnie na komputerze nie.

Postaw piwo autorowi tego posta
 

 
Tagi: pojawianie :: sie :: gui :: wejsciu
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Pojawianie sie gui po wejsciu Odpowiedz do tematu

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