Jump to content

invisible help?


Bean666

Recommended Posts

Posted
function invisible ( ) 
    if ( getElementModel ( localPlayer ) == 179 ) then 
        local n = ( getElementAlpha ( localPlayer ) > 0 ) and 0 or 255; 
        setElementAlpha ( localPlayer, n ); 
    end 
end 
addCommandHandler ( "invisible", invisible ) 
  
addEventHandler ( "onClientPlayerWeaponFire", root, 
    function ( ) 
        setElementAlpha ( source, 255 ); 
    end 
); 

hi , this code works... i go invisible and i can see my self invisible , but when it comes to other players , they can still see me visible , and when a player also go invisible , i can still see them , any way to fix this? Help please.

Aftermath

Posted (edited)
function Invisible(thePlayer) 
       if (getElementModel(thePlayer) == 179) then 
            local n = (getElementAlpha(thePlayer) > 0) and 0 or 255; 
              setElementAlpha(thePlayer, n); 
       end 
end 
addCommandHandler("invisible", Invisible) 
  
addEventHandler("onWeaponFire", root, 
      function() 
            setElementAlpha(source, 255) 
      end 
) 

Edited by Guest

 

 

Posted

Because this is clientside. it must be written in serverside.

function invisible ( thePlayer ) 
    if ( getElementModel ( thePlayer ) == 179 ) then 
        local n = ( getElementAlpha ( thePlayer ) > 0 ) and 0 or 255; 
        setElementAlpha ( thePlayer, n ); 
    end 
end 
addCommandHandler ( "invisible", invisible ) 

- Inactivo.

Posted
Because this is clientside. it must be written in serverside.
function invisible ( thePlayer ) 
    if ( getElementModel ( thePlayer ) == 179 ) then 
        local n = ( getElementAlpha ( thePlayer ) > 0 ) and 0 or 255; 
        setElementAlpha ( thePlayer, n ); 
    end 
end 
addCommandHandler ( "invisible", invisible ) 

will the players cant see me now if i do /invisible?

because in the client side if i do /invisible , they can still see me , but on my screen i can see my self as invisible.

Aftermath

Posted
function Invisible(thePlayer) 
       if (getElementModel(thePlayer) == 179) then 
            local n = (getElementAlpha(thePlayer) > 0) and 0 or 255; 
              setElementAlpha(thePlayer, n); 
       end 
end 
addCommandHandler("invisible", Invisible) 
  
addEventHandler("onPlayerWeaponFire", root, 
      function() 
            setElementAlpha(source, 255) 
      end 
) 

Why do you edit your code when I posted mine? otherwise, onPlayerWeaponFire not exist. Did you mean onWeaponFire.

EDIT:

@Shaman123, yes, what happen is that the code itself works for the local player (clientside), But if in serverside this will be executed for the server.

- Inactivo.

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