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

Wysłany: 2020-10-31, 15:41


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2614 dni
Posty: 424
Nick w MP: Mazeusz*

Piwa: 1023

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
Siemaneczko, mam problem z od?wie?aniem gridlisty, a dok?adnie po wej?ciu lub tuningu "Akcja" powinna si? zmieni? na demont, aczkolwiek tak si? nie dzieje. Zrobi?em eventy ale pewnie nie prawid?owo. Prosi? bym o pomoc.

S side

for i,v in pairs(stanowiskaSwiatla) do
    v.cuboid=createColCuboid(unpack(v.cpos))
    v.marker=createMarker(v.mpos[1], v.mpos[2], v.mpos[3], "cylinder", 1.1, 0, 131, 255, 255)
    setElementData(v.marker,"marker:duty",v.job_id)
    setElementData(v.marker,"marker:cuboid",v.cuboid)

    t=createElement("text")
    setElementData(t,"name",v.text)
    setElementPosition(t,v.mpos[1], v.mpos[2], v.mpos[3]+1)
    addEventHandler("onMarkerHit", v.marker, function(el,md)
    if getElementType(el)~= "player" then return end
    local cs=getElementData(source, "marker:cuboid")
    if not cs then return end
    local job=getElementData(source,"marker:duty")
    local ljob=getElementData(el,"player:duty")
    if job ~= ljob then
        outputChatBox(" Nie jeste? zatrudniony w tym warsztacie.", el, 255, 0, 0)
        return
    end
    local vehicles=getElementsWithinColShape(cs,"vehicle")
    if #vehicles < 1 then
        outputChatBox(" Na stanowisku monta?u nie ma ?adnego pojazdu.", el,255, 0, 0)
        return
    end
    if #vehicles > 1 then
        outputChatBox(" Na stanowisku monta?u jest zbyt du?o pojazd?w.", el,255, 0, 0)
        return
    end
    if getElementHealth(vehicles[1]) < 900 then
        outputChatBox(" Pojazd jest zbyt uszkodzony!", el, 255, 0, 0)
        return
    end
    triggerClientEvent(el,"pokazPanelTuningu", el , vehicles[1])
    triggerEvent ( "ref_tune_mechSource", el , vehicles[1])
end)
end

addEvent("ref_tune_mechSource", true)
addEventHandler("ref_tune_mechSource", getRootElement(), function(ccar)
    local q = exports['pystories-db']:dbGet("SELECT * FROM pystories_vehicles WHERE id=?", getElementData(ccar, "vehicle:id"))
    local pojazd = {}

    for i = 1, #q do
        table.insert(pojazd, {mk1 = q[i]["mk1"],mk2 = q[i]["mk2"],mk3 = q[i]["mk3"],mk4 = q[i]["mk4"],rh = q[i]["rh"]})
    end

    return tune
end)


C side


                local var_money = math.floor(((procent_dla_melepeciaga/100) * 5));
        triggerServerEvent("tuner_sendInfo", tuner, tuner)
        triggerServerEvent("givePlayerMoney", tuner, var_money);
        triggerServerEvent("ref_tune_mechSource", veh1);



for i,v in ipairs(ulepszenia_pojazdow) do                
                if v[i].name == "MK1" then
                    local MK1 = veh1:getData("vehicle:mk1")
                    local a=guiGridListAddRow(GUIEditor.gridlist[1])        
                    if MK1 then
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 1, tostring(v[i].name), false, false)
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 2, "Addon", false, false)
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 3, "tuning", false, false)
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 4, tostring(v[i].cost), false, false)
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 5, tostring(v[i].desc), false, false)
                    else
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 1, tostring(v[i].name), false, false)
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 2, "Addon", false, false)
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 3, "demtuning - 50%", false, false)
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 4, tostring(v[i].cost), false, false)
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 5, tostring(v[i].desc), false, false)
                    end


Podpis


Modern Stories
Discord
https://discord.gg/MRJSYq8
Forum
https://msmta.pl
Panel Gracza
https://panel.msmta.pl
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-10-31, 16:38


TheGuruPolska







Wiek: 36
Na forum: 3908 dni
Posty: 65
Nick w MP: TheGuru

Piwa: 47

Respekt: 50

Sk?d bierzesz veh1?
 local MK1 = veh1:getData("vehicle:mk1")


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-10-31, 16:40


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2614 dni
Posty: 424
Nick w MP: Mazeusz*

Piwa: 1023

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
addEvent("pokazPanelTuningu", true)
addEventHandler("pokazPanelTuningu", localPlayer, function(veh)
    if not veh or not isElement(veh) or getElementType(veh) ~= "vehicle" then
        outputChatBox("* Brak pojazdu!", 255, 0, 0);
        return
    end
    if getVehicleController(veh) == false then
        outputChatBox("* Brak kierowcy!", 255, 0, 0);
        return
    end
    if getVehicleController(veh):getData("offerta:tuning") then
        outputChatBox("* Kierowca aktualnie ma wy?wietlon? ofert?!", 255, 0, 0);
        return
    end
    if not veh:getData('vehicle:id') then 
        outputChatBox("* Ten pojazd nie jest prywatny!", 255, 0, 0);
        return 
    end
    if veh:getData("vehicle:ownedPlayer") ~= getVehicleController(veh):getData("player:sid") then
        outputChatBox("* Ten pojazd nie nale?y do tego kierowcy!", 255, 0, 0)
        return
    end
    if not isElement(GUIEditor.window[1]) then
        if getElementData(veh, "vehicle:spawn") then
            showCursor(true)
            veh1 = veh
            setElementData(localPlayer, "tune:car", veh)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-10-31, 16:43


TheGuruPolska







Wiek: 36
Na forum: 3908 dni
Posty: 65
Nick w MP: TheGuru

Piwa: 47

Respekt: 50

Bez sensu

veh1 = veh
setElementData(localPlayer, "tune:car", veh)

Spr?buj jeszcze zmieni?

for i,v in ipairs(ulepszenia_pojazdow) do                
                if v[i].name == "MK1" then --na v.name


[ Dodano: 2020-10-31, 16:45 ]
A jakie b?edy masz w db3?

[ Dodano: 2020-10-31, 16:57 ]
Tu masz b??dy.

addEvent("ref_tune_mechSource", true)
addEventHandler("ref_tune_mechSource", getRootElement(), function(ccar)
    local q = exports['pystories-db']:dbGet("SELECT * FROM pystories_vehicles WHERE id=?", getElementData(ccar, "vehicle:id"))
    local pojazd = {}

    for i = 1, #q do
        table.insert(pojazd, {mk1 = q[i]["mk1"],mk2 = q[i]["mk2"],mk3 = q[i]["mk3"],mk4 = q[i]["mk4"],rh = q[i]["rh"]})
    end

    return tune -- nie ma tu tune, zamien na pojazd
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-02, 22:35


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2614 dni
Posty: 424
Nick w MP: Mazeusz*

Piwa: 1023

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
Nic nadal to samo, a je?li zamieni? to:

  if v[i].name == "MK1" then --na v.name
To nie pokazuje si? na gridliscie

[ Dodano: 2020-11-02, 23:50 ]
Mniejsza zrobi?em. 8-)

if v[i].name == "MK1" then --na v.name
                    local MK1 = getElementData(veh1, "vehicle:mk1") == 1
                    local a=guiGridListAddRow(GUIEditor.gridlist[1])        
                    if MK1 then
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 1, tostring(v[i].name), false, false)
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 2, "Addon", false, false)
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 3, "demtuning - 50%", false, false)
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 4, tostring(v[i].cost/2), false, false)
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 5, tostring(v[i].desc), false, false)
                    else
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 1, tostring(v[i].name), false, false)
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 2, "Addon", false, false)
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 3, "tuning", false, false)
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 4, tostring(v[i].cost), false, false)
                        guiGridListSetItemText(GUIEditor.gridlist[1], a, 5, tostring(v[i].desc), false, false)
                    end
Mo?na lock

Postaw piwo autorowi tego posta
 

 
Tagi: odświeżanie :: gridlisty
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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