Jump to content

Prevent Debug Error


Recommended Posts

Hey dear community, Im here with a new problem that I got.

Im trying to dxDrawing a text which will show the Team of a player.

It works well, but if the player isn't in a Team, DebugScript drops a lot of Warning

Script:

  
local playerTeamA = getPlayerTeam(player) 
local playerTeamB = getTeamName(playerTeamA) 
  
if not (playerTeamB ) then 
    dxDrawText ( getPlayerNametagText(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) 
else 
    dxDrawText ( playerTeamB, sx, sy - offset, sx, sy*0.94 - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) 
    dxDrawText ( getPlayerNametagText(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) 
end 
  
  

When the player hasn't a team:

I hope you can help me.

Thanks and Regards.

Link to comment
local playerTeamA = getPlayerTeam(player) 
local playerTeamB = getTeamName(playerTeamA) 
  
if playerTeamA then 
    dxDrawText ( playerTeamB, sx, sy - offset, sx, sy*0.94 - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) 
    dxDrawText ( getPlayerNametagText(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) 
else 
    dxDrawText ( getPlayerNametagText(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) 
end 

Link to comment
local playerTeamA = getPlayerTeam(player) 
local playerTeamB = getTeamName(playerTeamA) 
  
if playerTeamA then 
    dxDrawText ( playerTeamB, sx, sy - offset, sx, sy*0.94 - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) 
    dxDrawText ( getPlayerNametagText(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) 
else 
    dxDrawText ( getPlayerNametagText(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) 
end 

Still ocurring the same thing.

I need to add that It drops the Warn Mensagges when I see to the player, when my camera is seeing to another place where the player doesn't stay It stops.

Regards.

Link to comment

Oh, I see. I'm sorry, this should work:

local playerTeamA = getPlayerTeam(player) 
  
if playerTeamA then 
    local playerTeamB = getTeamName(playerTeamA) 
    dxDrawText ( playerTeamB, sx, sy - offset, sx, sy*0.94 - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) 
    dxDrawText ( getPlayerNametagText(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) 
else 
    dxDrawText ( getPlayerNametagText(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) 
end 

Link to comment
Oh, I see. I'm sorry, this should work:
local playerTeamA = getPlayerTeam(player) 
  
if playerTeamA then 
    local playerTeamB = getTeamName(playerTeamA) 
    dxDrawText ( playerTeamB, sx, sy - offset, sx, sy*0.94 - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) 
    dxDrawText ( getPlayerNametagText(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) 
else 
    dxDrawText ( getPlayerNametagText(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) 
end 

Thanks so much, it works perfectly ^^

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...