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

Wysłany: 2021-05-23, 20:17


DzikiPies







Wiek: 29
Na forum: 1885 dni
Posty: 4



Respekt: 50

Witam, paczka denvera i problem z cpnami

https://imgur.com/a/zl1rkXR

Wie kto? o co mo?e chodzi??

Kod:

ww,hh = 1920, 1080
www,hhh = guiGetScreenSize()
wn, hn = (www/ww), (hhh/hh)
local screenW, screenH = guiGetScreenSize()
dxfont0_lcz = dxCreateFont(":pystories-dashboard/czcionka/normalna.ttf", 12) or "default-bold"
function StacjaGui()
dxDrawRectangle(screenW * 0.3000, screenH * 0.3300, screenW * 0.4000, screenH * 0.2106, tocolor(50,50,50, 200), false)

dxDrawText("Stacja benzynowa\nPosiadasz rodzaj paliwa: "..getElementData(getPedOccupiedVehicle(localPlayer), "vehicle:paliwo").."\nKoszt benzyny za litr to: "..cena.." $\nKliknij spacje aby zatankowa? 1l.", (screenW * 0.3000) +1, (screenH * 0.3600) +1, (screenW * 0.7000) +1, (screenH * 0.4278) +1, tocolor(0,0,0,255), 1.00, dxfont0_lcz, "center", "center", false, false, false, false, false)
dxDrawText("Stacja benzynowa\nPosiadasz rodzaj paliwa: "..getElementData(getPedOccupiedVehicle(localPlayer), "vehicle:paliwo").."\nKoszt benzyny za litr to: "..cena.." $\nKliknij spacje aby zatankowa? 1l.", (screenW * 0.3000) +1, (screenH * 0.3600) +1, (screenW * 0.7000) +1, (screenH * 0.4278) +1, tocolor(255,255,255,255), 1.00, dxfont0_lcz, "center", "center", false, false, false, false, false)
end

function PasekPaliwa()
local Pojazd = getPedOccupiedVehicle(localPlayer)
local fuel = getElementData(Pojazd,"vehicle:fuel") or 0
local bak = getElementData(Pojazd, "bak")
if fuel ~= false and fuel ~= nil and fuel > 0 then
dxDrawRectangle(screenW * 0.3323, screenH * 0.4617, screenW * 0.3354/bak*fuel, screenH * 0.0519, tocolor(255, 185, 0, 255), false)
dxDrawText(math.floor(fuel).."/"..getElementData(Pojazd, "bak").."L", (screenW * 0.3323) +1, (screenH * 0.4780) +1, (screenW * 0.6677) +1, (screenH * 0.4935) +1, tocolor(0,0,0,255), 1.00, dxfont0_lcz, "center", "center", false, false, false, false, false)
dxDrawText(math.floor(fuel).."/"..getElementData(Pojazd, "bak").."L", screenW * 0.3323, screenH * 0.4780, screenW * 0.6677, screenH * 0.4935, tocolor(255,255,255,255), 1.00, dxfont0_lcz, "center", "center", false, false, false, false, false)
end
end

local stacje={
{-1329.38, 2672.14, 50.06},
{-1327.85, 2683.03, 50.06},
{2199.98,2474.98,10.50},
{70.45, 1218.30, 18.81},
{-2415.83, 976.24, 45.30},
{-1328.21, 2677.57, 50.06},
{-1470.59,1863.39,32.31},
{-2029.57, 156.94, 28.84},
{-1682.65, 419.81, 7.18},
{-1676.75,413.22,7.18},
{-93.79, -1174.65, 2.28},
{-88.88, -1163.91, 2.27},
{1003.73, -940.32, 42.18},
{1004.21, -933.94, 42.18},
{1944.35, -1774.27, 13.39},
{1939.24, -1772.90, 13.38},
{-1608.89, -2718.71, 48.54},
{-1605.80, -2714.30, 48.53},
{-1602.10, -2710.11, 48.54},
{-2244.19, -2560.82, 31.92},
{2114.04, 919.75, 10.82},
{615.26, 1689.98, 6.99},
{608.52, 1699.77, 6.99},
{59.31, 1173.47, 18.66},
{59.54, 1163.89, 18.66},
{-2584.56, 605.85, 14.45},
{1031.25, 1746.39, 10.82},
{1031.56, 1739.17, 10.82},
{1025.32, 1737.89, 10.82},
{1024.80, 1745.84, 10.82},
{1163.33, 1341.52, 10.81 },
{1171.86, 1341.47, 10.81},
{1172.48, 1336.21, 10.81},
{1165.25, 1335.87, 10.81},
{1164.35, 1331.15, 10.81},
{1172.12, 1330.64, 10.81},
}

for _,v in ipairs(stacje)do
local marker = createMarker(v[1],v[2],v[3]-0.90,"cylinder",5,0,102,255)
setElementData(marker,"stacja",true)
local blipStacji =createBlipAttachedTo ( marker, 56 )
setBlipVisibleDistance(blipStacji, 400)
end
cena = 1000
addEventHandler("onClientMarkerHit",resourceRoot,function(e)
if e==localPlayer then
if getVehicleName(getPedOccupiedVehicle(localPlayer)) == "Alpha" then return end
if getElementData(source,"stacja") then
if getElementType(e)=="player" then
if getPedOccupiedVehicle(e) then
if getElementData(getPedOccupiedVehicle(e),"vehicle:fuel") then
if getElementData(getPedOccupiedVehicle(e),"vehicle:paliwo") == "benzyna" then
cena = 1300
elseif getElementData(getPedOccupiedVehicle(e),"vehicle:paliwo") == "diesel" then
cena = 1000
elseif getElementData(getPedOccupiedVehicle(e),"vehicle:paliwo") == "gas" then
cena = 800
end
addEventHandler("onClientRender",root,StacjaGui)
addEventHandler("onClientRender",root,PasekPaliwa)
Sx = getTickCount()
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)
removeEventHandler ("onClientRender", root, StacjaGui)
removeEventHandler ("onClientRender", root, PasekPaliwa)
end
end
end)

function tankuj()
if getPedOccupiedVehicle(localPlayer) then
triggerServerEvent("TANKUJ",localPlayer)
end
end
addEvent("TANKUJ",true)
addEventHandler("TANKUJ",root,function()
if source==localPlayer then
local vehicle = getPedOccupiedVehicle(source)
local vehicleFuel = getElementData(vehicle, 'vehicle:fuel') or 0
local vehicleTank = getElementData(vehicle, 'bak') or 40 -- zakladam ze domyslny bak to 40 l
if vehicleFuel < vehicleTank then
setElementData(vehicle, 'vehicle:fuel', vehicleFuel+1)
end
end
end)


Ostatnio zmieniony przez DzikiPies 2021-05-24, 16:43, w całości zmieniany 2 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-05-24, 08:09


TheSebaPL

Mod-team






Wiek: 21
Na forum: 3098 dni
Posty: 964

Piwa: 3102

Respekt: 640,5
Respekt: 640,5Respekt: 640,5

DzikiPies, bez kodu ci nikt nie pomo?e. Wy?lij go a postaramy si? pom?c.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-05-25, 16:30


xyzzz^

A nic






Wiek: 18
Na forum: 1993 dni
Posty: 319
Nick w MP: Aspyk21

Piwa: 308

Respekt: 81

Ostrzeżeń: 100%
nie ma elementdaty bak

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-09-03, 14:13


_jvneczek







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

Piwa: 3949

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

Brak elementdaty bak nadanej na pojazd.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-09-08, 17:55


_jvneczek







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

Piwa: 3949

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

Czy problem zosta? rozwi?zany?

Postaw piwo autorowi tego posta
 

 
Tagi: cpny
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