Jump to content

Not Invisible


igthomas

Recommended Posts

Well players arent invisible

iv = 0 
  
function toggleInvis( source ) 
local skin = getElementModel (source) 
    if ( skin == 310 or skin == 217 ) then 
    if iv == 0 then 
        iv = 1 
        setPlayerNametagShowing(source, false) 
        setElementAlpha(source, 0) 
    else 
        iv = 0 
        setPlayerNametagShowing(source, true) 
        setElementAlpha(source, 255) 
    end 
end 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), toggleInvis ) 

In meta I've added it as a server type

Link to comment

if you set the player's Alpha to 0 that will not hide the blip you need to destroy or set the blip alpha to 0

for i,v in pairs(getAttachedElements(source)) do 
 if getElementType(v)=="blip" then 
r,g,b,a = getBlipColor(v) 
 setBlipColor(v,r,g,b,0) 
 end 
  end 

Link to comment
local invisible = { } 
local skins = { [ 217 ] = true, [ 310 ] = true } 
  
function toggleInvis ( ) 
    setTimer ( 
        function ( player ) 
            local skin = getElementModel ( player ) 
            if ( skins[ skin ] ) then 
                if ( not invisible[ player ] ) then 
                    invisible[ player ] = true 
                    setPlayerNametagShowing ( player, false ) 
                    setElementAlpha ( player, 0 ) 
                else 
                    invisible[ player ] = false 
                    setPlayerNametagShowing ( player, true ) 
                    setElementAlpha ( player, 255 ) 
                end 
            end 
        end 
        ,200, 1, source ) 
end 
addEventHandler ( "onPlayerSpawn", root, toggleInvis ) 

Link to comment
local invisible = { } 
local skins = { [ 217 ] = true, [ 310 ] = true } 
  
function toggleInvis ( ) 
    setTimer ( 
        function ( player ) 
            local skin = getElementModel ( player ) 
            if ( skins[ skin ] ) then 
                if ( not invisible[ player ] ) then 
                    invisible[ player ] = true 
                    setPlayerNametagShowing ( player, false ) 
                    setElementAlpha ( player, 0 ) 
                    blip(player,true)     
                else 
                    invisible[ player ] = false 
                    setPlayerNametagShowing ( player, true ) 
                    setElementAlpha ( player, 255 ) 
                    blip(player,false)     
                end 
            end 
        end 
        ,200, 1, source ) 
end 
addEventHandler ( "onPlayerSpawn", root, toggleInvis ) 
  
  
  
  
  
function blip(player,status) 
for i,v in pairs(getAttachedElements(player)) do 
 if getElementType(v)=="blip" then 
r,g,b,a = getBlipColor(v) 
  if status then 
 setBlipColor(v,r,g,b,0) 
else 
 setBlipColor(v,r,g,b,255) 
 end 
  end 
  end 

Edited by Guest
Link to comment
local tInvisible = { } 
local tSkins =  
{  
    [ 217 ] = true; 
    [ 310 ] = true;  
} 
  
function fInvisible ( ) 
    setTimer ( 
        function ( uPlayer ) 
            local nSkin = getElementModel ( uPlayer ) 
            if tSkins[ nSkin ] then 
                tInvisible[ uPlayer ] = not tInvisible[ uPlayer ] 
                setPlayerNametagShowing ( uPlayer, not tInvisible[ uPlayer ] ) 
                setElementAlpha ( uPlayer, not tInvisible[ uPlayer ] and 255 or 0 ) 
                for _,uBlip in pairs( getAttachedElements( uPlayer ) ) do 
                    if getElementType( uBlip ) == "blip" then 
                        local nR, nG, nB, _ = getBlipColor( uBlip ) 
                        setBlipColor( uBlip, nR, nG, nB, not tInvisible[ uPlayer ] and 255 or 0 ) 
                    end 
                end 
            end 
        end 
    ,200, 1, source ) 
end 
addEventHandler ( "onPlayerSpawn", root, fInvisible ) 

Link to comment

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