ManeXi Posted June 12, 2016 Share Posted June 12, 2016 (edited) Well I want to hide the name of a player when localPlayer is aiming it, then restore it when it stops aiming it. function targetingActivated ( target ) if ( target ) then if getElementType(target) == "player" then outputChatBox(getElementType(target),255,255,255) setPlayerNametagShowing ( target, false ) end elseif not (target) then outputChatBox("Heil Hitler!",0,255,0) setPlayerNametagShowing ( target, true ) end end addEventHandler ( "onClientPlayerTarget", getRootElement(), targetingActivated ) For obvious reasons when I stop aiming the enemy the "target" var becomes into false, so I can't hide a name of a undefinied player. My question is how may I save the previous target? Edited June 14, 2016 by Guest Link to comment
ManeXi Posted June 13, 2016 Author Share Posted June 13, 2016 Variables. Tried this and nothing. function targetingActivated ( target, prevTarget ) if ( target ) then if getElementType(target) == "player" then outputChatBox(getElementType(target),255,255,255) setPlayerNametagShowing ( target, false ) target = prevTarget end elseif not (target) then outputChatBox("Heil Hitler!",0,255,0) setPlayerNametagShowing ( prevTarget, true ) end end addEventHandler ( "onClientPlayerTarget", getRootElement(), targetingActivated ) Link to comment
FelipeMallmann Posted June 13, 2016 Share Posted June 13, 2016 try this function targetingActivated (target) if (target) then if getElementType(target) == "player" then outputChatBox(getElementType(target),255,255,255) setPlayerNametagShowing (target, false) prevTarget = target end else if (prevTarget) then outputChatBox("Heil Hitler!",0,255,0) setPlayerNametagShowing (prevTarget, true) else outputChatBox("There is no target / previous target.") end end end but this may show player nick only if you aim again and have no target. is that what you want? Link to comment
ManeXi Posted June 14, 2016 Author Share Posted June 14, 2016 no, Felipe it shows when I stop aiming it, thanks alot is working perfectly 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