Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function drawGUI()
- local vehicle = getPedOccupiedVehicle(localPlayer);
- if vehicle then
- local x,y = guiGetScreenSize();
- if getVehicleType(vehicle) ~= 'Automobile' and getVehicleType(vehicle) ~= 'Bike' and getVehicleType(vehicle) ~= 'Monster Truck' and getVehicleType(vehicle) ~= 'Quad' then return end
- local driver = getVehicleController(vehicle);
- if driver ~= localPlayer then return end --###
- if getVehicleEngineState(vehicle) == false then return end --###
- dxDrawRectangle(x-53,(y/2)-75,40,142,0x66224466);
- local maxFuel = carFuel[0];
- local curFuel = getElementData(vehicle,'fuel');
- local carHealth = getElementHealth(vehicle)/10
- if curFuel == false then return end
- if carFuel[getElementModel(vehicle)] then maxFuel = carFuel[getElementModel(vehicle)]; end
- local fuel = (curFuel/maxFuel)*100;
- local colour = nil;
- if fuel > 90 then
- colour = 0x9922CC33;
- dxDrawRectangle(x-30,(y/2)-71,16,21,colour);
- end
- if fuel > 75 then
- if colour == nil then
- colour = 0x99009900;
- end
- dxDrawRectangle(x-30,(y/2)-48,16,21,colour);
- end
- if fuel > 60 then
- if colour == nil then
- colour = 0x99339900;
- end
- dxDrawRectangle(x-30,(y/2)-25,16,21,colour);
- end
- if fuel > 45 then
- if colour == nil then
- colour = 0x99999900;
- end
- dxDrawRectangle(x-30,(y/2)-2,16,21,colour);
- end
- if fuel > 30 then
- if colour == nil then
- colour = 0x99996600;
- end
- dxDrawRectangle(x-30,(y/2)+21,16,21,colour);
- end
- if colour == nil then
- if fuel > 15 then
- colour = 0x99993300;
- else
- colour = 0x99990000;
- end
- end
- dxDrawRectangle(x-30,(y/2)+44,16,21,colour);
- local HealthHeight = ((136/100)*carHealth);
- local yOffset = HealthHeight-136
- dxDrawRectangle(x-50,(y/2)-71-yOffset,16,stan,0x99990000);
- dxDrawText(tostring(HealthHeight-36)..'%',x-105,y-65);
- dxDrawText(tostring(fuel)..'%',x-105,y-50);
- end
- end
- addEventHandler("onClientRender",getRootElement(),drawGUI);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement