Jump to content

[Help] SetElementAlpha


Recommended Posts

create a god mode but added the settlementalpha to let the player invisible,But when I type / god he is invisible only when I type / god again he goes invisible,What do need to edit when typing god again he normal?

my client:

--Scripts feitos por xXLeandroXx-- 
--Não remova os créditos-- 
--Data 03/11/2012-- 
  
function togglestaffMode(thePlayer) 
local account = getPlayerAccount(thePlayer) 
if (not account or isGuestAccount(account)) then return end 
local accountName = getAccountName(account) 
if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) ) then 
    if getElementData(thePlayer,"invincible") then 
        setElementData(thePlayer,"invincible",false) 
        outputChatBox("#ff0000God Mode Off",thePlayer,255,255,255,true) 
    else 
        setElementData(thePlayer,"invincible",true) 
        outputChatBox("#00ff00God Mode On.",thePlayer,255,255,255,true) 
        end 
    end 
end 
addCommandHandler("god",togglestaffMode) 
  
  
  
function toggleInvis ( thePlayer )  
        if getElementAlpha( thePlayer ) == 0 then    
        setElementAlpha ( thePlayer, 0)  
         
    else 
        setElementAlpha ( thePlayer, 130 )       
    end 
end 
addCommandHandler ( "god", toggleInvis ) 
  

HELP ME

Link to comment

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

Try .

Link to comment
  • Moderators

He uses client side. You will see your self invisible(with the script under this), but other players won't see it. Use the script of Mr.Pres[T]ege at serverside.

-- client, but not synced for all players.

addCommandHandler ( "god",  
function (command )--toggleInvis  
        if getElementAlpha(localPlayer ) == 0 then   
        setElementAlpha ( localPlayer, 130) --not 255? 
    else 
        setElementAlpha ( localPlayer, 0 )       
    end 
end) 

Use this also serverside.

function togglestaffMode(thePlayer) 
local account = getPlayerAccount(thePlayer) 
if (not account or isGuestAccount(account)) then return end 
local accountName = getAccountName(account) 
if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) ) then 
    if getElementData(thePlayer,"invincible") then 
        setElementData(thePlayer,"invincible",false) 
        outputChatBox("#ff0000God Mode Off",thePlayer,255,255,255,true) 
    else 
        setElementData(thePlayer,"invincible",true) 
        outputChatBox("#00ff00God Mode On.",thePlayer,255,255,255,true) 
        end 
    end 
end 
addCommandHandler("god",togglestaffMode) 

Link to comment

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