Blinker. Posted November 11, 2014 Posted November 11, 2014 hello , i want to turn off all players nametags , but it's not working. i'm using the wiki example function onResourceStart ( ) local players = getElementsByType ( "player" ) -- Store all the players in the server into a table for key, player in ipairs ( players ) do -- for all the players in the table setPlayerNametagShowing ( player, false ) -- turn off their nametag end end addEventHandler ( "onResourceStart", root, onResourceStart ) Thanks in Advance
The Don Posted November 11, 2014 Posted November 11, 2014 Try This -- Server Side # addEventHandler('onResourceStart',root, function () for _, v in ipairs( getElementsByType 'player' ) do setPlayerNametagShowing ( v, false ) end end ) آن يكون فكر المرء مختلآ , خيرآ من آن يكون فكره محتلآ ! my nick name in the game : =x=|DoN|=x= or 7eJAzZy- ( ͡° ͜ʖ ͡°) http://community.multitheftauto.com/ind ... &id=337164 my profile
Blinker. Posted November 11, 2014 Author Posted November 11, 2014 also not working , i have a question is this used to hide name tags that are seen on the cars in race?
The Don Posted November 11, 2014 Posted November 11, 2014 well , it is hide the normal name tags and i think it is working very well آن يكون فكر المرء مختلآ , خيرآ من آن يكون فكره محتلآ ! my nick name in the game : =x=|DoN|=x= or 7eJAzZy- ( ͡° ͜ʖ ͡°) http://community.multitheftauto.com/ind ... &id=337164 my profile
Blinker. Posted November 11, 2014 Author Posted November 11, 2014 Tag names like Blinker on the cars in race ? i am not sure if it's the right function.
Bilal135 Posted November 11, 2014 Posted November 11, 2014 function resourceStart(Player) setPlayerNametagShowing(Player, false) end addEventHandler("onResourceStart", root, resourceStart) "Get busy living or get busy dying"
Feche1320 Posted November 11, 2014 Posted November 11, 2014 addEventHandler("onResourceStart", root, function() local players = getElementsByType("player") for i = 1, #players do setPlayerNametagShowing(players[i], false) end end ) addEventHandler("onPlayerJoin", root, function() setPlayerNametagShowing(source, false) end ) www.host-ar.com.ar
Bilal135 Posted November 11, 2014 Posted November 11, 2014 addEventHandler("onResourceStart", root, function() local players = getElementsByType("player") for i = 1, #players do setPlayerNametagShowing(players[i], false) end end ) addEventHandler("onPlayerJoin", root, function() setPlayerNametagShowing(source, false) end ) You need to create a table for this, or (players) will be left undefined. +Your first part has no use in the script. He wanted to just turn off player nametags. "Get busy living or get busy dying"
WASSIm. Posted November 11, 2014 Posted November 11, 2014 WTF guys addEventHandler("onResourceStart", resourceRoot, function() for _, player in ipairs(getElementsByType("player")) do setPlayerNametagShowing(player, false) end end ) addEventHandler("onPlayerJoin", root, function() setPlayerNametagShowing(source, false) end )
Anubhav Posted November 11, 2014 Posted November 11, 2014 addEventHandler("onResourceStart", root, function() local players = getElementsByType("player") for i = 1, #players do setPlayerNametagShowing(players[i], false) end end ) addEventHandler("onPlayerJoin", root, function() setPlayerNametagShowing(source, false) end ) You need to create a table for this, or (players) will be left undefined. +Your first part has no use in the script. He wanted to just turn off player nametags. FFS are you all mad? He's CODE IS TOTALLY CORRECT. Go learn Bilal! i is defined in the loop already. i = 1, #players do and when it runs it returns i's value so you check the table's index of i value. #logic See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
Feche1320 Posted November 11, 2014 Posted November 11, 2014 WTF guys addEventHandler("onResourceStart", resourceRoot, function() for _, player in ipairs(getElementsByType("player")) do setPlayerNametagShowing(player, false) end end ) addEventHandler("onPlayerJoin", root, function() setPlayerNametagShowing(source, false) end ) Same as mine, it's just slower with ipairs.. so WTF to you www.host-ar.com.ar
Moderators IIYAMA Posted November 12, 2014 Moderators Posted November 12, 2014 He did the responsive element (resourceRoot) correct, so his code is not as inefficient as yours except for the ipairs part. If you had other code executed by that event, you would have bugs. it is only so WTF that WASSIm. isn't explaining his changes. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Feche1320 Posted November 12, 2014 Posted November 12, 2014 He did the responsive element (resourceRoot) correct, so his code is not as inefficient as yours except for the ipairs part.If you had other code executed by that event, you would have bugs. it is only so WTF that WASSIm. isn't explaining his changes. That's becouse I copy/pasted the code from the first post, didn't even notice that. www.host-ar.com.ar
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