Tokio

[BUG] How to fix this bug in my nametag script?

Recommended Posts

I added this: 

Spoiler

				local players = getElementsByType ( "player" )
		for theKey,thePlayer in ipairs(players) do			local r, g, b = getPlayerNametagColor ( thePlayer )
			if thePlayer == getLocalPlayer() then
			else
		local DataUpText = getElementData(thePlayer,"char:upText")
		                    local imageSize = dxGetFontHeight ( textscale*NAMETAG_TEXTSIZE2, srfont )

								 if DataUpText == "" then

								 else
									dxDrawImage(sx - math.max(nameWidth/2) - imageSize - -18*scale, sy - imageSize - 26*scale, imageSize, imageSize,"keyboard.png")
								 end
							end
						end

                end
                break
            end
        end
    end
)

function RemoveHEXColorCode( s ) 
    return s:gsub( '#%x%x%x%x%x%x', '' ) or s 
end 

local lastTime = 0

function handleChanging()
	if getTickCount() - lastTime >= 30000 then
		if getElementData(getLocalPlayer(),"char:afk") == false then
			setElementData(getLocalPlayer(),"char:afk", true)
		end
	end
	if isChatBoxInputActive() then
		setElementData(getLocalPlayer(),"char:chatting", true)
		chatti = "#FFFFFF"
	else
		setElementData(getLocalPlayer(),"char:chatting", false)
		chatti = ""
	end
	upText = chatti..""..network
	setElementData(getLocalPlayer(),"char:upText", upText)
	setTimer( handleChanging, 500, 1) 
end
addEventHandler ( "onClientRender", root, handleChanging )

 

to the nametag script.. but with 1-2 player working fine, and with more players, always show the chaticon.. How to fix this?

Share this post


Link to post

This isn't the whole code... how can we work with this?

Also.. why do you have a timer inside of a render function?

  • Like 1

Share this post


Link to post

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.