NotAvailable Posted November 13, 2011 Share Posted November 13, 2011 Hello. Im scripting custom nametags with a image near my name. (Dx) But the image draws near everybody's name. Regards, Jesse Link to comment
12p Posted November 13, 2011 Share Posted November 13, 2011 Did you use "if getLocalPlayer()" line? Link to comment
NotAvailable Posted November 13, 2011 Author Share Posted November 13, 2011 Yeah --WANTED LEVEL if not (thePlayer == getLocalPlayer()) then return end local level = getPlayerWantedLevel(thePlayer) if level >= 0 then for i=1,level do dxDrawImage ( X - 33.5+8*i, Y - 46, 10, 10, 'star.png', 0, 0, 0 ) end end end Link to comment
Aibo Posted November 13, 2011 Share Posted November 13, 2011 1. what is the end at line 9? 2. there is a ~= operator, you know (if thePlayer ~= localPlayer then) 3. why you do return if its not a local player anyway? nevermind that, i misread the post. PS: and since there is a predefined variable localPlayer, it's better to use it, than call getLocalPlayer() function every time. --WANTED LEVEL if thePlayer == localPlayer then -- do the following only if player is local player local level = getPlayerWantedLevel(thePlayer) if level >= 1 then -- should be 1 here for i=1,level do dxDrawImage ( X - 33.5+8*i, Y - 46, 10, 10, 'star.png', 0, 0, 0 ) end end end Link to comment
NotAvailable Posted November 13, 2011 Author Share Posted November 13, 2011 (edited) My wanted level shows on his nametag, thats the problem. But i cant find the problem. I tried to fix it several times. EDIT: When i use your code it doesnt show any stars. Edited November 13, 2011 by Guest Link to comment
Aibo Posted November 13, 2011 Share Posted November 13, 2011 well i dont see your nametag anyway. Link to comment
NotAvailable Posted November 13, 2011 Author Share Posted November 13, 2011 (edited) --REMOVED Edited November 13, 2011 by Guest Link to comment
Aibo Posted November 13, 2011 Share Posted November 13, 2011 your line 7 obviously says "if thePlayer and thePlayer ~= getLocalPlayer() then". how do you expect thePlayer to be localPlayer with that statement? it will never draw anything for local player. also calling setPlayerNametagShowing(thePlayer, false) every frame is redundant to say the least. lines 34-35 also redundant. you calculate distances for nothing and do return even there's no code after it to run. and client getElementsByType has a streamedIn parameter. you dont really need ALL players, not like you're planning to draw nametags for players that arent even streamed in, its just a waste of time. Link to comment
NotAvailable Posted November 13, 2011 Author Share Posted November 13, 2011 your line 7 obviously says "if thePlayer and thePlayer ~= getLocalPlayer() then". how do you expect thePlayer to be localPlayer with that statement? it will never draw anything for local player. also calling setPlayerNametagShowing(thePlayer, false) every frame is redundant to say the least. lines 34-35 also redundant. you calculate distances for nothing and do return even there's no code after it to run. and client getElementsByType has a streamedIn parameter. you dont really need ALL players, not like you're planning to draw nametags for players that arent even streamed in, its just a waste of time. Thankyou for your help. 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