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

Wysłany: 2018-06-25, 17:28


Kulegg







Wiek: 46
Na forum: 3125 dni
Posty: 283

Piwa: 20

Respekt: 50

Witam,

Nie wyswietla mi sie praca tunera w urzedzie, jak to naprawic?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-06-25, 17:31


PatryKK.

Emeryt LUA






Wiek: 26
Na forum: 3061 dni
Posty: 1060
Nick w MP: PatryKK.

Piwa: 2322

Respekt: 331,5
Respekt: 331,5Respekt: 331,5Respekt: 331,5

Podaj kod

Podpis
GG:75080675
- ✔
- ✔
- ✔
- ✔

Aktualny projekt: BRAK
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-06-25, 17:36


Kulegg







Wiek: 46
Na forum: 3125 dni
Posty: 283

Piwa: 20

Respekt: 50

To jest to? Wzialem to z pystories_offices

 

-- Od?wie?anie tabeli


function getyesterday()
    local realTime=getRealTime()
    date=string.format("%04d-%02d-%02d"realTime.year+1900realTime.month+1realTime.monthday-1)
    return date
end

function getday()
    local realTime=getRealTime()
    date=string.format("%04d-%02d-%02d"realTime.year+1900realTime.month+1realTime.monthday)
    return date
end

function refreshing(client)
    local result=exports["pystories-db"]:dbGet("SELECT * FROM ogrpg_office")
    if result and #result > 0 then
        triggerClientEvent(client"jobs:refresh"resourceRootresult)
    end
end


setTimer(function()
    local result exports['pystories-db']:dbGet("SELECT * from ogrpg_jobs WHERE actived<NOW() - INTERVAL 1 DAY;")
    if result and #result > 0 then
    for i,v in pairs(result) do
        exports['pystories-db']:dbSet("DELETE FROM ogrpg_jobs WHERE code=? and uid=?? and actived=?",v.code,v.uid,v.actived)
        exports['pystories-db']:dbSet("UPDATE ogrpg_office set spaces=spaces-1 where code=?",v.code)
        outputDebugString("pystories-offices.s_selectjob.lua> Wyczyszczono prace z nieaktywnych os?b!")
    end
    end
end864000000) -- 86400000 24h 86400000


addEvent("jobs:download"true)
addEventHandler("jobs:download"resourceRootrefreshing)

addEvent("jobs:hire"true)
addEventHandler("jobs:hire"resourceRoot, function(_,name,code)
    -- Pobieramy UID gracza
    local uid=getElementData(client,"player:sid")
    if not uid then return end
    -- Sprawdzamy czy ktoistnieje w jakiefrakcji
    local result=exports["pystories-db"]:dbGet("SELECT * FROM ogrpg_jobs WHERE uid=?"uid)
    if #result > 0 then 
        outputChatBox("* Ju? jeste? w jakie? pracy zatrudniony(a)."client25500)
        return
    end
    -- Sprawdzamy czy praca ma jakiewolne miejsca
    local result=exports["pystories-db"]:dbGet("SELECT * FROM ogrpg_office WHERE code=?"code)
    if #result > 0 then
        if result[1].spaces == result[1].maxspaces then
            outputChatBox("* W tej pracy nie ma wolnych miejsc."client25500)
            return
        end
    end
    -- Dodajemy gracza do frakcji i nast?pnie od?wie?amy wniki dodajemym dodatkowe miejsca itp.
    local query=exports["pystories-db"]:dbSet("INSERT ogrpg_jobs (code,uid) VALUES (?,?)"codeuid)
    if query then
        exports["pystories-db"]:dbSet("UPDATE ogrpg_office SET spaces=spaces+1 WHERE code=?"code)
        outputChatBox("* Otrzymujesz sta?? prac? w "..name..""client)
        refreshing(client)
    end
end)

addEvent("jobs:slow"true)
addEventHandler("jobs:slow"resourceRoot, function(_,name,code)
    -- Pobieramy UID gracza
    local uid=getElementData(client,"player:sid")
    if not uid then return end
    -- Sprawdzamy czy ktoistnieje w jakiefrakcji
    local result=exports["pystories-db"]:dbGet("SELECT * FROM ogrpg_jobs WHERE uid=?"uid)
    if #result > 0 then
        -- Sprawdzamy czy praca ma jakiewolne miejsca
        local query=string.format("SELECT * FROM ogrpg_office WHERE code=%q"result[1].code)
        local result2=exports["DB2"]:pobierzWyniki(query)
        if #result2 > 0 then
            if result2["spaces"] == 0 then
                outputChatBox("* Wyst?pi? b??d, poniewa? nie by?e? zatrudniony?"client25500)
                return
            end
        end
        -- Usuwamy gracza z frakcji i nast?pnie od?wie?amy wniki usuwamy miejsce itp.
        local result3=exports["pystories-db"]:dbSet("DELETE FROM ogrpg_jobs WHERE code=? AND uid=?"result[1].codeuid)
        if query then
            exports["pystories-db"]:dbSet("UPDATE ogrpg_office SET spaces=? WHERE code=?"result2["spaces"]-1result[1].code)
            outputChatBox("* Zwolni?e?(a?) si? ze sta?ej pracy w "..nameclient)
            refreshing(client)
        end
    else
        outputChatBox("* Nie jeste? w ?adnej pracy zatrudniony(a)."client25500)
    end
end )





Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-06-25, 18:16


PatryKK.

Emeryt LUA






Wiek: 26
Na forum: 3061 dni
Posty: 1060
Nick w MP: PatryKK.

Piwa: 2322

Respekt: 331,5
Respekt: 331,5Respekt: 331,5Respekt: 331,5

Spr?buj tak:

-- Od?wie?anie tabeli


function getyesterday()
    local realTime=getRealTime()
    date=string.format("%04d-%02d-%02d"realTime.year+1900realTime.month+1realTime.monthday-1)
    return date
end

function getday()
    local realTime=getRealTime()
    date=string.format("%04d-%02d-%02d"realTime.year+1900realTime.month+1realTime.monthday)
    return date
end

function refreshing(client)
    local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_office")
    if result and #result > 0 then
        triggerClientEvent(client"jobs:refresh"resourceRootresult)
    end
end


setTimer(function()
    local result exports['pystories-db']:dbGet("SELECT * from pystories_jobs WHERE actived<NOW() - INTERVAL 1 DAY;")
    if result and #result > 0 then
    for i,v in pairs(result) do
        exports['pystories-db']:dbSet("DELETE FROM pystories_jobs WHERE code=? and uid=?? and actived=?",v.code,v.uid,v.actived)
        exports['pystories-db']:dbSet("UPDATE pystories_office set spaces=spaces-1 where code=?",v.code)
        outputDebugString("pystories-offices.s_selectjob.lua> Wyczyszczono prace z nieaktywnych os?b!")
    end
    end
end864000000) -- 86400000 24h 86400000


addEvent("jobs:download"true)
addEventHandler("jobs:download"resourceRootrefreshing)

addEvent("jobs:hire"true)
addEventHandler("jobs:hire"resourceRoot, function(_,name,code)
    -- Pobieramy UID gracza
    local uid=getElementData(client,"player:sid")
    if not uid then return end
    -- Sprawdzamy czy ktoistnieje w jakiefrakcji
    local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_jobs WHERE uid=?"uid)
    if #result > 0 then 
        outputChatBox("* Ju? jeste? w jakie? pracy zatrudniony(a)."client25500)
        return
    end
    -- Sprawdzamy czy praca ma jakiewolne miejsca
    local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_office WHERE code=?"code)
    if #result > 0 then
        if result[1].spaces == result[1].maxspaces then
            outputChatBox("* W tej pracy nie ma wolnych miejsc."client25500)
            return
        end
    end
    -- Dodajemy gracza do frakcji i nast?pnie od?wie?amy wniki dodajemym dodatkowe miejsca itp.
    local query=exports["pystories-db"]:dbSet("INSERT pystories_jobs (code,uid) VALUES (?,?)"codeuid)
    if query then
        exports["pystories-db"]:dbSet("UPDATE pystories_office SET spaces=spaces+1 WHERE code=?"code)
        outputChatBox("* Otrzymujesz sta?? prac? w "..name..""client)
        refreshing(client)
    end
end)

addEvent("jobs:slow"true)
addEventHandler("jobs:slow"resourceRoot, function(_,name,code)
    -- Pobieramy UID gracza
    local uid=getElementData(client,"player:sid")
    if not uid then return end
    -- Sprawdzamy czy ktoistnieje w jakiefrakcji
    local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_jobs WHERE uid=?"uid)
    if #result > 0 then
        -- Sprawdzamy czy praca ma jakiewolne miejsca
        local query=string.format("SELECT * FROM pystories_office WHERE code=%q"result[1].code)
        local result2=exports["pystories-db"]:pobierzWyniki(query)
        if #result2 > 0 then
            if result2["spaces"] == 0 then
                outputChatBox("* Wyst?pi? b??d, poniewa? nie by?e? zatrudniony?"client25500)
                return
            end
        end
        -- Usuwamy gracza z frakcji i nast?pnie od?wie?amy wniki usuwamy miejsce itp.
        local result3=exports["pystories-db"]:dbSet("DELETE FROM pystories_jobs WHERE code=? AND uid=?"result[1].codeuid)
        if query then
            exports["pystories-db"]:dbSet("UPDATE pystories_office SET spaces=? WHERE code=?"result2["spaces"]-1result[1].code)
            outputChatBox("* Zwolni?e?(a?) si? ze sta?ej pracy w "..nameclient)
            refreshing(client)
        end
    else
        outputChatBox("* Nie jeste? w ?adnej pracy zatrudniony(a)."client25500)
    end
end )


Podpis
GG:75080675
- ✔
- ✔
- ✔
- ✔

Aktualny projekt: BRAK
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-06-25, 18:24


nanKy







Wiek: 22
Na forum: 3865 dni
Posty: 498
Nick w MP: nanky

Piwa: 1773

Respekt: 239
Respekt: 239Respekt: 239

By? mo?e jest to wina tego ?e w tabeli pystories_office nie ma ?adnego rekordu.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-06-25, 18:28


PatryKK.

Emeryt LUA






Wiek: 26
Na forum: 3061 dni
Posty: 1060
Nick w MP: PatryKK.

Piwa: 2322

Respekt: 331,5
Respekt: 331,5Respekt: 331,5Respekt: 331,5

nanKy, Nie, dlatego, ?e kolega zamiast z ogrpg-db oraz zamiast np ogrpg_offices zmienic na pystories to wgral to z ogrpg. Poda?em wy?ej prawid?owy kod.

Podpis
GG:75080675
- ✔
- ✔
- ✔
- ✔

Aktualny projekt: BRAK
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-06-25, 18:37


Kulegg







Wiek: 46
Na forum: 3125 dni
Posty: 283

Piwa: 20

Respekt: 50

Nie dzia?a dalej ;/

[ Dodano: 2018-06-25, 19:43 ]
Naprawi?em, okaza?o si? ?e trzeba by?o tylko dopisa? w bazie danych linijke do pystories-office

Postaw piwo autorowi tego posta
 

 
Tagi: nie :: wyswietla :: sie :: praca :: tunera :: urzedzie
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