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

Wysłany: 2018-08-04, 02:50


KayBay







Wiek: 26
Na forum: 2887 dni
Posty: 12
Nick w MP: ...

Piwa: 35

Respekt: 60

Ostrzeżeń: 100%
witam pr?buj? odbugowa? paczke stories rpg i mam taki problem i? gdy? nie pojawia mi sie gui jak chce wystawic auto na gielde gdy auto jest zniszczone i wjade w market to jest napisane ze auto jest uszkodzone a jesli auto nie jest uszkodzone i wszystko jest okej gdy wje?d?am w marker nic sie nie pokazuje 0 reakcji tu macie kod


Cytat:


local screenW, screenH = guiGetScreenSize()
local sx, sy = guiGetScreenSize()
local w,h=(screenW/1680), (screenH/1050)
local font=dxCreateFont("f.ttf", 11)
local font2=dxCreateFont("f.ttf", 12)
local font3=dxCreateFont("f.ttf", 14)
local img=dxCreateTexture("i/sale.png")


function mysz(psx,psy,pssx,pssy,abx,aby)
if not isCursorShowing() then return end
cx,cy=getCursorPosition()
cx,cy=cx*sx,cy*sy
if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
return true,cx,cy
else
return false
end
end
local pokapoka=false

function gui()
dxDrawImage(645*w, 293*h, 384*w, 451*h, "i/bggielda.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)


dxDrawText("Wpisz cene za jak? ma by? wystawiony tw?j pojazd.", 664*w, 368*h, 1013*w, 480*h, tocolor(255, 255, 255, 255), 1.00*w, font, "center", "center", false, false, false, false, false)


dxDrawImage(755*w, 688*h, 161*w, 46*h, "i/btn.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawText("Wystaw", 754*w, 689*h, 916*w, 734*h, tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
end

marker = createMarker(-2077.30,1348.50,7.10-1, "cylinder", 4, 255, 255, 255, 0)
createBlipAttachedTo(marker, 59, 2, 255, 0, 0, 255, 0, 400)
setElementData(marker,"icon","gielda")

t=createElement("text")
setElementData(t,"text","Wystaw pojazd")
setElementData(t,"scale", 1.4)
local x,y,z=getElementPosition(marker)
setElementPosition(t,x,y,z+1.5)

addEventHandler("onClientMarkerHit", marker, function(hit)
if hit ~= localPlayer then return end
local pojazd = getPedOccupiedVehicle(hit)
if not pojazd then return end
if getPedOccupiedVehicleSeat(hit) ~= 0 then return end
if not getElementData(pojazd, "vehicle:id") then
return
end
if getElementHealth(pojazd) < 900 then
triggerEvent("createAlert", hit, "error", "Tw?j pojazd jest uszkodzony!")
return
end
if getElementData(pojazd, "vehicle:ownedPlayer") ~= getElementData(hit,"player:uid") then return end
addEventHandler("onClientRender", root, gui)
exports['srpg-editbox']:createCustomEditbox("cena", "Podaj cene...", 674*w, 493*h, 329*w, 49*h,false)
showCursor(true, false)
pokapoka = true
toggleControl("enter_exit",false)
end)

addEventHandler("onClientMarkerLeave", marker, function(hit)
if hit ~= localPlayer then return end
local pojazd = getPedOccupiedVehicle(hit)
if not pojazd then return end
removeEventHandler("onClientRender", getRootElement(), gui)
pokapoka=false
exports["srpg-editbox"]:destroyCustomEditbox("cena")
showCursor(false)
toggleControl("enter_exit",true)
end)

local aktpoja = false


addEventHandler("onClientClick", root, function(b, s)
if b ~= "state" and s ~= "down" then return end
if mysz(755*w, 688*h, 161*w, 46*h) and pokapoka ~= false then
local cena = exports["srpg-editbox"]:getCustomEditboxText("cena")
if not tonumber(cena) then
triggerEvent("createAlert", localPlayer, "error", "Cena musi by? liczb?!")
return
end
if cena:len() < 2 then
triggerEvent("createAlert", localPlayer, "error", "Cena pojazdu powinna wynosi? min. 2 liczby!")
return
end
if tonumber(cena) <= 1 then
triggerEvent("createAlert", localPlayer, "error", "Cena musi mie? wi?ksz? warto?? ni? 0!")
return
end
if tonumber(cena) >= 9999999 then
triggerEvent("createAlert", localPlayer, "error", "Cena nie mo?e by? wi?ksza ni? 9999999 PLN!")
return
end
local pojazd = getPedOccupiedVehicle(localPlayer)
if getElementData(pojazd, "gielda") then
triggerEvent("createAlert", localPlayer, "error", "Pojazd jest wystawiony na gie?dzie!")
return
end
setElementData(pojazd, "gielda", {
["cena"] = cena,
["id"] = getElementData(pojazd, "vehicle:id"),
["wlasciciel"] = getPlayerName(localPlayer),
["uwlasciciel"] = getElementData(localPlayer, "player:uid"),
["iwlasciciel"]=getElementData(localPlayer,"id"),
})
cena = string.format("%1.2f", cena)
triggerEvent("createAlert", localPlayer, "success", "Wystawi?e? pojazd "..getVehicleName(pojazd).." za "..cena.." PLN")
setElementData(pojazd, "vehicle:desc", "ID pojazdu: "..getElementData(pojazd, "vehicle:id").."\nModel: "..getVehicleName(pojazd).."\nCena: "..cena.." PLN\nW??cz kursor 'M', po czym kliknij na pojazd, aby uzyska? informacje.")
removeEventHandler("onClientRender", root, gui)
exports["srpg-editbox"]:destroyCustomEditbox("cena")
showCursor(false)
pokapoka = false
elseif mysz(755*w, 688*h, 161*w, 46*h) and aktpoja ~= false then
triggerServerEvent("kuppojazd:gielda", localPlayer, actual_vehicle)
aktpoja = false
removeEventHandler("onClientRender", root, gui2)
showCursor(false)
setTimer(function()
triggerServerEvent("klikanko:true", localPlayer)
end, 500, 1)
elseif mysz(1010*w, 293*h, 19*w, 18*h) and aktpoja ~= false then
aktpoja=false
removeEventHandler("onClientRender", root, gui2)
showCursor(false)
setTimer(function()
triggerServerEvent("klikanko:true", localPlayer)
end, 500, 1)
end
end)


function gui2()
local gielda=getElementData(actual_vehicle,"gielda")
if not gielda then showCursor(false) aktpoja=false return end

dxDrawImage(645*w, 293*h, 384*w, 451*h, "i/bginfo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
naped=getVehicleHandling(actual_vehicle) == "driveType"
dxDrawText(getVehicleName(actual_vehicle).."\n\nW?a?ciciel: "..gielda.wlasciciel:gsub("#%x%x%x%x%x%x","").."\nPrzebieg: "..getElementData(actual_vehicle,"vehicle:mileage").."\nPojemno??: "..getElementData(actual_vehicle,"vehicle:pojemnosc").." dm3\nNap?d: "..getElementData(actual_vehicle,"vehicle:naped").."\n\nCena: "..gielda.cena.." PLN", 664*w, 368*h, 1011*w, 674*h, tocolor(255, 255, 255, 255), 1.00*w, font3, "center", "top", false, false, false, false, false)
dxDrawImage(755*w, 688*h, 161*w, 46*h, "i/btn.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawText("Zakup", 754*w, 689*h, 916*w, 734*h, tocolor(255, 255, 255, 255), 1.00*w, font2, "center", "center", false, false, false, false, false)


local r,g,b,r2,g2,b2=getVehicleColor(actual_vehicle,true)

dxDrawImage(745*w, 637*h, 30*w, 30*h, "i/color.png", 0, 0, 0, tocolor(r,g,b, 255), false)
dxDrawText("Kolor 1 :", 654*w, 636*h, 745*w, 667*h, tocolor(255, 255, 255, 255), 1.00*w, font3, "center", "center", false, false, false, false, false)


dxDrawText("Kolor 2 :", 850*w, 636*h, 941*w, 667*h, tocolor(255, 255, 255, 255), 1.00*w, font3, "center", "center", false, false, false, false, false)
dxDrawImage(941*w, 636*h, 30*w, 30*h, "i/color.png", 0, 0, 0, tocolor(r2,g2,b2, 255), false)




dxDrawRectangle(1010*w, 293*h, 19*w, 18*h, tocolor(117, 0, 0, 255), false)
dxDrawText("X", 1009*w, 292*h, 1029*w, 311*h, tocolor(255, 255, 255, 255), 1.00*w, "default", "center", "center", false, false, false, false, false)
end

addEvent("cuboid", true)
addEventHandler("cuboid", root, function(pojazd)
if aktpoja == false then
actual_vehicle = pojazd
addEventHandler("onClientRender", root, gui2)
showCursor(true)
aktpoja=true
end
end)

addEvent("cuboidoff", true)
addEventHandler("cuboidoff", root, function()
if aktpoja==true then
removeEventHandler("onClientRender", root, gui2)
showCursor(false)
setTimer(function()
triggerServerEvent("klikanko:true", localPlayer)
end, 500, 1)
aktpoja=false
end
end)




a tu db3




pomo?e ktos ?

Podpis







gg:62563729
discord:Pxd520#8266
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-04, 08:51


Kalizman







Wiek: 23
Na forum: 3651 dni
Posty: 1394

Piwa: 4619

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

Pojazd posiada element dat?:
Kod:

vehicle:id
?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-04, 09:20


KayBay







Wiek: 26
Na forum: 2887 dni
Posty: 12
Nick w MP: ...

Piwa: 35

Respekt: 60

Ostrzeżeń: 100%
Tak posiada

[ Dodano: 2018-08-04, 14:22 ]
Ref

Podpis







gg:62563729
discord:Pxd520#8266
Postaw piwo autorowi tego posta
 

 
Tagi: nie :: pokazuje :: sie :: 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 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