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

Wysłany: 2019-03-15, 21:44


Pyrek24







Wiek: 25
Na forum: 3438 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Witam ot?? mam skrypt, na gie?d?, lecz chcia?bym by pokazywa?o " getVehicleUpgrades", tylko nie wiem jak to wklei? do skryptu pomo?e kto? ?
kod po stronie clienta, gdzie jest s? informacje o poje?dzie:

local marker=createMarker(-1908.58,-858.81,32.02-0.5"cylinder"6.5000155)
local cuboid=createColCuboid(-1909.1134033203, -972.0462036132831.273437542227.752)
createBlip(-1893.80,-860.08,32.0243,25,0,0,0,0,0,275)

local wstep=false
local podatek=0

local text=createElement("text")
setElementPosition(text,-1908.58,-858.81,32.02+1.3)
setElementData(text,"name","Gie?da\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 $"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) < 980 then
        outputChatBox("* Posiadasz zbyt uszkodzony pojazd, id? go napraw."25500)
        return
    end
    if getElementData(veh,"vehicle:ownedPlayer") ~= getElementData(localPlayer,"player:uid"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 500000000 then
        outputChatBox("* Podano nieprawid?ow? cen?.")
        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.." $")
    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:UID",getElementData(localPlayer,"player:uid"))
    setElementData(veh,"vehicle:cena:G",tonumber(cena))
    setElementData(veh,"vehicle:id:G",getElementData(veh"vehicle:id"))
    guiSetVisible(wm.windowfalse)
    showCursor(false)
    end
end)

function znajdzprzezuid(uid)
    if not uid then return end
    for _,p in pairs(getElementsByType('player'),root,false) do
        if getElementData(p,"player:uid") and getElementData(p,"player:uid") == uid 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=znajdzprzezuid(getElementData(v,"vehicle:owner:UID"))
    if online then jest="#00FF00Online" else jest="#FF0000Offline" end
        --local Pojemnosc getElementData(v,"Pojemnosc:silnika") or "Zwykla"
        zawieszenie getElementData(v,"Zawieszenie:Pneumatyczne")
        if zawieszenie == 'Tak' then
        Zawie "Zawieszenie pneumatyczne,"
    else
        Zawie ""
    end
        lpg getElementData(v,"Zamontowane:LPG")
        if lpg == 'Tak' then
        gaz "LPG, "
    else
        gaz ""
    end
        drzwi getElementData(v,"vehicle:drzwidogury")
        if drzwi == 'Tak' then
        Drzwii "Drzwi otwieraj?ce si? do g?ry,"
    else
        Drzwii ""
    end
        licznik getElementData(v,"licznik:kolor")
        if licznik == 'CiemnyNiebieski' then
        licznik1 "Pod?wietlenie licznika Ciemno-Niebieskie,"
    else
        licznik1 ""
    end
        if licznik == 'Zolty' then
        licznik2 "Pod?wietlenie licznika ??lt?,"
    else
        licznik2 ""
    end
        if licznik == 'Czerwony' then
        licznik3 "Pod?wietlenie licznika Czerwone,"
    else
        licznik3 ""
    end
        if licznik == 'Fioletowy' then
        licznik4 "Pod?wietlenie licznika Fioletowe,"
    else
        licznik4 ""
    end
     if licznik == 'Turkusowy' then
        licznik5 "Pod?wietlenie licznika Turkusow?,"
    else
        licznik5 ""
    end
     if licznik == 'Rozowy' then
        licznik6 "Pod?wietlenie licznika Ro?ow?,"
    else
        licznik6 ""
    end
     if licznik == 'CiemnyCzerwony' then
        licznik7 "Pod?wietlenie licznika Ciemno-Czerwone,"
    else
        licznik7 ""
    end
     if licznik == 'CiemnyZielony' then
        licznik8 "Pod?wietlenie licznika Ciemno-Zielone,"
    else
        licznik8 ""
    end
     if licznik == 'Zloty' then
        licznik9 "Pod?wietlenie licznika Z?ote,"
    else
        licznik9 ""
    end
     if licznik == 'Neonowe' then
        licznik10 "Pod?wietlenie licznika Neonowe,"
    else
        licznik10 ""
    end
     if licznik == 'JasnyNiebieski' then
        licznik11 "Pod?wietlenie licznika Jasno-Niebieskie,"
    else
        licznik11 ""
    end
     if licznik == 'Pomaranczowy' then
        licznik12 "Pod?wietlenie licznika Pomara?czowe,"
    else
        licznik12 ""
    end
     if licznik == 'Zielony' then
        licznik13 "Pod?wietlenie licznika Zielone,"
    else
        licznik13 ""
    end
        local Dodatki string.format(""..Zawie..""..gaz..""..Drzwii..""..licznik1..""..licznik2..""..licznik3..""..licznik4..""..licznik5..""..licznik6..""..licznik7..""..licznik8..""..licznik9..""..licznik10..""..licznik11..""..licznik12..""..licznik13.."")
    local desc=string.format("Pojazd: %s\n\nCena: %d $\nPrzebieg: %dkm\nSprzedaj?cy: %s\nDodatki: "..Dodatki.."\n\nStatus: %s"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)




Podpis
amta
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-03-15, 22:36


Hades.

Łiiiiiiiiii






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

Piwa: 3214

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


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=znajdzprzezuid(getElementData(v,"vehicle:owner:UID"))
        if online then jest="#00FF00Online" else jest="#FF0000Offline" end
            --local Pojemnosc getElementData(v,"Pojemnosc:silnika") or "Zwykla"
            zawieszenie getElementData(v,"Zawieszenie:Pneumatyczne")
            if zawieszenie == 'Tak' then
            Zawie "Zawieszenie pneumatyczne,"
        else
            Zawie ""
        end
            lpg getElementData(v,"Zamontowane:LPG")
            if lpg == 'Tak' then
            gaz "LPG, "
        else
            gaz ""
        end
            drzwi getElementData(v,"vehicle:drzwidogury")
            if drzwi == 'Tak' then
            Drzwii "Drzwi otwieraj?ce si? do g?ry,"
        else
            Drzwii ""
        end
            licznik getElementData(v,"licznik:kolor")
            if licznik == 'CiemnyNiebieski' then
            licznik1 "Pod?wietlenie licznika Ciemno-Niebieskie,"
        else
            licznik1 ""
        end
            if licznik == 'Zolty' then
            licznik2 "Pod?wietlenie licznika ??lt?,"
        else
            licznik2 ""
        end
            if licznik == 'Czerwony' then
            licznik3 "Pod?wietlenie licznika Czerwone,"
        else
            licznik3 ""
        end
            if licznik == 'Fioletowy' then
            licznik4 "Pod?wietlenie licznika Fioletowe,"
        else
            licznik4 ""
        end
         if licznik == 'Turkusowy' then
            licznik5 "Pod?wietlenie licznika Turkusow?,"
        else
            licznik5 ""
        end
         if licznik == 'Rozowy' then
            licznik6 "Pod?wietlenie licznika Ro?ow?,"
        else
            licznik6 ""
        end
         if licznik == 'CiemnyCzerwony' then
            licznik7 "Pod?wietlenie licznika Ciemno-Czerwone,"
        else
            licznik7 ""
        end
         if licznik == 'CiemnyZielony' then
            licznik8 "Pod?wietlenie licznika Ciemno-Zielone,"
        else
            licznik8 ""
        end
         if licznik == 'Zloty' then
            licznik9 "Pod?wietlenie licznika Z?ote,"
        else
            licznik9 ""
        end
         if licznik == 'Neonowe' then
            licznik10 "Pod?wietlenie licznika Neonowe,"
        else
            licznik10 ""
        end
         if licznik == 'JasnyNiebieski' then
            licznik11 "Pod?wietlenie licznika Jasno-Niebieskie,"
        else
            licznik11 ""
        end
         if licznik == 'Pomaranczowy' then
            licznik12 "Pod?wietlenie licznika Pomara?czowe,"
        else
            licznik12 ""
        end
         if licznik == 'Zielony' then
            licznik13 "Pod?wietlenie licznika Zielone,"
        else
            licznik13 ""
        end
        local tune getVehicleUpgrades(v)
        tune table.concat(tune",")
        if #tune == 0 then return "brak" end
        local Dodatki string.format(""..Zawie..""..gaz..""..Drzwii..""..licznik1..""..licznik2..""..licznik3..""..licznik4..""..licznik5..""..licznik6..""..licznik7..""..licznik8..""..licznik9..""..licznik10..""..licznik11..""..licznik12..""..licznik13.." Tuning: "..tune.."")
        local desc=string.format("Pojazd: %s\n\nCena: %d $\nPrzebieg: %dkm\nSprzedaj?cy: %s\nDodatki: "..Dodatki.."\n\nStatus: %s"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


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-03-16, 08:36


Pyrek24







Wiek: 25
Na forum: 3438 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Okey, a da si? zamiast ID tune, napisa? nazw? tune a nie ID?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-03-16, 21:36


Ciastuuś

Truck soon...






Wiek: 26
Na forum: 3071 dni
Posty: 799
Nick w MP: Ciastuuś

Piwa: 4297

Respekt: 640
Respekt: 640Respekt: 640

"Pyrek24" napisał/a:

Okey, a da si? zamiast ID tune, napisa? nazw? tune a nie ID?



Więcej informacji znajdziesz w Wikipedii MTA:

getVehicleUpgradeSlotName


Podpis
Truck soon...
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-03-17, 12:41


Pyrek24







Wiek: 25
Na forum: 3438 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Ciastu? umia?by? mi to do kodu wporwadzi?, i? jak podmieni?em to getVehicleUpgrades na to getVehicleUpgradeSlotName to mam taki b??d

db3
https://imgur.com/YCBjik1

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