Bean666 Posted April 19, 2015 Posted April 19, 2015 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.
Dimos7 Posted April 19, 2015 Posted April 19, 2015 (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 April 19, 2015 by Guest
Enargy, Posted April 19, 2015 Posted April 19, 2015 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 )
Bean666 Posted April 19, 2015 Author Posted April 19, 2015 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.
Enargy, Posted April 19, 2015 Posted April 19, 2015 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.
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