Jump to content

Nametag error!


MisterQuestions

Recommended Posts

Hi, on this time i want to show player team over nick, but what is wrong, if dont get the player team, should appear a random phrase how to do it?

Client-Side

                     
local team = getElementData(player, "team") or " " 
dxDrawText (team.." \n"..getPlayerName(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, raceInterface.font, "center", "bottom", false, false, false, true ) 

Server-Side

addEventHandler( 'onPlayerLogin', root, 
    function ( ) 
        team = getPlayerTeam(source) 
        setElementData(source, "team", team)             
    end 
) 
  
addEventHandler( 'onPlayerQuit', root, 
function ( ) 
local team = getElementData(source, "team") 
    if team then 
        removeElementData(source,"team") 
    end 
end) 
  

How to do it?

Link to comment
I dont like to leave him in dark i like to help others

... I never said anything about something about or even something referring to this.

--

Anyway, I posted a wrong code. I meant just use this:

local team = getPlayerTeam(player) 
if (team ~= false) and (team ~= nil) then 
    team = getTeamName(team) 
end 
if (team == false) or (team == nil) then 
    team = "N/A" 
end 

As soon as a player gets placed into a team, it will draw the team above the nickname.

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