Jump to content

[HELP] How to fix this bug in the chaticon script???


Tokio

Recommended Posts

..this is not the full code from my nametag:

Spoiler

						local players = getElementsByType ( "player" )
		for theKey,thePlayer in ipairs(players) do
			if thePlayer == getLocalPlayer() then
						local DataUpText = getElementData(thePlayer,"char:upText")
						                    local imageSize = dxGetFontHeight ( textscale*NAMETAG_TEXTSIZE2, srfont )
															nameWidth = dxGetTextWidth ( playerName, textscale*NAMETAG_TEXTSIZE, srfont )
					teamWidth = nameWidth

								 if DataUpText == "" then
									-- dxDrawImage(x - 25 / (distance/10),y - 100 / (distance/10),50 / (distance/10),50 / (distance/10),getElementData(thePlayer, "char:admin")..".png")
								 else
									dxDrawImage(sx - math.max(nameWidth/2) - imageSize - -18*scale, sy - imageSize - 8*scale, imageSize, imageSize,"keyboard.png")
								 end
							end
						end

function handleChanging()
	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)
end
addEventHandler ( "onClientRender", root, handleChanging )

 

when i press 'T', the chaticon appear on everybody.. how to fix this? i want, when a player, or me press 'T', the ballon show just on the player, or on me, not on everyplayers...

 

sorry for my terrible english .. :c

Link to comment
  • Scripting Moderators
		local players = getElementsByType ( "player" )
		for theKey,thePlayer in ipairs(players) do
			if getElementData(thePlayer,"char:chatting") then
						local DataUpText = getElementData(thePlayer,"char:upText")
						                    local imageSize = dxGetFontHeight ( textscale*NAMETAG_TEXTSIZE2, srfont )
															nameWidth = dxGetTextWidth ( playerName, textscale*NAMETAG_TEXTSIZE, srfont )
					teamWidth = nameWidth

								 if DataUpText == "" then
									-- dxDrawImage(x - 25 / (distance/10),y - 100 / (distance/10),50 / (distance/10),50 / (distance/10),getElementData(thePlayer, "char:admin")..".png")
								 else
									dxDrawImage(sx - math.max(nameWidth/2) - imageSize - -18*scale, sy - imageSize - 8*scale, imageSize, imageSize,"keyboard.png")
								 end
							end
						end

 

  • Like 1
Link to comment

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