Jump to content

[Solved] Hiding player name on aiming


ManeXi

Recommended Posts

Posted (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 by Guest

Interested on a paid 3D modder?

My Skype: awdsasda.sdasdaad

Posted

Variables.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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 ) 

Interested on a paid 3D modder?

My Skype: awdsasda.sdasdaad

Posted

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?

Posted

no, Felipe it shows when I stop aiming it, thanks alot is working perfectly

Interested on a paid 3D modder?

My Skype: awdsasda.sdasdaad

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