roaddog Posted July 23, 2014 Share Posted July 23, 2014 Hey guys I need help, I made this script which gonna draw gang above head, Idk if it works or not, so this isRendering = false addEventHandler( "onClientRender",root, function( ) if isRendering then local px, py, pz, tx, ty, tz, dist px, py, pz = getCameraMatrix( ) for _, v in ipairs( getElementsByType 'player' ) do tx, ty, tz = getElementPosition( v ) dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 ) if dist < 30.0 then if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then local sx, sy, sz = getPedBonePosition( v, 5 ) local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.3 ) local lmao = getElementData(localPlayer, "Group") if x then -- getScreenFromWorldPosition returns false if the point isn't on screen dxDrawText( tostring(lmao), x-25, y-70, x, y, tocolor(0, 150, 0), 0.85 + ( 15 - dist ) * 0.02, "bankgothic","center", "center" ) end end end end end end ) for i, d in ipairs ( getElementsByType 'player' ) do if d ~= localPlayer then isRendering = false else isRendering = true end end Well is this gonna work? I mean localPlayer wont see his render, and only others can see it. Link to comment
Castillo Posted July 23, 2014 Share Posted July 23, 2014 Why don't you try it and see the result? Link to comment
roaddog Posted July 23, 2014 Author Share Posted July 23, 2014 They can see their own text above. why doesnt that work? Link to comment
12p Posted July 23, 2014 Share Posted July 23, 2014 I'm just asking, what do you think these three lines do? for i, d in ipairs ( getElementsByType 'player' ) do if d ~= localPlayer then isRendering = false Do you even try to understand the code you copy? Link to comment
roaddog Posted July 23, 2014 Author Share Posted July 23, 2014 I guess its gonna hide dxDraw if they are local player Link to comment
12p Posted July 23, 2014 Share Posted July 23, 2014 I guess its gonna hide dxDraw if they are local player And the local player is the one who runs the code... That is, yourself, if you tested it. Guess why it doesn't work, now? Link to comment
roaddog Posted July 23, 2014 Author Share Posted July 23, 2014 Alright then. I removed those line and add this function showGang() for i,player in ipairs(getElementsByType"player") do isRendering = true end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), showGang) then how to show only for others? Link to comment
Mr_Moose Posted July 23, 2014 Share Posted July 23, 2014 By adding these thre lines you just removed again, then look at them carefully one or more times until you understand that the problem isn't the lines but the logical statement which returns the opposite result. for i, d in ipairs ( getElementsByType 'player' ) do if d ~= localPlayer then isRendering = false Link to comment
roaddog Posted July 23, 2014 Author Share Posted July 23, 2014 Oh, yeah omg thank you for explaining. Link to comment
Mr_Moose Posted July 23, 2014 Share Posted July 23, 2014 Oh, yeah omg thank you for explaining. You're welcome 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