Swald Posted September 20, 2018 Share Posted September 20, 2018 (edited) Hello everyone! I wonder if there is any way to implement custom nametags? I would like for example, append player IDs to their names or color them. I discovered this thread but when I tried to use that approach on my server I got next error for nametags argument TypeError: Cannot read property 'forEach' of undefined When I logged out nametags I got next object: { setVariable: [Function], call: [Function] } So looks like on current version of RAGE render event doesn't have nametags argument even though it is stated on wiki page. Please tell me is it so or am I doing something wrong, I will appreciate any help. Thanks. Edited September 20, 2018 by Swald 1 Link to comment Share on other sites More sharing options...
Robson Posted September 20, 2018 Share Posted September 20, 2018 Link to comment Share on other sites More sharing options...
MrPancakers Posted September 21, 2018 Share Posted September 21, 2018 (edited) 10 hours ago, Robson said: How come you linked the exact thread OP already linked in his post -- Swald did you put all this code serverside? If it's all clientside it should work perfectly fine. Edited September 21, 2018 by MrPancakers Link to comment Share on other sites More sharing options...
Robson Posted September 21, 2018 Share Posted September 21, 2018 (edited) 3 hours ago, MrPancakers said: How come you linked the exact thread OP already linked in his post -- Swald did you put all this code serverside? If it's all clientside it should work perfectly fine. Chill dude as you can see he edited the topic after I answer Edited September 21, 2018 by Robson Link to comment Share on other sites More sharing options...
DiEeR Posted September 21, 2018 Share Posted September 21, 2018 2 минуты назад, Robson сказал: chill dude he edited the topic the link to resource was specified from the very beginning Link to comment Share on other sites More sharing options...
MrPancakers Posted September 21, 2018 Share Posted September 21, 2018 3 hours ago, Robson said: Chill dude as you can see he edited the topic after I answer I was asking a legitimate question, how much more chill can I be lol Link to comment Share on other sites More sharing options...
Swald Posted September 21, 2018 Author Share Posted September 21, 2018 10 часов назад, Robson сказал: Chill dude as you can see he edited the topic after I answer No, like it was said before, I put link in the very beginning and then just added some details. 14 часа назад, MrPancakers сказал: Swald did you put all this code serverside? If it's all clientside it should work perfectly fine. Thank you for response. I was running it on the clientside and I found out where was the problem. I forgot the line mp.nametags.enabled = false When I added it, nametags.forEach works just fine. But there is one more problem with implementation in linked thread. Looks like it was working properly on previous versions of RAGE but now it renders nametags in the right top corner of the screen because mp.game.graphics.drawText gets only two coordinates instead of three to render text at world coordinates (as is stated in documentation). And I didn't succeed in fetching Z-coordinate from nametag object. Then I found the way to implement this feature using players pool (mp.players on clientside) and it worked except for player IDs. I got different IDs for same players so I guess clientside IDs do not synchronize with serverside. Anyway I solved this issue just by appending player ID to player.name property on serverside. Thanks everyone for responses, I hope my experience will help someone. Link to comment Share on other sites More sharing options...
MrPancakers Posted September 21, 2018 Share Posted September 21, 2018 37 minutes ago, Swald said: No, like it was said before, I put link in the very beginning and then just added some details. Thank you for response. I was running it on the clientside and I found out where was the problem. I forgot the line mp.nametags.enabled = false When I added it, nametags.forEach works just fine. But there is one more problem with implementation in linked thread. Looks like it was working properly on previous versions of RAGE but now it renders nametags in the right top corner of the screen because mp.game.graphics.drawText gets only two coordinates instead of three to render text at world coordinates (as is stated in documentation). And I didn't succeed in fetching Z-coordinate from nametag object. Then I found the way to implement this feature using players pool (mp.players on clientside) and it worked except for player IDs. I got different IDs for same players so I guess clientside IDs do not synchronize with serverside. Anyway I solved this issue just by appending player ID to player.name property on serverside. Thanks everyone for responses, I hope my experience will help someone. Correct clientside IDs aren't the real IDs, you need to use their remoteId to get the real player ID if you want to get their ID clientside. Link to comment Share on other sites More sharing options...
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