Wysłany: 2018-10-20, 23:50
warzit
Wiek: 32 Na forum: 3319 dni Posty: 71
Nick w MP: Lorson
Piwa : 1
Jest problem ze stacjami paliw ze nie wida? blip?w oraz marker?w lecz jak si? podjedzie do dystrybutora jest tankowanie, wyswietla tylko takie co?, na dole macie jeszcze kod
Co sie wyswietla w db3: WARNING NL-CPNY/client.lua;37; Bad Argument @GuiSetVisible [Expected Gui-element at argument 1, got nil
Kod stacji Client Kod: --Hawanek|2018-06-26
mojeW,mojeH = 1360, 768
sW,sH = guiGetScreenSize()
w, h = (sW/mojeW), (sH/mojeH)
bar = guiCreateProgressBar(370*w, 552.6*h, 600*w, 43*h, false)
guiSetVisible(bar,false)
label = guiCreateLabel(50*w, 10*h, 460*w, 23*h, "Paliwo: 100 L", false, bar)
guiLabelSetColor(label, 00, 90, 255)
guiLabelSetHorizontalAlign(label, "center", false)
guiLabelSetVerticalAlign(label, "center")
local stacje={
{-2029.65,156.79,28.84},
{-2416.11,975.36,45.30},
{2149.53,2748.28,10.50},
{2202.44,2475.09,10.82},
{2114.87,919.88,10.50},
{2640.27,1106.91,10.51},
{52.17, 1214.50, 19.08},
{-1328.90,2677.17,49.74},
{-1470.59,1863.39,32.31},
{1381.37,458.11,19.65},
{57.37, 1214.51, 19.08},
{-1676.75,413.22,7.18},
}
for _,v in ipairs(stacje)do
local marker=createMarker(v[1],v[2],v[3]-3.5,"cylinder",7,0,0, 0,0)
local x,y,z = getElementPosition(marker)
setElementData(marker,"stacja",true)
end
addEventHandler("onClientMarkerHit",resourceRoot,function(e)
if e==localPlayer then
if getElementData(source,"stacja") then
if getElementType(e)=="player" then
if getPedOccupiedVehicle(e) then
if getElementData(getPedOccupiedVehicle(e),"vehicle:fuel") then
guiSetVisible(bar,true)
guiSetVisible(barr,true)
guiSetText(label,"Paliwo: "..getElementData(getPedOccupiedVehicle(e),"vehicle:fuel").." L")
guiProgressBarSetProgress(bar,getElementData(getPedOccupiedVehicle(e),"vehicle:fuel"))
bindKey("space","down",tankuj)
end
end
end
end
end
end)
addEventHandler("onClientMarkerLeave",resourceRoot,function(e)
if e==localPlayer then
if getElementData(source,"stacja") then
unbindKey("space","down",tankuj)
guiSetVisible(bar,false)
guiSetVisible(barr,false)
end
end
end)
function tankuj()
if getPedOccupiedVehicle(localPlayer) then
if getElementData(getPedOccupiedVehicle(localPlayer),"vehicle:fuel")>= 100 then return end
triggerServerEvent("TANKUJ",localPlayer)
end
end
addEvent("TANKUJ",true)
addEventHandler("TANKUJ",root,function()
if source==localPlayer then
local fuel=getElementData(getPedOccupiedVehicle(source),"vehicle:fuel")
setElementData(getPedOccupiedVehicle(source),"vehicle:fuel",fuel+1)
guiSetText(label,"Paliwo: "..getElementData(getPedOccupiedVehicle(source),"vehicle:fuel").." L")
guiProgressBarSetProgress(bar,getElementData(getPedOccupiedVehicle(source),"vehicle:fuel"))
end
end)
Kod Stacji Server Kod: --Hawanek|2018-06-26
local czas = getTickCount()
isBike = {
[509]=true,
[481]=true,
[510]=true,
}
function odejmijPaliwo(pojazd)
if getTickCount() - czas > 150 then
czas = getTickCount()
local paliwo = getElementData(pojazd, "vehicle:fuel") or 0
local vx,vy,vz = getElementVelocity(pojazd)
local spd = ((vx^2+vy^2+vz^2)^(0.5)/150)
if spd > 0 then
paliwo = paliwo-spd*2
setElementData(pojazd, "vehicle:fuel", paliwo)
end
end
end
addEventHandler("onClientRender", root, function()
local pojazd = getPedOccupiedVehicle(localPlayer)
if not pojazd then return end
if isBike[getElementModel(pojazd)] then return end
if not getVehicleEngineState(pojazd) then return end
if getVehicleController(pojazd) ~= localPlayer then return end
odejmijPaliwo(pojazd)
end)
addEvent("TANKUJ",true)
addEventHandler("TANKUJ",root,function()
if getPlayerMoney(source)>= 5 then
takePlayerMoney(source,5)
triggerClientEvent("TANKUJ",source)
end
end)
function zgasSilnik()
for i,v in ipairs(getElementsByType("vehicle")) do
local data = getElementData(v, "vehicle:fuel")
if data then
if tonumber(data) < 0 then
setVehicleEngineState(v, false)
end
end
end
end
setTimer(zgasSilnik, 1000, 0)
function koniecpaliwa()
vehicle = getPedOccupiedVehicle(localPlayer)
if vehicle and (not getElementData(vehicle,"vehicle:fuel") == false ) and getElementData(vehicle,"vehicle:fuel") <= 0 then
setElementData(vehicle,"vehicle:fuel",0)
setElementData(vehicle,"koniecpaliwa",true)
setVehicleEngineState(vehicle,false)
end
end
addEventHandler("onClientRender",root,koniecpaliwa)
c_paliwo nie potrzebne
Wysłany: 2018-10-21, 13:52
Avenged
Młodszy Szkrypter
Wiek: 23 Na forum: 3510 dni Posty: 654
Nick w MP: Avenged
Piwa : 1570
Podpis
LUA, JS, PHP
Zapraszam do skorzystania z moich usług: Klik
Wysłany: 2018-10-21, 14:22
warzit
Wiek: 32 Na forum: 3319 dni Posty: 71
Nick w MP: Lorson
Piwa : 1
Nie znalaz?em zadnej alphy
Podpis
[url=https://zapodaj.net/fde922c932b9a.png.html[/img:0][/url]
Wysłany: 2018-10-21, 14:31
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
Dziewi?ty argument funkcji createMarker.
local marker = createMarker ( v [ 1 ], v [ 2 ], v [ 3 ]- 3.5 , "cylinder" , 7 , 0 , 0 , 0 , 0 )
zmieniasz na
local marker = createMarker ( v [ 1 ], v [ 2 ], v [ 3 ]- 3.5 , "cylinder" , 7 , 0 , 0 , 0 , 255 )
Co do b??du DB3:
Ustawiasz widoczno?? elementu GUI o zmiennej "barr" w dw?ch miejscach - zmienna "barr" nie jest nigdzie wcze?niej zdefiniowana (pro?ciej powiedziane: nie ma elementu o nazwie 'barr').
PS. B??d db3 nie dotyczy problemu z markerem.
Wysłany: 2018-10-21, 14:51
warzit
Wiek: 32 Na forum: 3319 dni Posty: 71
Nick w MP: Lorson
Piwa : 1
? Nie rozumiem ciebie.
Podpis
[url=https://zapodaj.net/fde922c932b9a.png.html[/img:0][/url]
Wysłany: 2018-10-21, 15:06
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
Czego nie rozumiesz:
- przezroczysto?? markera by?a ustawiona na warto?? 0 - by? niewidzialny.
- brak elementu GUI 'barr' powodowa? b??dy.
Je?li nie potrafisz naprawi? tych problem?w - napisali?my Ci ju? co masz dok?adnie zrobi? - najpierw dobrze po?wicz LUA, poczytaj poradniki i inne dokumentacje.
Wysłany: 2018-10-21, 15:14
warzit
Wiek: 32 Na forum: 3319 dni Posty: 71
Nick w MP: Lorson
Piwa : 1
W takim razie co mam zrobi? aby to naprawi??
Podpis
[url=https://zapodaj.net/fde922c932b9a.png.html[/img:0][/url]
Wysłany: 2018-10-21, 15:30
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
Co jest z Tob? go?ciu, ju? napisa?em - zobacz wy?ej, czytanie ze zrozumieniem si? k?ania.
Wysłany: 2018-10-21, 15:32
warzit
Wiek: 32 Na forum: 3319 dni Posty: 71
Nick w MP: Lorson
Piwa : 1
Ale zmieni?em to i dalej nie ma markerow
Podpis
[url=https://zapodaj.net/fde922c932b9a.png.html[/img:0][/url]
Wysłany: 2018-10-21, 15:33
Avenged
Młodszy Szkrypter
Wiek: 23 Na forum: 3510 dni Posty: 654
Nick w MP: Avenged
Piwa : 1570
M?wi?em Ci - poczytaj na temat funkcji , a je?li dalej nie ogarniasz to odstaw programowanie
Podpis
LUA, JS, PHP
Zapraszam do skorzystania z moich usług: Klik
Wysłany: 2018-10-21, 18:25
warzit
Wiek: 32 Na forum: 3319 dni Posty: 71
Nick w MP: Lorson
Piwa : 1
po prostu kombinowa?em z tym z 2 h i jeszcze tego nie zrobi?em..
[ Dodano : 2018-10-21, 18:49 ]
Wgra?em inne cpny, pojawili si? blipy lecz nie ma marker?w
Podpis
[url=https://zapodaj.net/fde922c932b9a.png.html[/img:0][/url]
Wysłany: 2018-10-21, 19:22
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
Poka? ich kod.
Widzialno?? marker?w zale?y od ustawienia przezroczysto?ci (9 argument) lub elementu, dla kt?rego jest widoczny marker (10 argument). Dimensiony/interiory dobre
Wysłany: 2018-10-21, 19:43
warzit
Wiek: 32 Na forum: 3319 dni Posty: 71
Nick w MP: Lorson
Piwa : 1
Dobra, ju? dzia?a z g?ry dzieki
Podpis
[url=https://zapodaj.net/fde922c932b9a.png.html[/img:0][/url]
Tagi: stacje :: paliw
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: