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

Wysłany: 2017-07-30, 01:33


mis14







Wiek: 25
Na forum: 3924 dni
Posty: 185

Piwa: 73

Respekt: -149

kod
local gui=guiCreateWindow(0,0,500,430,"Mandaty",false)
lista=guiCreateGridList(5,20,490,300,false,gui)
guiGridListAddColumn(lista,"",0.9)
info=guiCreateLabel(10,320,480,80,"",false,gui)
guiLabelSetHorizontalAlign(info,"left",true)
zamknij=guiCreateButton(25,400,200,25,"Zamknij",false,gui)
oplac=guiCreateButton(275,400,200,25,"Zap?a? mandat",false,gui)
function centerWindow (center_window)
    local screenWscreenH guiGetScreenSize()
    local windowWwindowH guiGetSize(center_windowfalse)
    local x= (screenW windowW) /2,(screenH windowH) /2
    return guiSetPosition(center_windowxyfalse)
end
centerWindow(gui)
guiSetVisible(gui,false)
addEvent("SAPD:mandaty:pokaz"true)
addEventHandler("SAPD:mandaty:pokaz"resourceRoot, function(dane)
    if #dane==0 then
        outputChatBox("Nie masz ?adnego mandatu do op?acenia :)",0,255,0)
        showCursor(false)
        guiSetVisible(gui,false)
        return
    end
    guiGridListClear(lista)
    guiSetText(info,"")
    for i,v in ipairs(dane) do
        local row guiGridListAddRow(lista)
        if v.odsetki>0 then
            guiGridListSetItemText(lista,row,1,"Wystawiony: "..v.data_wystawienia.." | Kwota: "..v.kwota.."PLN + "..tostring(v.odsetki).."PLN odsetek",false,false)
        else
            guiGridListSetItemText(lista,row,1,"Wystawiony: "..v.data_wystawienia.." | Kwota: "..v.kwota.."PLN",false,false)
        end
        guiGridListSetItemData(lista,row,1,{"Wystawiony za: "..v.powod,v.ID})
    end
    showCursor(true)
    guiSetVisible(gui,true)
    setTimer(guiGridListSetSelectedItem,100,1,lista,0,1)
end)

function click()
    if source==zamknij then
        showCursor(false)
        guiSetVisible(gui,false)
    elseif source==lista then
        local powod=guiGridListGetItemData(lista,guiGridListGetSelectedItem(lista),1)
        if powod~="" and powod[1then
            guiSetText(info,powod[1])
        else
            guiSetText(info,"")
        end
    elseif source==oplac then
        local dane=guiGridListGetItemData(lista,guiGridListGetSelectedItem(lista),1)
        if dane~="" and dane[2then
            triggerServerEvent("SAPD:mandaty:zaplac",resourceRoot,dane[2])
        end
    end
end
addEventHandler("onClientGUIClick",resourceRoot,click)
za bardzo nie wiem jak to naprawi?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-30, 09:30


Kalizman







Wiek: 23
Na forum: 3652 dni
Posty: 1394

Piwa: 4619

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

wow, mo?e by? powiedzia? co.. :x

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-30, 11:53


mis14







Wiek: 25
Na forum: 3924 dni
Posty: 185

Piwa: 73

Respekt: -149

nie ka?dy jest alfa i omega wi?c nie potrafi? tego zrobi? jak by kto? wyt?umaczy?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-30, 15:20


neku^







Wiek: 24
Na forum: 3522 dni
Posty: 461
Nick w MP: neku^

Piwa: 1186

Respekt: 320,5
Respekt: 320,5Respekt: 320,5Respekt: 320,5

Napisz Co ci nie dzia?a, w kt?rym miejscu mo?e le?e? b??d. I podaj db3
W konsoli na serwerze wpisujesz 'debugscript 3'.

Zrestartuj skrypt i zobacz Co Ci si? wy?wietla.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-30, 15:33


mis14







Wiek: 25
Na forum: 3924 dni
Posty: 185

Piwa: 73

Respekt: -149

jak by wyrzuca? b??d bym pokaza? db niestety nie wyrzuca nic

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-30, 19:46


Hades.

Łiiiiiiiiii






Wiek: 22
Na forum: 4700 dni
Posty: 372
Nick w MP: Hades

Piwa: 3214

Respekt: 337,8
Respekt: 337,8Respekt: 337,8Respekt: 337,8

Teraz?

function centerWindow (center_window)
    local screenWscreenH guiGetScreenSize()
    local windowWwindowH guiGetSize(center_windowfalse)
    local x= (screenW windowW) /2,(screenH windowH) /2
    return guiSetPosition(center_windowxyfalse)
end


gui=guiCreateWindow(0,0,500,430,"Mandaty",false)
lista=guiCreateGridList(5,20,490,300,false,gui)
guiGridListAddColumn(lista,"",0.9)
info=guiCreateLabel(10,320,480,80,"",false,gui)
guiLabelSetHorizontalAlign(info,"left",true)
zamknij=guiCreateButton(25,400,200,25,"Zamknij",false,gui)
oplac=guiCreateButton(275,400,200,25,"Zap?a? mandat",false,gui)
guiSetVisible(gui,false)
centerWindow(gui)

addEvent("SAPD:mandaty:pokaz"true)
addEventHandler("SAPD:mandaty:pokaz"resourceRoot, function(dane)
    if #dane==0 then
        outputChatBox("Nie masz ?adnego mandatu do op?acenia :)",0,255,0)
        showCursor(false)
        guiSetVisible(gui,false)
        return
    end
    guiGridListClear(lista)
    guiSetText(info,"")
    for i,v in ipairs(dane) do
        local row guiGridListAddRow(lista)
        if v.odsetki>0 then
            guiGridListSetItemText(lista,row,1,"Wystawiony: "..v.data_wystawienia.." | Kwota: "..v.kwota.."PLN + "..tostring(v.odsetki).."PLN odsetek",false,false)
        else
            guiGridListSetItemText(lista,row,1,"Wystawiony: "..v.data_wystawienia.." | Kwota: "..v.kwota.."PLN",false,false)
        end
        guiGridListSetItemData(lista,row,1,{"Wystawiony za: "..v.powod,v.ID})
    end
    showCursor(true)
    guiSetVisible(gui,true)
    setTimer(guiGridListSetSelectedItem,100,1,lista,0,1)
end)

function click()
    if source==zamknij then
        showCursor(false)
        guiSetVisible(gui,false)
    elseif source==lista then
        local powod=guiGridListGetItemData(lista,guiGridListGetSelectedItem(lista),1)
        if powod~="" and powod[1then
            guiSetText(info,powod[1])
        else
            guiSetText(info,"")
        end
    elseif source==oplac then
        local dane=guiGridListGetItemData(lista,guiGridListGetSelectedItem(lista),1)
        if dane~="" and dane[2then
            triggerServerEvent("SAPD:mandaty:zaplac",resourceRoot,dane[2])
        end
    end
end
addEventHandler("onClientGUIClick",resourceRoot,click)


Podpis
Skrypty/Grafiki na zamówienie!
Kontakt: Discord R35#5507

Discord związany z pomocą: https://discord.gg/ttkQTsc
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-30, 20:31


mis14







Wiek: 25
Na forum: 3924 dni
Posty: 185

Piwa: 73

Respekt: -149

"Damian2511" napisał/a:

Teraz?

function centerWindow (center_window)
    local screenWscreenH guiGetScreenSize()
    local windowWwindowH guiGetSize(center_windowfalse)
    local x= (screenW windowW) /2,(screenH windowH) /2
    return guiSetPosition(center_windowxyfalse)
end


gui=guiCreateWindow(0,0,500,430,"Mandaty",false)
lista=guiCreateGridList(5,20,490,300,false,gui)
guiGridListAddColumn(lista,"",0.9)
info=guiCreateLabel(10,320,480,80,"",false,gui)
guiLabelSetHorizontalAlign(info,"left",true)
zamknij=guiCreateButton(25,400,200,25,"Zamknij",false,gui)
oplac=guiCreateButton(275,400,200,25,"Zap?a? mandat",false,gui)
guiSetVisible(gui,false)
centerWindow(gui)

addEvent("SAPD:mandaty:pokaz"true)
addEventHandler("SAPD:mandaty:pokaz"resourceRoot, function(dane)
    if #dane==0 then
        outputChatBox("Nie masz ?adnego mandatu do op?acenia :)",0,255,0)
        showCursor(false)
        guiSetVisible(gui,false)
        return
    end
    guiGridListClear(lista)
    guiSetText(info,"")
    for i,v in ipairs(dane) do
        local row guiGridListAddRow(lista)
        if v.odsetki>0 then
            guiGridListSetItemText(lista,row,1,"Wystawiony: "..v.data_wystawienia.." | Kwota: "..v.kwota.."PLN + "..tostring(v.odsetki).."PLN odsetek",false,false)
        else
            guiGridListSetItemText(lista,row,1,"Wystawiony: "..v.data_wystawienia.." | Kwota: "..v.kwota.."PLN",false,false)
        end
        guiGridListSetItemData(lista,row,1,{"Wystawiony za: "..v.powod,v.ID})
    end
    showCursor(true)
    guiSetVisible(gui,true)
    setTimer(guiGridListSetSelectedItem,100,1,lista,0,1)
end)

function click()
    if source==zamknij then
        showCursor(false)
        guiSetVisible(gui,false)
    elseif source==lista then
        local powod=guiGridListGetItemData(lista,guiGridListGetSelectedItem(lista),1)
        if powod~="" and powod[1then
            guiSetText(info,powod[1])
        else
            guiSetText(info,"")
        end
    elseif source==oplac then
        local dane=guiGridListGetItemData(lista,guiGridListGetSelectedItem(lista),1)
        if dane~="" and dane[2then
            triggerServerEvent("SAPD:mandaty:zaplac",resourceRoot,dane[2])
        end
    end
end
addEventHandler("onClientGUIClick",resourceRoot,click)
nie pomog?o kod od strony serwera
okienka={
{-1620.77699.3318.00},
{-1617.88700.1818.00},
}

function pokaz(el,md)
    if source==mandatmarker then
        local accName=getAccountName(getPlayerAccount(el))
        if (getElementData(el,'player:rank') or 0)>=99 or isObjectInACLGroup("user."..accName,aclGetGroup("Admin")) then
            nieoplacone=exports["ogrpg-db"]:dbGet("select sum(kwota) as a from Mandaty where oplacony=0 && wystawil=-1 limit 1")[1].a
            oplacone=exports["ogrpg-db"]:dbGet("select sum(kwota) as a from Mandaty where oplacony=1 && wystawil=-1 limit 1")[1].a
            oplaconenie=exports["ogrpg-db"]:dbGet("select sum(kwota) as a from Mandaty where oplacony=0 && wystawil>0 limit 1")
            if not oplaconenie[1].a then
                oplaconenie=0
            else
                oplaconenie=oplaconenie[1].a
            end
            oplaconetak=exports["ogrpg-db"]:dbGet("select sum(kwota) as a from Mandaty where oplacony=1 && wystawil>0 limit 1")
            if not oplaconetak[1].a then
                oplaconetak=0
            else
                oplaconetak=oplaconetak[1].a
            end
            outputChatBox("=== Dane z mandat?w ===",el,0,0,255)
            outputChatBox("Fotoradary: "..nieoplacone+oplacone.."PLN",el,0,255,255)
            outputChatBox("=> Nieop?acone: "..nieoplacone.."PLN",el,0,255,255)
            outputChatBox("=> Op?acone: "..oplacone.."PLN",el,0,255,255)
            outputChatBox("Policjanci: "..oplaconenie+oplaconetak.."PLN",el,0,255,255)
            outputChatBox("=> Nieop?acone: "..oplaconenie.."PLN",el,0,255,255)
            outputChatBox("=> Op?acone: "..oplaconetak.."PLN",el,0,255,255)
            outputChatBox("=== Dane z mandat?w ===",el,0,0,255)
        else
            outputChatBox("Brak uprawnie?",el,255,0,0)
        end
        return
    end
    q=exports["ogrpg-db"]:dbGet("select *,IF(data_wystawienia+interval 3 day>now(),0,floor(kwota*0.25)) as odsetki from Mandaty where gracz=? && oplacony=0",getElementData(el,"player:uid"))
    if #q>0 then
        triggerClientEvent(el,"SAPD:mandaty:pokaz",resourceRoot,q)
    else
        outputChatBox("Nie masz ?adnego mandatu do op?acenia :)",el,0,255,0)
    end
end

for i,v in ipairs(okienka) do
    createMarker(v[1],v[2],v[3]-1,"cylinder",1,170,170,170,170)
    local t=createElement("text")
    setElementData(t,"name","Op?acanie mandat?w")
    setElementPosition(t,v[1],v[2],v[3]-0.2)
end
addEventHandler("onMarkerHit",resourceRoot,pokazmandatmarker=createMarker(594.56, -332.911340.51,"cylinder",1.5,255,0,0,170)

function zaplacmandat(id)
    q=exports["ogrpg-db"]:dbGet("select *,IF(data_wystawienia+interval 3 day>now(),0,floor(kwota*0.25)) as odsetki from Mandaty where gracz=? && oplacony=0 limit 1",getElementData(client,"player:uid"),tonumber(id))
    if #q>0 then
        q=q[1]
        kwotamandatu=q.kwota+q.odsetki
        if kwotamandatu>getPlayerMoney(clientthen
            outputChatBox("Nie sta? ci? na op?acenie mandatu!",client,255,0,0)
        else
            exports["ogrpg-db"]:dbSet("update Mandaty set oplacony=1,data_oplacenia=now() where ID=? limit 1",id)
            takePlayerMoney(client,kwotamandatu)
            outputChatBox("Pomy?lnie op?aci?e? mandat!",client,0,255,0)
            q=exports["ogrpg-db"]:dbGet("select *,IF(data_wystawienia+interval 3 day>now(),0,floor(kwota*0.25)) as odsetki from Mandaty where gracz=? && oplacony=0",getElementData(client,"player:uid"))
            exports["ogrpg-db"]:dbSet("update ogrpg_users set bank_money=bank_money+? where id=4",kwotamandatu)
            triggerClientEvent(client,"SAPD:mandaty:pokaz",resourceRoot,q)
        end
    else
        outputChatBox("Wyst?pi? b??d",client,255,0,0)
    end
end
addEvent("SAPD:mandaty:zaplac",true)
addEventHandler("SAPD:mandaty:zaplac",resourceRoot,zaplacmandat)


function mandat(plrcmdtarget,kwota, ...)
    if getElementData(plr,"player:duty") and getElementData(plr,"player:duty") == "SAPD" then
        if not (target) or not (kwota) or not (...) then
            outputChatBox('B??d! U?yj: /'..cmd..' <nick/ID> <kwota> <pow?d/numer pomiaru>',plr,255,0,0)
        else
            if getElementData(plr,"player:rank") < 1 then outputChatBox("*Nie masz uprawnien",plr,255,0,0) return end
            kwota=tonumber(kwota)
            if kwota<=10 then
                outputChatBox('Najmniejsza kwota mandatu to 10 PLN!',plr,255,0,0)
                return 
            elseif kwota>15000 then
                outputChatBox('Kwota mandatu jest zbyt du?a (max. 15.000 PLN).',plr,255,0,0)
                return
            end
            local target=exports['ogrpg-core']:findPlayer(plr,target)
            
            if target then
                local x1,y1,z1=getElementPosition(plr)
                local x2,y2,z2=getElementPosition(target)
                    
                local distance=getDistanceBetweenPoints3D(x1,y1,z1,x2,y2,z2)
                powod=table.concat({...},' ')
                if tonumber(powodthen
                    powod=tonumber(powod)
                    q=exports["ogrpg-db"]:dbGet("select gracz_pozycja,predkosc,id_pojazdu from SAPD_pomiary where ID=? limit 1",powod)
                    if #q>0 then
                        if q[1].id_pojazdu=="0" then
                            q[1].id_pojazdu="publiczny"
                        else
                            q[1].id_pojazdu="UID: "..q[1].id_pojazdu
                        end
                        powod="Miejsce pomiaru: "..fromJSON(q[1].gracz_pozycja)[1]..", pojazd "..q[1].id_pojazdu..", pr?dko??: "..math.floor(q[1].predkosc).."km/h"
                    else
                        return outputChatBox("Nie ma takiego pomiaru pr?dko?ci!",plr,255,0,0)
                    end
                end
                if distance<250 then
                    outputChatBox("#356dceWystawi?es mandat dla "..getPlayerName(target).."#356dce na kwot?#1f7a03 "..kwota.."PLN#356dce. Pow?d:#ff0000 "..powod,plr,0,255,0,true)
                    outputChatBox("#356dceOtrzyma?e? mandat od "..getPlayerName(plr).."#356dce na kwot?#1f7a03 "..kwota.."PLN#356dce. Pow?d:#ff0000 "..powod,target,0,255,0,true)
                    outputChatBox("Funkcjonariusza SAPD wystawi? w komputerze pok?adowym mandat na ciebie, pieni?dze zosta?y pobrane automatycznie!",target,0,255,0)
                    takePlayerMoney(targetkwota)
                    exports["ogrpg-db"]:dbSet("insert into Mandaty values(null,?,?,now(),?,?,?,?,0,0)",getElementData(target,"player:uid"),getPlayerSerial(plr),toJSON({x1,y1,z1},true),getElementData(plr,"player:uid"),powod,kwota)
                else
                    if getElementData(plr,"OstatniPomiar")==target then
                        if getElementData(plr,"OstatniPomiarCzas")>getTickCount() then
                            outputChatBox("#356dceWystawi?es mandat dla "..getPlayerName(target).."#356dce na kwot?#1f7a03 "..kwota.."PLN#356dce. Pow?d:#ff0000 "..powod,plr,0,255,0,true)
                            outputChatBox("#356dceOtrzyma?e? mandat od "..getPlayerName(plr).."#356dce na kwot?#1f7a03 "..kwota.."PLN#356dce. Pow?d:#ff0000 "..powod,target,0,255,0,true)
                            outputChatBox("Mandat mo?esz op?aci? na komisariacie Policji. Po trzech dniach nieop?acenia s? naliczane odsetki w wysoko?ci 25%!",plr,0,255,0)
                            exports["ogrpg-db"]:dbSet("insert into Mandaty values(null,?,?,now(),?,?,?,?,0,0)",getElementData(target,"player:uid"),getPlayerSerial(plr),toJSON({x1,y1,z1},true),getElementData(plr,"player:uid"),powod..". Mandat wystawiony na odleg?o??/ucieczka. Pomiar #"..tostring(getElementData(plr,"OstatniPomiarID")),kwota)
                            setElementData(plr,"OstatniPomiar",nil,true)
                            setElementData(plr,"OstatniPomiarID",nil,true)
                        else
                            outputChatBox("Mo?liwo?? wystawienia mandatu na odleg?o?? jest przedawniona!",plr,255,0,0)
                            setElementData(plr,"OstatniPomiar",nil,true)
                            setElementData(plr,"OstatniPomiarID",nil,true)
                        end
                    end
                    outputChatBox('Jeste? za daleko gracza, ?eby m?c wystawi? mandat.',plr,255,0,0)
                end
            else
                outputChatBox("Nie ma takiego gracza!",plr,255,0,0)
            end
        end
    end
end
addCommandHandler('mandat'mandat)


Postaw piwo autorowi tego posta
 

 
Tagi: nie :: pojawia :: się :: gui
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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