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

Wysłany: 2015-07-11, 12:55


sebik2303

Mapper :)






Wiek: 25
Na forum: 4301 dni
Posty: 298
Nick w MP: sebik2303

Piwa: 899

Respekt: 55,3

To nie mam :/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-11, 13:02


piotr172







Wiek: 27
Na forum: 4558 dni
Posty: 130

Piwa: 2329

Respekt: 105,3
Respekt: 105,3

To masz tutaj, wklej go do jakiego? pliku, mo?esz nawet nowy stworzy? po stronie clienta.


local sw,sh=guiGetScreenSize()

addEventHandler("onClientRender", getRootElement(), function()
    local rootx, rooty, rootz = getCameraMatrix()
    
    for i, vehicle in ipairs(getElementsByType("vehicle", root, true)) do
        local pojazd_opis = getElementData(vehicle, "pojazd_opis")
        if (pojazd_opis) then
            local x,y,z = getElementPosition(vehicle)
            local distance = getDistanceBetweenPoints3D(rootx, rooty, rootz, x, y, z)
            if (distance<=50) then
                local sx, sy = getScreenFromWorldPosition(x,y,z, 200)
                if (sx and sy) then
                    dxDrawText(pojazd_opis, sx-(sw/5),sy,sx+(sw/5),sy, tocolor(255, 255, 255), 1, "default-small", "center", "center", false, true)
                end
            end
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-11, 13:23


sebik2303

Mapper :)






Wiek: 25
Na forum: 4301 dni
Posty: 298
Nick w MP: sebik2303

Piwa: 899

Respekt: 55,3

piotr172, Panie jak to tera usun?? xD :)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-11, 13:32


piotr172







Wiek: 27
Na forum: 4558 dni
Posty: 130

Piwa: 2329

Respekt: 105,3
Respekt: 105,3

Mozesz to zrobic na komende:


addCommandHandler("usun", function(plr)
    local veh=getPedOccupiedVehicle(plr)
    if (veh) then
removeElementData(veh,"pojazd_opis")
end
end)


Lub stworzy? niewidzialny marker przy wyje?dzie kt?ry to b?dzie usuwa? tak jak ja to zrobi?em.


local x, y=guiGetScreenSize()

        window = guiCreateWindow(220/800*x, 118/600*y, 339/800*x, 321, "Gie?da pojazd?w.", false)
        guiWindowSetSizable(window, false)

        label1 = guiCreateLabel(10/800*x, 43/600*y, 56/800*x, 24/600*y, "Cena:", false, window)
        edit1 = guiCreateEdit(84/800*x, 42/600*y, 239/800*x, 31/600*y, "", false, window)
        button = guiCreateButton(89/800*x, 140/600*y, 177/800*x, 39/600*y, "Zatwierdz", false, window)
        button2 = guiCreateButton(89/800*x, 190/600*y, 177/800*x, 39/600*y, "Wyjdz", false, window)
        label3 = guiCreateLabel(24/800*x, 217/600*y, 289/800*x, 86/600*y, "Po wpisaniu ceny i zatwierdzeniu\nodstaw auto na jakie? wolne miejsce.", false, window)
        guiLabelSetHorizontalAlign(label3, "center", false)
        guiLabelSetVerticalAlign(label3, "center")    
        guiSetVisible(window, false)
        
e_marker = createMarker(x, y, z, "cylinder", 7, 255, 0, 0, 130)  -- marker GUI, sprzedazy
l_marker = createMarker(x, y, z, "corona", 10, 255, 0, 0, 130) --  marker usuwania je?li chcesz aby by? niewidoczny  zamiast 130 wpisz 0



addEventHandler("onClientMarkerHit", e_marker, function(el)
    local veh = getPedOccupiedVehicle ( el )
if (veh and getVehicleController(veh)==el) then
if getElementData(veh,"sprzedaz") == false then
    if not el then return end
    if not getPedOccupiedVehicle(el) then return end
    if el ~= getLocalPlayer() then return end
            guiSetVisible(window, true)
            showCursor(true)
end
end
end)

addEventHandler("onClientMarkerHit", l_marker, function(el)
    if not el then return end
    if not getPedOccupiedVehicle(el) then return end
    if el ~= getLocalPlayer() then return end
    local veh = getPedOccupiedVehicle ( el )
    if veh then
    if getElementData(veh,"sprzedaz") == true then
sElementData(veh,"pojazd_opis", "")
sElementData(veh,"sprzedaz", false)
end
end
end)

addEventHandler("onClientMarkerLeave", e_marker, function(el)
    if not el then return end
    if not getPedOccupiedVehicle(el) then return end
    if el ~= getLocalPlayer() then return end
    guiSetVisible(window, false)
    showCursor(false)
end)

function setDescription(btn)
   local veh = getPedOccupiedVehicle ( localPlayer )
   local model = getElementModel(veh)
   local nazwa=getVehicleNameFromModel(model)
   local id = getElementData(veh,"car_id")
   local przebieg2 = getElementData(veh,"pojazd_przebieg")
   local przebieg= string.format("%.02f",(przebieg2))
   local nick = getPlayerName(localPlayer)
    if btn == "left" then
        local cena = guiGetText(edit1)
            if not tonumber(cena) then return end
            if cena > "999999" then return end
            if cena < "0" then return end
            if veh then
            setElementData(veh,"pojazd_opis", "Typ pojazdu:"..nazwa.."\n Numer pojazdu(id):"..id.."\n Przebieg pojazdu:"..przebieg.." \n Sprzedaj?cy:"..nick.."\n Cena:"..cena.."")
            setElementData(veh,"sprzedaz", true)
                guiSetVisible(window, false)
                showCursor(false)
end
end
end
addEventHandler("onClientGUIClick", button, setDescription)

function setDescription2()
                guiSetVisible(window, false)
                showCursor(false)
end
addEventHandler("onClientGUIClick", button2, setDescription2)


Ostatnio zmieniony przez piotr172 2015-07-11, 13:38, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-11, 13:35


sebik2303

Mapper :)






Wiek: 25
Na forum: 4301 dni
Posty: 298
Nick w MP: sebik2303

Piwa: 899

Respekt: 55,3

piotr172, Czyli mam ca?y kod wklei? ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-11, 13:40


piotr172







Wiek: 27
Na forum: 4558 dni
Posty: 130

Piwa: 2329

Respekt: 105,3
Respekt: 105,3

Tak, tylko p??niej we? x,y,z w marker zmie?, ten niewidzialny ustaw przy wyje?dzie. i to 4n zamie? na \n

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-11, 13:45


sebik2303

Mapper :)






Wiek: 25
Na forum: 4301 dni
Posty: 298
Nick w MP: sebik2303

Piwa: 899

Respekt: 55,3

Nie znika napis :/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-11, 13:52


piotr172







Wiek: 27
Na forum: 4558 dni
Posty: 130

Piwa: 2329

Respekt: 105,3
Respekt: 105,3

OO b??d by? nie zauwa?y?em. Teraz powinno dzia?a?:


addEventHandler("onClientMarkerHit", l_marker, function(el)
    if not el then return end
    if not getPedOccupiedVehicle(el) then return end
    if el ~= getLocalPlayer() then return end
    local veh = getPedOccupiedVehicle ( el )
    if veh then
    if getElementData(veh,"sprzedaz") == true then
setElementData(veh,"pojazd_opis", "")
setElementData(veh,"sprzedaz", false)
end
end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-11, 14:13


sebik2303

Mapper :)






Wiek: 25
Na forum: 4301 dni
Posty: 298
Nick w MP: sebik2303

Piwa: 899

Respekt: 55,3

piotr172, teraz to w og?le nie dzia?a :/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-11, 14:20


piotr172







Wiek: 27
Na forum: 4558 dni
Posty: 130

Piwa: 2329

Respekt: 105,3
Respekt: 105,3

Masz tutaj ca?y kod, podmie? go:


local x, y=guiGetScreenSize()

        window = guiCreateWindow(220/800*x, 118/600*y, 339/800*x, 321, "Gie?da pojazd?w.", false)
        guiWindowSetSizable(window, false)

        label1 = guiCreateLabel(10/800*x, 43/600*y, 56/800*x, 24/600*y, "Cena:", false, window)
        edit1 = guiCreateEdit(84/800*x, 42/600*y, 239/800*x, 31/600*y, "", false, window)
        button = guiCreateButton(89/800*x, 140/600*y, 177/800*x, 39/600*y, "Zatwierdz", false, window)
        button2 = guiCreateButton(89/800*x, 190/600*y, 177/800*x, 39/600*y, "Wyjdz", false, window)
        label3 = guiCreateLabel(24/800*x, 217/600*y, 289/800*x, 86/600*y, "Po wpisaniu ceny i zatwierdzeniu\nodstaw auto na jakie? wolne miejsce.", false, window)
        guiLabelSetHorizontalAlign(label3, "center", false)
        guiLabelSetVerticalAlign(label3, "center")    
        guiSetVisible(window, false)
        
e_marker = createMarker(1640.18945+2, -1139.36218+2, 22.8, "cylinder", 7, 255, 0, 0, 130) 
l_marker = createMarker(1637.15454+0.5, -1147.35291-3, 22.8, "corona", 10, 255, 0, 0, 130) 




addEventHandler("onClientMarkerHit", e_marker, function(el)
    local veh = getPedOccupiedVehicle ( el )
if (veh and getVehicleController(veh)==el) then
if getElementData(veh,"sprzedaz") == false then
    if not el then return end
    if not getPedOccupiedVehicle(el) then return end
    if el ~= getLocalPlayer() then return end
            guiSetVisible(window, true)
            showCursor(true)
end
end
end)

addEventHandler("onClientMarkerHit", l_marker, function(el)
    if not el then return end
    if not getPedOccupiedVehicle(el) then return end
    if el ~= getLocalPlayer() then return end
    local veh = getPedOccupiedVehicle ( el )
    if veh then
    if getElementData(veh,"sprzedaz") == true then
setElementData(veh,"pojazd_opis","")
setElementData(veh,"sprzedaz", false)
end
end
end)

addEventHandler("onClientMarkerLeave", e_marker, function(el)
    if not el then return end
    if not getPedOccupiedVehicle(el) then return end
    if el ~= getLocalPlayer() then return end
    guiSetVisible(window, false)
    showCursor(false)
end)

function setDescription(btn)
   local veh = getPedOccupiedVehicle ( localPlayer )
   local model = getElementModel(veh)
   local nazwa=getVehicleNameFromModel(model)
   local id = getElementData(veh,"car_id")
   local przebieg2 = getElementData(veh,"pojazd_przebieg")
   local przebieg= string.format("%.02f",(przebieg2))
   local nick = getPlayerName(localPlayer)
    if btn == "left" then
        local cena = guiGetText(edit1)
            if not tonumber(cena) then return end
            if cena > "999999" then return end
            if cena < "0" then return end
            if veh then
            setElementData(veh,"pojazd_opis", "Typ pojazdu:"..nazwa.."\n Numer pojazdu(id):"..id.."\n Przebieg pojazdu:"..przebieg.." \n Sprzedaj?cy:"..nick.."\n Cena:"..cena.."")
            setElementData(veh,"sprzedaz", true)
                guiSetVisible(window, false)
                showCursor(false)
end
end
end
addEventHandler("onClientGUIClick", button, setDescription)

function setDescription2()
                guiSetVisible(window, false)
                showCursor(false)
end
addEventHandler("onClientGUIClick", button2, setDescription2)


U mnie normlanie dzia?a. Podmien tylko kordy marker?w.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-11, 15:04


sebik2303

Mapper :)






Wiek: 25
Na forum: 4301 dni
Posty: 298
Nick w MP: sebik2303

Piwa: 899

Respekt: 55,3

piotr172, ok, dzia?a Dzi?ki :)

Postaw piwo autorowi tego posta
 

 
Tagi: sprzedaż :: pojazdów
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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