MisterQuestions Posted September 14, 2014 Share Posted September 14, 2014 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
Et-win Posted September 14, 2014 Share Posted September 14, 2014 Try: local team = getElementData(player, "team") if (team == false) or (team == nil) then team = "N/A" end Link to comment
darhal Posted September 14, 2014 Share Posted September 14, 2014 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 Link to comment
MisterQuestions Posted September 14, 2014 Author Share Posted September 14, 2014 In my code, just says '#404 Not found' why? Link to comment
darhal Posted September 14, 2014 Share Posted September 14, 2014 Read my post !! Isaid that the team not savedd save like i said Link to comment
darhal Posted September 14, 2014 Share Posted September 14, 2014 Another thing use localPlayer instead of player client side Link to comment
Et-win Posted September 14, 2014 Share Posted September 14, 2014 Another thing use localPlayer instead of player client side You don't even know or he defined the player.... So... what does it matters? Link to comment
darhal Posted September 14, 2014 Share Posted September 14, 2014 I dont like to leave him in dark i like to help others Link to comment
Et-win Posted September 14, 2014 Share Posted September 14, 2014 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
Saml1er Posted September 15, 2014 Share Posted September 15, 2014 You actually don't need to remove element data because once player leaves the server then element data is set to nil or simply it's lost. Link to comment
MisterQuestions Posted September 20, 2014 Author Share Posted September 20, 2014 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 ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now