Jump to content

Warning


boro

Recommended Posts

Hi i have script for show health, this script work good but in debug is showing

WARNING: play/hud/hudc.lua:266: Bad argument @ 'DxDrawRectangle' [Expected number at argument 3, got nill]

what is bad, please help ty.

this is script

function DXdraw2() 
sWidth,sHeight = guiGetScreenSize() 
for i, player in ipairs(getElementsByType("player")) do 
local team = getPlayerTeam(player) 
if team and getTeamName(team) == "Team1" then 
for i, player in ipairs(getPlayersInTeam(team)) do 
        sWidth, sHeight = guiGetScreenSize() 
    local healtha =  getElementHealth(player) 
        lineLength1 = 192* ( healtha / 100 )  
        ticka = getTickCount ()  
                local maxHealtha = 100;  
        local colourPercent = ( healtha / maxHealtha ) * 200; 
        local red, green; 
        if healtha < ( maxHealtha / 2 ) then 
        red = 88; 
        green = ( healtha / 50 ) * ( colourPercent * 2 ); 
else 
        green = 154; 
        red = 88 - ( ( healtha - 50 ) / 50 ) * 88; 
end 
end 
end 
end 
local color1 = tocolor( 88, 154, 24, 100 ) 
local color2 = tocolor( 88, 154, 24, 200 ) 
dxDrawRectangle(sWidth-785,sHeight-39,192.0,25.0,color1, false) 
dxDrawRectangle(sWidth-785,sHeight-39,lineLength1,25.0,color2,false) -- THIS IS LINE 266 
end 

Link to comment

local lineLength1 = 0 
local sWidth,sHeight = guiGetScreenSize (     ) 
  
  
function DXdraw2 (    ) 
     for i, player in ipairs(getElementsByType("player")) do 
       local team = getPlayerTeam(player) 
        if team and getTeamName(team) == "Team1" then 
          for i, player in ipairs(getPlayersInTeam(team)) do 
               local healtha =  getElementHealth(player) 
               lineLength1 = 192* ( healtha / 100 ) 
               ticka = getTickCount () 
               local maxHealtha = 100; 
               local colourPercent = ( healtha / maxHealtha ) * 200; 
               local red, green; 
        if healtha < ( maxHealtha / 2 ) then 
                   red = 88; 
                   green = ( healtha / 50 ) * ( colourPercent * 2 ); 
        else 
                   green = 154; 
                   red = 88 - ( ( healtha - 50 ) / 50 ) * 88; 
                  end 
              end 
          end 
      end 
      local color1 = tocolor( 88, 154, 24, 100 ) 
      local color2 = tocolor( 88, 154, 24, 200 ) 
      dxDrawRectangle(sWidth-785,sHeight-39,192.0,25.0,color1, false) 
      dxDrawRectangle(sWidth-785,sHeight-39,lineLength1,25.0,color2,false) -- THIS IS LINE 266 
end 
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...