Leinad Raiz Posted October 16, 2021 Posted October 16, 2021 Como faço para poder deixar o personagem 50% invisivel e imortal por 5 segundos para ele respawnar?
Human Resources Staff Vinyard Posted October 16, 2021 Human Resources Staff Posted October 16, 2021 Hi, welcome to the forums! Your thread has been moved to a more language-specific (and correct) section so you can get better help for your problem.
_SAXI_ Posted October 16, 2021 Posted October 16, 2021 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
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