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

Wysłany: 2021-10-19, 22:40


piotrek87411







Wiek: 26
Na forum: 1754 dni
Posty: 66
Nick w MP: piotrek84

Piwa: 173

Respekt: 50

licznik nie z polskiego forum no i problem XD,
wie kto? jak podpi?? bak aby schodzi? pasek paliwa, przebieg i lpg?




Kod:

local carFuel = {};

addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
function()
local xml = xmlLoadFile("carData.xml");
local xmlNodes = xmlNodeGetChildren(xml);
for i,node in ipairs(xmlNodes) do
carFuel[tonumber(xmlNodeGetAttribute(node,'id'))] = tonumber(xmlNodeGetAttribute(node,'fuel'));
end
xmlUnloadFile(xml);
end
)

addEvent("onPedSyphonFuel",true);
function startSyphon()
if not isPedInVehicle(localPlayer) then
if isPedOnGround(localPlayer) then
local px, py, pz = getElementPosition(localPlayer);
local rot = getPedRotation(localPlayer);

local a = math.rad(90 - rot);

local dx = math.cos(a) * 1.5;
local dy = math.sin(a) * 1.5;
local ppx = math.cos(a) * 0.2;
local ppy = math.sin(a) * 0.2;

local ex = px-dx;
local ey = py+dy;
px = px-ppx;
py = py+ppy;
hit, x, y, z, elementHit = processLineOfSight(px, py, pz+1, ex, ey, pz);
if elementHit then
if getElementType(elementHit) == 'vehicle' then
triggerServerEvent('pedSyphonVehicle',localPlayer,elementHit);
end
end
end
end
end
addEventHandler("onPedSyphonFuel",getRootElement(),startSyphon);
addCommandHandler('syphon',startSyphon)

addEvent("onPedReFuel",true);
function fillHerUp()
local vehicle = getPedOccupiedVehicle(localPlayer);
if not isPedInVehicle(localPlayer) then
if isPedOnGround(localPlayer) then
local px, py, pz = getElementPosition(localPlayer);
local rot = getPedRotation(localPlayer);

local a = math.rad(90 - rot);

local dx = math.cos(a) * 1.5;
local dy = math.sin(a) * 1.5;
local ppx = math.cos(a) * 0.2;
local ppy = math.sin(a) * 0.2;

local ex = px-dx;
local ey = py+dy;
px = px-ppx;
py = py+ppy;
hit, x, y, z, elementHit = processLineOfSight(px, py, pz+1, ex, ey, pz);
if elementHit then
if getElementType(elementHit) == 'vehicle' then
triggerServerEvent('pedRefuelVehicle',localPlayer,elementHit);
end
end
end
end
end
addEventHandler("onPedReFuel",getRootElement(),fillHerUp);
addCommandHandler('refuel',fillHerUp)




addEventHandler("onClientElementStreamIn",getRootElement(),function ()
if getElementType(source) ~= 'vehicle' then return end
if getVehicleType(source) ~= 'Automobile' and getVehicleType(source) ~= 'Bike' and getVehicleType(source) ~= 'Monster Truck' and getVehicleType(source) ~= 'Quad' then return end
triggerServerEvent('giveVehicleFuelOnSpawn',source);
end);

local lastPos

setTimer(function()
local veh=getPedOccupiedVehicle (localPlayer)
if veh then
local vx, vy,vz=getElementPosition(veh)
local totalDist=getElementData(veh,"totalDist")or 0
if lastPos then
local dx,dy,dz=math.abs(vx-lastPos[1]),math.abs(vy-lastPos[2]),math.abs(vz-lastPos[3])
totalDist=math.floor(totalDist+math.sqrt(dx*dx+dy*dy+dz*dz)/50)
setElementData(veh,"totalDist",totalDist)
lastPos={vx,vy,vz}
else
lastPos={vx,vy,vz}
end
elseif lastPos then
lastPos=nil
end
end,1000,0)

local sW, sH = guiGetScreenSize()
addEventHandler("onClientRender",root,function ()
local veh=getPedOccupiedVehicle(localPlayer)
if veh then
local seat=getPedOccupiedVehicleSeat(localPlayer)
local nomer=getVehiclePlateText(veh)
if seat ~= 0 then return end
dxDrawText(nomer,sW/0.54, sH/0.81, sW/13, sH/295,tocolor(255,255,255,255),1.4,"default-bold","center","center",false,false,true)
end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-10-19, 23:24


xyzzz^

A nic






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

Piwa: 308

Respekt: 81

Ostrzeżeń: 100%
masz podpi?t? pod to eldate paliwa/lpg?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-10-19, 23:46


piotrek87411







Wiek: 26
Na forum: 1754 dni
Posty: 66
Nick w MP: piotrek84

Piwa: 173

Respekt: 50

xyzzz^, nie

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-10-21, 15:39


Pro3west1







Wiek: 26
Na forum: 2524 dni
Posty: 37
Nick w MP: hjkh



Respekt: 50

"piotrek87411" napisał/a:

xyzzz^, nie

To zmie? eldaty na swoje.

Postaw piwo autorowi tego posta
 

 
Tagi: licznik :: innego :: forum
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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