igthomas Posted March 17, 2012 Share Posted March 17, 2012 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
bandi94 Posted March 17, 2012 Share Posted March 17, 2012 this script will make 1 invisible 1 visible 1invisible 1 visible and so on .... player this is what you want ? Link to comment
igthomas Posted March 17, 2012 Author Share Posted March 17, 2012 no it should be so when player spawn as skin 310 or 217 then his blip and tagname should be invisible Link to comment
bandi94 Posted March 17, 2012 Share Posted March 17, 2012 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
Castillo Posted March 17, 2012 Share Posted March 17, 2012 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
igthomas Posted March 17, 2012 Author Share Posted March 17, 2012 Thanks it worked but blips are still visible Link to comment
bandi94 Posted March 17, 2012 Share Posted March 17, 2012 (edited) 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 March 17, 2012 by Guest Link to comment
Kenix Posted March 17, 2012 Share Posted March 17, 2012 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
igthomas Posted March 17, 2012 Author Share Posted March 17, 2012 Haha Thanks it works like a charm now 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