Dimmitry007 Posted February 25, 2015 Share Posted February 25, 2015 How to enable and disable godmode only in one CMd? Here's my code function aduty ( player ) local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then outputChatBox("Admin "..getPlayerName(player).." Is Now OnDuty!",getRootElement(),255,0,0) outputChatBox("",getRootElement(),255,0,0) outputServerLog("Admin "..getPlayerName(player).." Is Now OnDuty!") setElementData( player, "blood", 999999999999999 ) heal = "999999999999999" end end addCommandHandler("aduty",aduty) function offaduty ( player ) local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then outputChatBox("Admin "..getPlayerName(player).." Is No Longer OnDuty!",getRootElement(),255,0,0) outputChatBox("",getRootElement(),255,0,0) outputServerLog("Admin "..getPlayerName(player).." Is No Longer OnDuty!") setElementData( player, "blood", 12000 ) end end addCommandHandler("offduty",offaduty) function heal_func ( player ) local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then if heal == "an" then setElementData( player, "food", 250 ) setElementData( player, "thirst", 250 ) end end end setTimer(heal_func, 60000, 0) Link to comment
JR10 Posted February 25, 2015 Share Posted February 25, 2015 You can use element data (without sync) to identify if he's on duty or off duty and change it. You didn't post the part where you make the player invincible. Link to comment
Dimmitry007 Posted February 25, 2015 Author Share Posted February 25, 2015 GTA blood is not like day blood so Link to comment
Tekken Posted February 25, 2015 Share Posted February 25, 2015 Look here : function setPlayerOnDuty( player ) local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then local duty = getElementData(player, "duty") or 0 if duty == 0 then outputChatBox("Admin "..getPlayerName(player).." Is Now OnDuty!",getRootElement(),255,0,0) outputChatBox("",getRootElement(),255,0,0) outputServerLog("Admin "..getPlayerName(player).." Is Now OnDuty!") setElementData( player, "blood", 999999999999999 ) setElementData( player, "duty", 1 ) else outputChatBox("Admin "..getPlayerName(player).." Is No Longer OnDuty!",getRootElement(),255,0,0) outputChatBox("",getRootElement(),255,0,0) outputServerLog("Admin "..getPlayerName(player).." Is No Longer OnDuty!") setElementData( player, "blood", 12000 ) setElementData( player, "duty", 0 ) end end end addCommandHandler("aduty",setPlayerOnDuty) Link to comment
Dimmitry007 Posted February 26, 2015 Author Share Posted February 26, 2015 ok how to make this in one command? i tried and tried it never worked function startgm() gmtimer = setTimer(gmforad, 2000, 0) outputChatBox ("You're OnDuty",255, 0, 0,true) end addCommandHandler("aduty", startgm) function offgm() killTimer (gmtimer) setElementData(getLocalPlayer(),"blood", 12000) outputChatBox ("You're OffDuty!",255, 0, 0,true) end addCommandHandler("offaduty", offgm) function gmforad() if getElementData(getLocalPlayer(),"logedin") then setElementData(getLocalPlayer(),"blood", 500000) setElementData(getLocalPlayer(),"bleeding", 0) setElementData(getLocalPlayer(),"cold", false) setElementData(getLocalPlayer(),"temperature", 37) setElementData(getLocalPlayer(),"pain", false) setElementData(getLocalPlayer(),"brokenbone", false) setElementData(getLocalPlayer(),"thirst", 100) setElementData(getLocalPlayer(),"food", 100) end end Link to comment
Addlibs Posted February 26, 2015 Share Posted February 26, 2015 function startgm() if not getElementData(getLocalPlayer(), "onduty") then gmtimer = setTimer(gmforad, 2000, 0) outputChatBox ("You're now on-duty",255, 0, 0,true) setElementData(getLocalPlayer(), "onduty", true) else killTimer (gmtimer) setElementData(getLocalPlayer(),"blood", 12000) outputChatBox ("You're now off-duty!",255, 0, 0,true) setElementData(getLocalPlayer(), "onduty", false) end end addCommandHandler("duty", startgm) function gmforad() if getElementData(getLocalPlayer(),"logedin") then setElementData(getLocalPlayer(),"blood", 500000) setElementData(getLocalPlayer(),"bleeding", 0) setElementData(getLocalPlayer(),"cold", false) setElementData(getLocalPlayer(),"temperature", 37) setElementData(getLocalPlayer(),"pain", false) setElementData(getLocalPlayer(),"brokenbone", false) setElementData(getLocalPlayer(),"thirst", 100) setElementData(getLocalPlayer(),"food", 100) end end Link to comment
Dimmitry007 Posted February 26, 2015 Author Share Posted February 26, 2015 function startgm() if not getElementData(getLocalPlayer(), "onduty") then gmtimer = setTimer(gmforad, 2000, 0) outputChatBox ("You're now on-duty",255, 0, 0,true) setElementData(getLocalPlayer(), "onduty", true) else killTimer (gmtimer) setElementData(getLocalPlayer(),"blood", 12000) outputChatBox ("You're now off-duty!",255, 0, 0,true) setElementData(getLocalPlayer(), "onduty", false) end end addCommandHandler("duty", startgm) function gmforad() if getElementData(getLocalPlayer(),"logedin") then setElementData(getLocalPlayer(),"blood", 500000) setElementData(getLocalPlayer(),"bleeding", 0) setElementData(getLocalPlayer(),"cold", false) setElementData(getLocalPlayer(),"temperature", 37) setElementData(getLocalPlayer(),"pain", false) setElementData(getLocalPlayer(),"brokenbone", false) setElementData(getLocalPlayer(),"thirst", 100) setElementData(getLocalPlayer(),"food", 100) end end thanks ALOT! Link to comment
Dimmitry007 Posted February 26, 2015 Author Share Posted February 26, 2015 but every one can use it can u put it for admins only? Link to comment
Addlibs Posted February 26, 2015 Share Posted February 26, 2015 If I am not mistaken, this is for a DayZ server, therefore, you can use a check for the 'admin' (or 'support') element data. function startgm() if not getElementData(getLocalPlayer(), "admin") then outputChatBox("You are not an admin.", 255, 0, 0) return; end --End function here if client is not an admin if not getElementData(getLocalPlayer(), "onduty") then gmtimer = setTimer(gmforad, 2000, 0) outputChatBox ("You're now on-duty",255, 0, 0,true) setElementData(getLocalPlayer(), "onduty", true) else killTimer (gmtimer) setElementData(getLocalPlayer(),"blood", 12000) outputChatBox ("You're now off-duty!",255, 0, 0,true) setElementData(getLocalPlayer(), "onduty", false) end end addCommandHandler("duty", startgm) function gmforad() if getElementData(getLocalPlayer(),"logedin") then setElementData(getLocalPlayer(),"blood", 500000) setElementData(getLocalPlayer(),"bleeding", 0) setElementData(getLocalPlayer(),"cold", false) setElementData(getLocalPlayer(),"temperature", 37) setElementData(getLocalPlayer(),"pain", false) setElementData(getLocalPlayer(),"brokenbone", false) setElementData(getLocalPlayer(),"thirst", 100) setElementData(getLocalPlayer(),"food", 100) end end Link to comment
Dimmitry007 Posted February 27, 2015 Author Share Posted February 27, 2015 It says ur not an admin even when I'm admin with /add admin nohope And every one can still use it Link to comment
Tekken Posted February 27, 2015 Share Posted February 27, 2015 Server function setPlayerDutyStats(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then triggerClientEvent(thePlayer, "onPlayerOnDuty", thePlayer) end end addCommandHandler("aduty", setPlayerDutyStats) Client function startgm() if not getElementData(getLocalPlayer(), "onduty") then gmtimer = setTimer(gmforad, 2000, 0) outputChatBox ("You're now on-duty",255, 0, 0,true) setElementData(getLocalPlayer(), "onduty", true) else killTimer (gmtimer) setElementData(getLocalPlayer(),"blood", 12000) outputChatBox ("You're now off-duty!",255, 0, 0,true) setElementData(getLocalPlayer(), "onduty", false) end end addEvent("onPlayerOnDuty", true) addEventHandler("onPlayerOnDuty", root, startgm) function gmforad() if getElementData(getLocalPlayer(),"logedin") then setElementData(getLocalPlayer(),"blood", 500000) setElementData(getLocalPlayer(),"bleeding", 0) setElementData(getLocalPlayer(),"cold", false) setElementData(getLocalPlayer(),"temperature", 37) setElementData(getLocalPlayer(),"pain", false) setElementData(getLocalPlayer(),"brokenbone", false) setElementData(getLocalPlayer(),"thirst", 100) setElementData(getLocalPlayer(),"food", 100) end end Link to comment
Dimmitry007 Posted February 27, 2015 Author Share Posted February 27, 2015 Server function setPlayerDutyStats(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then triggerClientEvent(thePlayer, "onPlayerOnDuty", thePlayer) end end addCommandHandler("aduty", setPlayerDutyStats) Client function startgm() if not getElementData(getLocalPlayer(), "onduty") then gmtimer = setTimer(gmforad, 2000, 0) outputChatBox ("You're now on-duty",255, 0, 0,true) setElementData(getLocalPlayer(), "onduty", true) else killTimer (gmtimer) setElementData(getLocalPlayer(),"blood", 12000) outputChatBox ("You're now off-duty!",255, 0, 0,true) setElementData(getLocalPlayer(), "onduty", false) end end addEvent("onPlayerOnDuty", true) addEventHandler("onPlayerOnDuty", root, startgm) function gmforad() if getElementData(getLocalPlayer(),"logedin") then setElementData(getLocalPlayer(),"blood", 500000) setElementData(getLocalPlayer(),"bleeding", 0) setElementData(getLocalPlayer(),"cold", false) setElementData(getLocalPlayer(),"temperature", 37) setElementData(getLocalPlayer(),"pain", false) setElementData(getLocalPlayer(),"brokenbone", false) setElementData(getLocalPlayer(),"thirst", 100) setElementData(getLocalPlayer(),"food", 100) end end thanks 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