WASSIm. Posted May 26, 2013 Posted May 26, 2013 i guys i have problem if car dont have nitro show me this attempt to perform arithmetic on global "NitroLevel" (a boolean value) if ( enableNitro ) and (getVehicleUpgradeOnSlot(theVehicle,8) then nx1, ny1, nx2, ny2 = sx*(355.0/1440),sy*(759.0/900),sx*(27.0/1440),sy*(116.0/900) nx3, ny3, nx4, ny4 = sx*(360.0/1440),sy*(871.0/900),sx*(18.0/1440),NitroLevel*sy*(-108.0/900) nx5, ny5, nx6, ny6 = sx*(360.0/1440),sy*(763.0/900),sx*(18.0/1440),sy*(108.0/900) end
WASSIm. Posted May 26, 2013 Author Posted May 26, 2013 Get the nitro level after checking if it has nitro. nothing
WASSIm. Posted May 27, 2013 Author Posted May 27, 2013 if ( enableNitro ) and (getVehicleUpgradeOnSlot(theVehicle,8)) then NitroLevel = getVehicleNitroLevel( theVehicle ) nx1, ny1, nx2, ny2 = sx*(355.0/1440),sy*(759.0/900),sx*(27.0/1440),sy*(116.0/900) nx3, ny3, nx4, ny4 = sx*(360.0/1440),sy*(871.0/900),sx*(18.0/1440),NitroLevel*sy*(-108.0/900) nx5, ny5, nx6, ny6 = sx*(360.0/1440),sy*(763.0/900),sx*(18.0/1440),sy*(108.0/900) end
Castillo Posted May 27, 2013 Posted May 27, 2013 That's because if it doesn't has nitro, it'll return '0'. if ( enableNitro ) and ( getVehicleUpgradeOnSlot ( theVehicle, 8 ) ~= 0 ) then NitroLevel = getVehicleNitroLevel( theVehicle ) nx1, ny1, nx2, ny2 = sx*(355.0/1440),sy*(759.0/900),sx*(27.0/1440),sy*(116.0/900) nx3, ny3, nx4, ny4 = sx*(360.0/1440),sy*(871.0/900),sx*(18.0/1440),NitroLevel*sy*(-108.0/900) nx5, ny5, nx6, ny6 = sx*(360.0/1440),sy*(763.0/900),sx*(18.0/1440),sy*(108.0/900) end
WASSIm. Posted May 28, 2013 Author Posted May 28, 2013 : / :385: Bad argument @ 'dxDrawRectangle' [Expected n6mber at argument 1, got nil] :386: Bad argument @ 'dxDrawRectangle' [Expected number at argument 1, got nil] :387: Bad argument @ 'dxDrawRectangle' [Expected number at argument 1, got nil] dxDrawRectangle(nx1, ny1, nx2, ny2,tocolor(0,0,0,150),false) dxDrawRectangle (nx5, ny5, nx6, ny6,tocolor(0,0,0,170),false) dxDrawRectangle (nx3, ny3, nx4, ny4,tocolor(255,0,0,170),false)
Castillo Posted May 28, 2013 Posted May 28, 2013 : /:385: Bad argument @ 'dxDrawRectangle' [Expected n6mber at argument 1, got nil] :386: Bad argument @ 'dxDrawRectangle' [Expected number at argument 1, got nil] :387: Bad argument @ 'dxDrawRectangle' [Expected number at argument 1, got nil] dxDrawRectangle(nx1, ny1, nx2, ny2,tocolor(0,0,0,150),false) dxDrawRectangle (nx5, ny5, nx6, ny6,tocolor(0,0,0,170),false) dxDrawRectangle (nx3, ny3, nx4, ny4,tocolor(255,0,0,170),false) Make sure these variables are defined.
WASSIm. Posted May 28, 2013 Author Posted May 28, 2013 its working but if car dont have nitro make flood in debugscript
WASSIm. Posted May 28, 2013 Author Posted May 28, 2013 Check if the player have a vehicle or no . function hudvehicle ( ) theVehicle = getPedOccupiedVehicle ( localPlayer ) if ( theVehicle ) then spx, spy, spz = getElementVelocity( theVehicle ) mphSpeed = ( spx^2 + spy^2 + spz^2 ) ^ 0.5 * 100 kphSpeed = ( spx^2 + spy^2 + spz^2 ) ^ 0.5 * 1.61 * 100 vehiclespeed = mphSpeed vehicleHealth = getElementHealth ( theVehicle ) vehiclename = getVehicleName ( theVehicle ) radio = getRadioChannel ( theVehicle ) NitroLevel = getVehicleNitroLevel( theVehicle ) if ( enableVehicleHealth ) then hvx1, hvy1, hvx2, hvy2 = sx*(355.0/1440),sy*(859.0/900),sx*(121.0/1440),sy*(27.0/900) hvx3, hvy3, hvx4, hvy4 = sx*(360.0/1440),sy*(863.0/900),vehicleHealth/10*sx*(112.0/1440)/100,sy*(19.0/900) hvx5, hvy5, hvx6, hvy6 = sx*(360.0/1440),sy*(863.0/900),sx*(112.0/1440),sy*(19.0/900) end if ( enableSpeedMeter ) then sx1, sy1, sx2, sy2 = sx*(355.0/1440),sy*(809.0/900),sx*(121.0/1440),sy*(27.0/900) sx3, sy3, sx4, sy4 = sx*(360.0/1440),sy*(813.0/900),vehiclespeed/1.5*sx*(112.0/1440)/100,sy*(19.0/900) sx5, sy5, sx6, sy6 = sx*(360.0/1440),sy*(813.0/900),sx*(112.0/1440),sy*(19.0/900) end if ( enableNitro ) and ( getVehicleUpgradeOnSlot ( theVehicle, 8 ) ~= 0 ) then nx1, ny1, nx2, ny2 = sx*(355.0/1440),sy*(759.0/900),sx*(27.0/1440),sy*(116.0/900) nx3, ny3, nx4, ny4 = sx*(360.0/1440),sy*(871.0/900),sx*(18.0/1440),NitroLevel*sy*(-108.0/900) nx5, ny5, nx6, ny6 = sx*(360.0/1440),sy*(763.0/900),sx*(18.0/1440),sy*(108.0/900) end if ( enableVehicleName ) then vnx1, vny1, vnx2, vny2 = sx*(1260.0/1440),sy*(740.0/900),sx*(1360.0/1440),sy*(27.0/900) end if ( enableVehicleRadio ) then rx5, ry5, rx6, ry6 = sx*(660.0/1440),sy*(30.0/900),sx*(128.0/1440),sy*(128.0/900) end if ( enableVehicleLock ) then lx5, ly5, lx6, ly6 = sx*(1208.0/1440),sy*(835.0/900),sx*(19.0/1440),sy*(19.0/900) end if ( enableVehicleHealth ) then dxDrawRectangle (hvx5, hvy5, hvx6, hvy6,tocolor(0,0,0,170),false) dxDrawRectangle(hvx1, hvy1, hvx2, hvy2,tocolor(0,0,0,150),false) dxDrawRectangle (hvx3, hvy3, hvx4, hvy4,tocolor(90,125,90,170),false) end if ( enableSpeedMeter ) then dxDrawRectangle (sx5, sy5, sx6, sy6,tocolor(0,0,0,170),false) dxDrawRectangle(sx1, sy1, sx2, sy2,tocolor(0,0,0,150),false) dxDrawRectangle (sx3, sy3, sx4, sy4,tocolor(90,125,90,170),false) end if ( enableNitro ) then dxDrawRectangle(nx1, ny1, nx2, ny2,tocolor(0,0,0,150),false) dxDrawRectangle (nx5, ny5, nx6, ny6,tocolor(0,0,0,170),false) dxDrawRectangle (nx3, ny3, nx4, ny4,tocolor(255,0,0,170),false) end if ( enableVehicleName ) then if ( exports.setting:isPlayerOnGroupIV ( source ) ) then dxDrawBorderedText(""..tostring(vehiclename).."",vnx1, vny1, vnx2, vny2,tocolor(100,100,100,255),scale,font1,"right","top",false,false,false) elseif ( exports.setting:isPlayerOnGroupTBOGT ( source ) ) then dxDrawBorderedText(""..tostring(vehiclename).."",vnx1, vny1, vnx2, vny2,tocolor(80,100,140,255),scale,font1,"right","top",false,false,false) elseif ( exports.setting:isPlayerOnGroupTLAD ( source ) ) then dxDrawBorderedText(""..tostring(vehiclename).."",vnx1, vny1, vnx2, vny2,tocolor(100,100,100,255),scale,font1,"right","top",false,false,false) end end if ( enableVehicleRadio ) then dxDrawImage(rx5, ry5, rx6, ry6,"images/radio/"..tostring(radio)..".png",0.0,0.0,0.0,tocolor(220,220,220,255),false) end if ( enableVehicleLock ) then if ( isVehicleLocked( theVehicle ) ) then dxDrawImage(lx5, ly5, lx6, ly6,"images/lock.png",0.0,0.0,0.0,tocolor(170,0,0,255),false) else dxDrawImage(lx5, ly5, lx6, ly6,"images/lock.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end end end end
iPrestege Posted May 28, 2013 Posted May 28, 2013 enableVehicleHealth Where's this defined at? Also the others .
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