Jacobob14 Posted March 9, 2014 Share Posted March 9, 2014 as I can get the name tag also unseen local groups = { "Admin" } --Groups are allowed to use the invisibility blip = { } function toggleInvis ( source ) local nameTag = getPlayerNametagText ( source ) if ( source and getElementType ( source ) == "player" and hasPlayerAccessToInvisible (source) == true ) then if ( getElementAlpha ( source ) > 200 ) then setPlayerNametagShowing ( source, false ) setElementAlpha ( source, 0 ) local attachedElements = getAttachedElements ( source ) for ElementKey, ElementValue in ipairs ( attachedElements ) do if ( getElementType ( ElementValue ) == "blip" ) then destroyElement ( ElementValue ) end end outputChatBox ( "#00ffff|Mod| #00FF00Invisible Activado", source, 0, 255, 0, true ) else setPlayerNametagShowing ( source, true ) setElementAlpha ( source, 255 ) local nameTag = getPlayerName ( source ) local r, g, b = getPlayerNametagColor ( source ) blip [ source ] = createBlipAttachedTo ( source, 0, 2, r, g, b, 255 ) outputChatBox ( "#00ffff|Mod| #00FF00Invisible Desactivado", source, 0, 255, 0, true ) end else outputDebugString ( "Player: ".. nameTag .." try to use invisible, but he hasn't access to it!" ) end end addCommandHandler ( "invisible", toggleInvis ) function hasPlayerAccessToInvisible (thePlayer) local allowed = false if ( thePlayer ) then for id, team_cur in ipairs(teams) do if ( getPlayerTeam ( thePlayer ) and getTeamName ( getPlayerTeam ( thePlayer ) ) == team_cur ) then allowed = true break end end if not(allowed == true) then for id, group_cur in ipairs(groups) do if ( isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( group_cur ) ) ) then allowed = true break end end end return allowed end end addEventHandler ( "onPlayerQuit", root, function ( ) if isElement ( blip [ source ] ) then destroyElement ( blip [ source ] ) end end ) addEventHandler ( "onPlayerLogout", root, function ( ) if isElement ( blip [ source ] ) then destroyElement ( blip [ source ] ) end end ) Link to comment
Castillo Posted March 9, 2014 Share Posted March 9, 2014 You are already doing it with this function: setPlayerNametagShowing so, what is the problem? Link to comment
Jacobob14 Posted March 9, 2014 Author Share Posted March 9, 2014 but the name tag is still visible: ( 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