Minotaur Posted June 12, 2014 Share Posted June 12, 2014 function afkstart ( player ) local name = getPlayerName ( player ) local x,y,z = getElementPosition ( player ) if isElementFrozen ( player ) then setElementFrozen ( player, false ) destroyElement ( znak ) outputChatBox ( "#ffffffGracz #ff0000"..name.."#ffffff wraca do gry, można w niego strzelać !", getRootElement(), 255, 0, 0, true ) else setElementFrozen ( player, true ) znak = createMarker ( x, y, z+2, "checkpoint", 1.5, 0, 255, 0 ) outputChatBox ( "#ffffffGracz #ff0000"..name.."#ffffff przechodzi w tryb AFK, nie strzelac do niego !", getRootElement(), 255, 0, 0, true ) end end addCommandHandler ( "afk", afkstart ) i want to if the players is afk set him to godmode anyone can help me? Link to comment
PartyMTA Posted June 12, 2014 Share Posted June 12, 2014 local playerHealth = getElementHealth ( getLocalPlayer() ) if playerHealth = -<99 then setElementHealth ( getLocalPlayer(), 100) end I am not sure if this works Not tested Link to comment
Minotaur Posted June 12, 2014 Author Share Posted June 12, 2014 local playerHealth = getElementHealth ( getLocalPlayer() ) if playerHealth = -<99 then setElementHealth ( getLocalPlayer(), 100) end function afkstart ( player ) local name = getPlayerName ( player ) local x,y,z = getElementPosition ( player ) if isElementFrozen ( player ) then setElementFrozen ( player, false ) destroyElement ( znak ) outputChatBox ( "#ffffffGracz #ff0000"..name.."#ffffff wraca do gry, można w niego strzelać !", getRootElement(), 255, 0, 0, true ) else setElementFrozen ( player, true ) znak = createMarker ( x, y, z+2, "checkpoint", 1.5, 0, 255, 0 ) outputChatBox ( "#ffffffGracz #ff0000"..name.."#ffffff przechodzi w tryb AFK, nie strzelac do niego !", getRootElement(), 255, 0, 0, true ) end end addCommandHandler ( "afk", afkstart ) not good. script error: afksystem/afk.lua:2: 'then' expected near '=' Link to comment
mommytellme Posted June 12, 2014 Share Posted June 12, 2014 local playerHealth = getElementHealth ( getLocalPlayer() ) if playerHealth == <99 then setElementHealth ( getLocalPlayer(), 100) end function afkstart ( player ) local name = getPlayerName ( player ) local x,y,z = getElementPosition ( player ) if isElementFrozen ( player ) then setElementFrozen ( player, false ) destroyElement ( znak ) outputChatBox ( "#ffffffGracz #ff0000"..name.."#ffffff wraca do gry, można w niego strzelać !", getRootElement(), 255, 0, 0, true ) else setElementFrozen ( player, true ) znak = createMarker ( x, y, z+2, "checkpoint", 1.5, 0, 255, 0 ) outputChatBox ( "#ffffffGracz #ff0000"..name.."#ffffff przechodzi w tryb AFK, nie strzelac do niego !", getRootElement(), 255, 0, 0, true ) end end addCommandHandler ( "afk", afkstart ) 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