Jump to content

Duvida sobre script!


Recommended Posts

local godtime = 5; -- seconds
local godmode = false; -- variable for godmode
local godtimer

addEventHandler('onClientPlayerSpawn',localPlayer,function()
    godmode = true;
    setElementAlpha(localPlayer,255/2) -- set player alpha to 50%
    -- with this chunk we reset the timer (if this exists)
    if(godtimer)then
        isTimer(godtimer)then
            killTimer(godtimer);
        end
    end
    setTimer(disableGod,godtime*1000,1); -- set timer for disable godmode
end)

function disableGod()
    godmode = false;
    setElementAlpha(localPlayer,255); -- return player alpha
end

addEventHandler('onClientPlayerDamage',localPlayer,function()
    -- if godmode is active then
    if(godmode)then
        cancelEvent(); -- cancel damage for player with this event (onClientPlayerDamage)
    end
end)

Hi, I have commented the code so that you can understand what it does and learn :)

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