WhoAmI Posted April 20, 2015 Share Posted April 20, 2015 Server function toggleInvis(thePlayer) local id = getElementModel(thePlayer) if id == 179 then local alpha = getElementAlpha(thePlayer) if alpha == 255 then setElementAlpha(thePlayer, 0) else setElementAlpha(thePlayer, 255) end else setElementAlpha(thePlayer, 255) end end addCommandHandler("invis", toggleInvis) Client function showOnShoot() setElementAlpha(source, 255) end addEventHandler("onClientPlayerWeaponFire", getLocalPlayer(), showOnShoot) I can replace your code with few lines. function invisible ( ) if ( getElementModel ( localPlayer ) == 179 ) then local n = ( getElementAlpha ( localPlayer ) > 0 ) and 0 or 255; setElementAlpha ( localPlayer, n ); end end addCommandHandler ( "invisible", invisible ) Use it client Leave your script s-side and use this c-side: addEventHandler ( "onClientPlayerWeaponFire", root, function ( ) setElementAlpha ( source, 255 ); end ); Link to comment
ALw7sH Posted April 20, 2015 Share Posted April 20, 2015 Leave your script s-side and use this c-side: addEventHandler ( "onClientPlayerWeaponFire", root, function ( ) setElementAlpha ( source, 255 ); end ); It should be server side because on client side nobody will be able see him even if he shoot 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