Jump to content

getElementhHealth & getElementVelocity debugscript


Overkillz

Recommended Posts

hey guys , im having a problem with debugscript 3, i created a radar which show nitro level and health status.

well, i have another script which is respawn vehicle .

when a player it is there (respawn mode) and the map ended, while travelling is being shown

debugscript 3 show me these errors:

local playerVehicle = getPedOccupiedVehicle(localPlayer) 
        local vehicleHealth = getElementHealth ( playerVehicle ) 
        local vehicleHealth = math.max(0,vehicleHealth-250) 
        local vehicleSpeed = getElementVelocity ( playerVehicle ) 
        sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(localPlayer)) -- Speed 
        vehiclekmh = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180) -- Speed 
        dxDrawImage(posx,posy*1.295,height,height2, "img/lalala.png",0,0,0,tocolor(255,255,255,255)) -- Info Imagen 
        if sX == 1440 and sY ==900 then 
        dxDrawRectangle(x*64, y*984, x*135/1000*vehicleHealth, y*8, tocolor(0, 255, 0, 255), true) -- Health 
        dxDrawText(""..tostring(vehiclekmh).." km/h", x*0.5, y*1128, x*527, y*877, tocolor(255, 136, 0, 255), 1.25, "default-bold", "center", "center", false, false, true, false, false) -- Speed 

i tried move it out of function, but it didnt worked.

i hope u can help me, thanks.

Link to comment
  • Moderators

There is probably a moment when the player isn't in the vehicle. You should always check the nil's.

And reduce the amount of executions of functions to the minimal where possible. Especially when rendering them.

 sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(localPlayer)) -- Speed 
 sx, sy, sz = getElementVelocity (playerVehicle) -- Speed 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...