Hell-Mate Posted March 5, 2014 Share Posted March 5, 2014 Hello community ,, i want to create a dxDrawText to be shown to all players except the one who is the text on his head ( ElementData or what ever ) i have created it but its shown to the player that the Text on his head so its annoying, i want it for all players except the players which the text on his head. and here is my script -->> addEventHandler( "onClientRender", root, function( ) local hit = getElementsByType("player") if (#hit > 0) then local x,y,z = getElementPosition(localPlayer) for k,player in ipairs(hit) do if (getElementData(player, "whatever")) then local pX,pY,pZ = getElementPosition(player) --ped's position local tX,tY,tZ = pX,pY,pZ+1 --text's position local maxDistance = 30 local distance = getDistanceBetweenPoints3D(x, y, z, tX, tY, tZ) if (distance <= maxDistance) then local wX, wY = getScreenFromWorldPosition(tX, tY, tZ) if (wX and wY) then dxDrawText("what ever", wX + 2, wY + 2, _, _, tocolor(0, 0, 0, 200), 1.5, "arial", "center", "center") dxDrawText("what ever", wX, wY, _, _, tocolor(255, 255, 255, 200), 1.5, "arial", "center", "center") end end end end end end ) Link to comment
Castillo Posted March 5, 2014 Share Posted March 5, 2014 for k,player in ipairs ( hit ) do if ( player ~= localPlayer ) then Try that. Link to comment
Hell-Mate Posted March 5, 2014 Author Share Posted March 5, 2014 Worked. addEventHandler( "onClientRender", root, function( ) local hit = getElementsByType("player") if (#hit > 0) then local x,y,z = getElementPosition(localPlayer) for k,player in ipairs(hit) do if ( player ~= localPlayer ) and (getElementData(player, "hitBlip")) then local pX,pY,pZ = getElementPosition(player) --ped's position local tX,tY,tZ = pX,pY,pZ+1 --text's position local maxDistance = 30 local distance = getDistanceBetweenPoints3D(x, y, z, tX, tY, tZ) local Amount = getElementData ( player, "Amount" ) if (distance <= maxDistance) then local wX, wY = getScreenFromWorldPosition(tX, tY, tZ) if (wX and wY) then dxDrawText("Kill for ($" .. Amount .. ")", wX + 2, wY + 2, _, _, tocolor(0, 0, 0, 200), 1.5, "arial", "center", "center") dxDrawText("Kill for ($" .. Amount .. ")", wX, wY, _, _, tocolor(255, 255, 255, 200), 1.5, "arial", "center", "center") end end end end end end ) Thanks 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