Jump to content

Nametag error!


MisterQuestions

Recommended Posts

Posted

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?

"El conocimiento jamás debe detenerse, por que es lo único que nos salvará cuando no nos quede más".

Att: -|TG|-Mister[Q]<.

Posted

The problem here is that teams will not be saved so getPlayerTeam when the player login will return nil use

setAccountData -- when the player quit to save the team and use 
getAccountData -- when the player join to get this team 

#include <iostream>

int main() {

    std::cout << "C++ is amazing <3" << std::endl;

    return 0;

}

I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please

Posted

Read my post !! Isaid that the team not savedd save like i said

#include <iostream>

int main() {

    std::cout << "C++ is amazing <3" << std::endl;

    return 0;

}

I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please

Posted

Another thing use localPlayer instead of player client side

#include <iostream>

int main() {

    std::cout << "C++ is amazing <3" << std::endl;

    return 0;

}

I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please

Posted

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

#include <iostream>

int main() {

    std::cout << "C++ is amazing <3" << std::endl;

    return 0;

}

I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please

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

Posted

Mmm error?

why?

this is the nametags draw text...

dxDrawText (getPlayerTeam(player)" \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 ) 

"El conocimiento jamás debe detenerse, por que es lo único que nos salvará cuando no nos quede más".

Att: -|TG|-Mister[Q]<.

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