Jump to content

[HELP]Draw image only next to local player


NotAvailable

Recommended Posts

Posted

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 

Posted

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 

Posted (edited)

My wanted level shows on his nametag, thats the problem.

But i cant find the problem. I tried to fix it several times.

1zarvb.jpg

EDIT: When i use your code it doesnt show any stars.

Edited by Guest
Posted

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.

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

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