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

Wysłany: 2020-10-29, 17:21


Patryk545







Wiek: 25
Na forum: 2224 dni
Posty: 36
Nick w MP: Patryk545

Piwa: 1

Respekt: 50

Witam mam ma?y problem z gie?d? poniewa? gdy wystawi? auto i odjad? kawa?ek od tego blipu od wystawiania auto to te napisay z cen? itp. gin? pomo?e kto??


local marker=createMarker(2119.19, -2091.6412.85-1"cylinder"50,122,255,255,50)
setElementData(marker'typ''pojazd')

local cuboid=createColCuboid(2119.19, -2091.6412.85-127.571.256.25)

createBlip(2119.19, -2091.6412.8543,2,0,0,0,0,0,275)

local wstep=false
local podatek=0

local text=createElement("text")
setElementPosition(text,2119.19, -2091.6412.85)
setElementData(text,"name","Gie?da Los Santos\nUstawianie ceny.")



function getPlayerName2(plr)
if not plr then return end
return getPlayerName(plr):gsub("#%x%x%x%x%x%x","")
end

local wm={}
wm.window=guiCreateWindow(0.740.330.250.50"Gielda"true)
guiWindowSetSizable(wm.windowfalse)
guiWindowSetMovable(wm.windowfalse)
guiSetVisible(wm.windowfalse)
wm.label=guiCreateLabel(0.060.070.890.07"Wpisz cen? kt?ra ma widnie? na poje?dzie."truewm.window)
guiLabelSetHorizontalAlign(wm.label"center"false)
guiLabelSetVerticalAlign(wm.label"center")
wm.label2=guiCreateLabel(0.060.210.890.07"Po odj?ciu podatku cena wyniesie: 0 PLN"truewm.window)
guiLabelSetHorizontalAlign(wm.label2"center"false)
guiLabelSetVerticalAlign(wm.label2"center")
wm.edit=guiCreateEdit(0.060.400.910.10""truewm.window)
wm.submit2=guiCreateButton(0.060.550.900.16"Zgadzam si?"truewm.window)
wm.submit=guiCreateButton(0.060.750.900.20"Akceptuj"truewm.window)

addEventHandler("onClientMarkerHit"resourceRoot, function(el,md)
    if not md or el ~= localPlayer then return end
    if not wstep then return end
    local veh=getPedOccupiedVehicle(localPlayer)
    if not veh then return end
    if getVehicleController(veh) ~= localPlayer then return end
    local spawn=getElementData(veh,"vehicle:id")
    if not spawn then return end
    if getElementHealth(veh) < 900 then
        outputChatBox("#bf0101&#10006; #FFFFFFPosiadasz zbyt uszkodzony pojazd, id? go napraw.",255,255,255,true)
        return
    end
    if getElementData(veh,"vehicle:ownedPlayer") ~= getElementData(localPlayer,"player:sid"then return end
    showCursor(true,false)
    guiSetVisible(wm.windowtrue)
    guiSetVisible(wm.label2false)
    guiSetVisible(wm.submit2false)
    guiSetInputMode("no_binds_when_editing")
end)

addEventHandler("onClientMarkerLeave"resourceRoot, function(el,md)
    if el~=localPlayer then return end
    if not wstep then return end
    showCursor(false)
    guiSetVisible(wm.windowfalse)
end)

addEventHandler("onClientGUIClick"resourceRoot, function()
    if not wstep then return end
    local cena=tonumber(guiGetText(wm.edit))
    if not cena or cena or cena ~= math.floor(cena) or cena 1100000000 then
        outputChatBox("#bf0101&#10006; #FFFFFFPodano nieprawid?ow? cen?.",255255255true)
        return
    end
    local veh=getPedOccupiedVehicle(localPlayer)
    if not veh then return end
    if getVehicleController(veh) ~= localPlayer then return end
    if not getElementData(veh,"vehicle:id"then return end
    if source == wm.submit then
        --podatek=math.floor(cena/2)
        guiSetVisible(wm.submit2true)
        guiSetVisible(wm.label2true)
        guiSetText(wm.label2"Akceptujesz podan? cen?? "..cena.." PLN")
    end
    if source == wm.submit2 then
--    local desc=string.format("Pojazd: %s\nCena: %d PLN\nPrzebieg: %dkm\nSprzedaj?cy: %s\nStatus sprzedaj?cego: Dostepny"getVehicleName(veh), tonumber(cena), getElementData(veh,"vehicle:mileage"), getPlayerName2(localPlayer))
    setElementData(veh,"vehicle:desc",false)
    setElementData(veh,"vehicle:gielda",true)
    setElementData(veh,"vehicle:nazwa:G",getVehicleName(veh))
    setElementData(veh,"vehicle:owner:G",getPlayerName(localPlayer):gsub("#%x%x%x%x%x%x",""),true)
    setElementData(veh,"vehicle:owner:SID",getElementData(localPlayer,"player:sid"))
    setElementData(veh,"vehicle:cena:G",tonumber(cena))
    setElementData(veh,"vehicle:id:G",getElementData(veh"vehicle:id"))
    guiSetVisible(wm.windowfalse)
    showCursor(false)
    end
end)

function znajdzprzezsid(sid)
    if not sid then return end
    for _,p in pairs(getElementsByType('player'),root,false) do
        if getElementData(p,"player:sid") and getElementData(p,"player:sid") == sid then return p end
    end
    return false
end
gielda = {}

function RGBToHex(redgreenbluealpha)
    if ( (red or red 255 or green or green 255 or blue or blue 255) or (alpha and (alpha or alpha 255) ) ) then
        return nil
    end
    if ( alpha then
        return string.format("#%.2X%.2X%.2X%.2X"red,green,blue,alpha)
    else
        return string.format("#%.2X%.2X%.2X"red,green,blue)
    end
end


local function aktualizujdane()
if not isElementWithinColShape(localPlayer,cuboidthen return end
for i,v in ipairs(getElementsByType("vehicle",root,true)) do
    if getElementData(v"vehicle:gielda",truethen
    if getElementData(v"vehicle:id") == getElementData(v"vehicle:id:G"then
    local online=znajdzprzezsid(getElementData(v,"vehicle:owner:SID"))
    if online then jest="#007affDost?pny (ID: "..getElementData(online,"id")..")" else jest="#FF0000Niedost?pny" end
    local desc=string.format("#FFFFFFID Auta: #007aff%d\n#FFFFFFPojazd: "..RGBToHex0122255,false).."%s"..RGBToHex(0122255).."\n#FFFFFFCena: #007aff%d PLN\n#FFFFFFPrzebieg: #007aff%dkm\n#FFFFFFSprzedaj?cy: #007aff%s\n#FFFFFFStatus sprzedaj?cego: %s\n#FFFFFFAby sprawdzi? informacje nt. tego pojazdu wpisz: #007aff/v.info"tonumber(getElementData(v"vehicle:id")), getElementData(v"vehicle:nazwa:G"), tonumber(getElementData(v"vehicle:cena:G")), getElementData(v,"vehicle:mileage"), getElementData(v,"vehicle:owner:G"), jest)
    gielda[v] = desc
    end
    end
    end
end


if not vopisFont then vopisFont "default-bold"vopisrozmiar=1.0 end

function isEventHandlerAddedsEventNamepElementAttachedTofunc )
    if
        typesEventName ) == 'string' and
        isElementpElementAttachedTo ) and
        typefunc ) == 'function'
    then
        local aAttachedFunctions getEventHandlerssEventNamepElementAttachedTo )
        if typeaAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
            for iv in ipairsaAttachedFunctions ) do
                if == func then
                    return true
                end
            end
        end
    end
    return false
end

timerke nil
aktualizujdane()



function renderinge()
if not isElementWithinColShape(localPlayer,cuboidthen return end
    local rootxrootyrootz getCameraMatrix()
    for i,vehicle in ipairs(getElementsByType("vehicle",root,true)) do
        local x,y,z=getElementPosition(vehicle)
        local sx,sy=getScreenFromWorldPosition(x,y,z)
        if sx and sy then
            local desc=gielda[vehicle]
            if desc then
                local distance=getDistanceBetweenPoints3D(rootx,rooty,rootz,x,y,z)
                if distance <= 25 then
                    if isLineOfSightClearrootx,rooty,rootzx,y,ztruetruefalsetruefalsetruetrue,vehicle then
                        dxDrawText(desc:gsub("#%x%x%x%x%x%x",""), sxsysxsytocolor(000255), vopisrozmiar-0.01vopisFont"center""center")
                        dxDrawText(descsxsysxsytocolor(255255255255), vopisrozmiarvopisFont"center""center",false,false,false,true)
                    end
                end
            end
        end
    end
end
addEventHandler("onClientColShapeHit",cuboid,function(el,md)
if not md then return end
if el ~= localPlayer then return end
if isEventHandlerAdded("onClientRender",root,renderingethen
removeEventHandler("onClientRender",root,renderinge)
end
addEventHandler("onClientRender",rootrenderinge)
timerke setTimer(aktualizujdane,3000,0)
end)


addEventHandler("onClientColShapeLeave",cuboid,function(el,md)
if not md then return end
if el ~= localPlayer then return end
if isEventHandlerAdded("onClientRender",root,renderingethen
removeEventHandler("onClientRender",root,renderinge)
end
--if isTimer(timerkethen killTimer(timerkeend
end)
addEventHandler("onClientColShapeHit"cuboid, function(el,md)
    if not md or el ~= localPlayer then return end
    if wstep then return end
    wstep=true
end)

addEventHandler("onClientColShapeLeave"cuboid, function(el,md)
    if getElementData(el,"vehicle:gielda"then gielda[el] = false end
    if not md or el ~= localPlayer then return end
    if not wstep then return end
    local veh=getPedOccupiedVehicle(el)
    if veh then
    --setElementData(veh,"vehicle:desc",false)
    setElementData(veh"vehicle:gielda",false)
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-10-29, 17:26


_jvneczek







Wiek: 22
Na forum: 4326 dni
Posty: 1513
Nick w MP: _jvneczek

Piwa: 3949

Respekt: 337,5
Respekt: 337,5Respekt: 337,5Respekt: 337,5

local cuboid=createColCuboid(2119.19, -2091.64, 12.85-1, 27.5, 71.25, 6.25)
Tworzy ci cuboid, je?li wyjedziesz za ten cuboid to po prostu usuwa ci teksty.
Musisz przestawi? cuboida, zwi?kszy? jego pole.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-10-29, 17:29


Patryk545







Wiek: 25
Na forum: 2224 dni
Posty: 36
Nick w MP: Patryk545

Piwa: 1

Respekt: 50

Ok dzi?ki za pomoc

Postaw piwo autorowi tego posta
 

 
Tagi: giełda
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