Jump to content

invisible command


Bean666

Recommended Posts

Posted (edited)

is there anyway that this command will only work in a skin ID Which is 179? help please and is there also a way if the player shoots he loses his invisibility , thanks

function toggleInvis ( thePlayer )   
        if getElementAlpha( thePlayer ) == 255 then  
        setElementAlpha ( thePlayer, 0 )     
    else             
        setElementAlpha ( thePlayer, 255 )   
    end 
end 
addCommandHandler ( "invis", toggleInvis ) 

Edited by Guest
Posted
function invisible() 
    if getElementModel(localPlayer) == 179 then 
    setElementAlpha(localPlayer, 0) 
    end 
end 
addCommandHandler ( "invisible", invisible ) 

Posted

Leave your script s-side and use this c-side:

addEventHandler ( "onClientPlayerWeaponFire", root, 
    function ( ) 
        setElementAlpha ( source, 255 ); 
    end 
); 

Posted
Leave your script s-side and use this c-side:
addEventHandler ( "onClientPlayerWeaponFire", root, 
    function ( ) 
        setElementAlpha ( source, 255 ); 
    end 
); 

the source of this event is the weapon that was fired.

Posted
function invisible() 
    if getElementModel(localPlayer) == 179 then 
    setElementAlpha(localPlayer, 0) 
    end 
end 
addCommandHandler ( "invisible", invisible ) 

is there anyway that if i do the /invisible command again ill go back to the alpha 255? and btw Whoami it worked ty.
Posted (edited)
function invisible() 
    if getElementModel(localPlayer) == 179 then 
    setElementAlpha(localPlayer, 0) 
    end 
end 
addCommandHandler ( "invisible", invisible ) 

is there anyway that if i do the /invisible command again ill go back to the alpha 255? and btw Whoami it worked ty.

use

getElementAlpha () 

Example

function invisible() 
    if getElementModel(localPlayer) == 179 then 
      if getElementAlpha (localPlayer) == 255 then  
    setElementAlpha(localPlayer, 0) 
else 
setElementAlpha(localPlayer, 255) 
end  
    end 
end 
addCommandHandler ( "invisible", invisible ) 

Edited by Guest
Posted
function invisible() 
    if getElementModel(localPlayer) == 179 then 
        if getElementAlpha ~= 255 then 
        setElementAlpha(localPlayer, 255) 
        else 
        setElementAlpha(localPlayer, 0) 
        end 
    end 
end 
addCommandHandler ( "invisible", invisible ) 

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

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 ) 

Use it client

Posted
addEventHandler ( "onClientPlayerDamage", localPlayer, 
    function ( _, id ) 
        if ( id == 54 ) then -- 54 is the fall id. 
            cancelEvent ( ); 
        end 
    end 
); 

Also client-side.

Posted
addEventHandler ( "onClientPlayerDamage", localPlayer, 
    function ( _, id ) 
        if ( id == 54 and getElementModel ( localPlayer ) == 179 ) then -- 54 is the fall id. 
            cancelEvent ( ); 
        end 
    end 
); 

Posted

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) 

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