Matevsz Posted April 25, 2015 Share Posted April 25, 2015 Hi, I turn on the server and get in the car pops up an error (debugscript 3) Line9 Error: attempt it arlthmetic perform a global "spd_w '(a nil value) Code: local screenw,screenh= guiGetScreenSize() local przecinekx,przecineky=screenw*725/800,109/60*screenh local przecinekfs=screenh/600 local fuel_W = math.floor(screenw/14) if (fuel_W>116) then fuel_W=116 end local fuel_H = math.floor(fuel_W * 0.60344) local fuel_X = spd_X + (spd_w/2) - (fuel_W/2) local fuel_Y = screenh - 25- fuel_H local fuelw_X = math.floor(fuel_X + (fuel_W/2)) local fuelw_Y = math.floor(fuel_Y+(fuel_H*9/10)) local fuelw_W = math.floor(fuel_H*1/2) local lastFuelLevel=0 local spd_w = math.floor(screenw / 5) if (spd_w>400) then spd_w=400 end local spd_h = math.floor(spd_w * 0.81592) local spd_X = screenw - spd_w - 25 local spd_Y = screenh - spd_h - 25 local spdw_X = math.floor(spd_X + (spd_w/2)) local spdw_Y = math.floor(spd_Y + (spd_h*3/5)) local veh=getPedOccupiedVehicle(localPlayer) if isPlayerHudComponentVisible("money") and (getCameraTarget()==localPlayer or getCameraTarget()==veh) then -- dxDrawText(",", przecinekx-2,przecineky+2,przecinekx,przecineky,tocolor(0,0,0),przecinekfs,"pricedown") -- dxDrawText(",", przecinekx-2,przecineky-2,przecinekx,przecineky,tocolor(0,0,0),przecinekfs,"pricedown") -- dxDrawText(",", przecinekx+2,przecineky+2,przecinekx,przecineky,tocolor(0,0,0),przecinekfs,"pricedown") -- dxDrawText(",", przecinekx+2,przecineky-2,przecinekx,przecineky,tocolor(0,0,0),przecinekfs,"pricedown") -- dxDrawText(",", przecinekx,przecineky,przecinekx,przecineky,tocolor(47, 90, 38),przecinekfs,"pricedown") -- glod/nasycenie if not isElementInWater(localPlayer) then -- 681/800 dxDrawRectangle(683/800*screenw, 75/600*screenh, 76/800*screenw, 11/600*screenh, tocolor(0,0,0,255)) dxDrawRectangle(685/800*screenw, 77/600*screenh, 72/800*screenw, 7/600*screenh, tocolor(255,255,0,64)) local hl=math.max(math.min(character.satiation or 75,100),0) dxDrawRectangle(685/800*screenw, 77/600*screenh, 72/800*screenw*(hl/100), 7/600*screenh, tocolor(255,255,0,255)) end end if (veh) then local vm=getElementModel(veh) if not getElementData(localPlayer,"hud:removeclouds") then if (vm~=481 and vm~=509 and vm~=510) then vx,vy,vz=getElementVelocity(veh) spd=(vx^2 + vy^2 + vz^2)^(0.5)*0.6 dxDrawImage ( spd_X, spd_Y, spd_w, spd_h, 'spedo2.png' ) local gx,gy=GetSPDXY(spdw_X,spdw_Y,spd, spd_w/3) dxDrawLine(spdw_X-2,spdw_Y-2, gx,gy, tocolor(155,0,0,100), 3) dxDrawLine(spdw_X-2,spdw_Y+2, gx,gy, tocolor(155,0,0,100), 3) dxDrawLine(spdw_X+2,spdw_Y-2, gx,gy, tocolor(155,0,0,100), 3) dxDrawLine(spdw_X+2,spdw_Y+2, gx,gy, tocolor(155,0,0,100), 3) dxDrawLine(spdw_X,spdw_Y, gx,gy, tocolor(255,0,0), 1) -- paliwo local pp=getElementData(veh,"paliwo") if (pp and pp[2] and pp[2]>0) then local paliwo,bak=unpack(pp) dxDrawImage ( fuel_X, fuel_Y, fuel_W, fuel_H, 'paliwo.png' ) --[[ if (paliwo<1) then -- spowalniamy pojazd! setElementVelocity(v,vx/2,vy/2,vz/2) end]]-- -- if (lastFuelLevel-paliwo>1) then -- lastFuelLevel=lastFuelLevel-1 -- elseif (lastFuelLevel-paliwo<1) then -- lastFuelLevel=lastFuelLevel+1 -- end local px,py=GetFuelXY(fuelw_X,fuelw_Y, paliwo/bak*100, fuelw_W) dxDrawLine(fuelw_X,fuelw_Y, px,py, tocolor(155,0,0), 3) end -- przebieg local przebieg=getElementData(veh,"przebieg") if przebieg then dxDrawText(string.format("%08.1f",przebieg), 1+fuel_X+fuel_W/2, 1+fuel_Y+fuel_H, 1+fuel_X+fuel_W/2, 1+fuel_Y+fuel_H+10, tocolor(255,255,255,155), 1, "default", "center","top") dxDrawText(string.format("%08.1f",przebieg), fuel_X+fuel_W/2, fuel_Y+fuel_H, fuel_X+fuel_W/2, fuel_Y+fuel_H+10, tocolor(0,0,0,255), 1, "default", "center","top") end end end end Link to comment
Walid Posted April 25, 2015 Share Posted April 25, 2015 spd_w it's not defined in your code. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now