Jump to content

Duty script


Manic69

Recommended Posts

I have this duty :

function giveblood (thePlayer)
    local account = getAccountName ( getPlayerAccount ( thePlayer ) )
    if isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then
        outputChatBox ("#FC7D01[Owner] #FFFFFF"..getPlayerName(thePlayer).."#00FF00 Is now onduty NO DM !",root,255,255,255,true)
        setElementData(thePlayer, "blood", 9999999999999999999)
    end
end
addCommandHandler("duty", giveblood)
 
function bloodback(thePlayer)
    local account = getAccountName ( getPlayerAccount ( thePlayer ) )
    if isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then
        outputChatBox ("#FC7D01[Owner]  #FFFFFF"..getPlayerName(thePlayer).."#FF0000 Is now offduty",root,255,255,255,true)
        setElementData(thePlayer, "blood", 12000)
    end
end
addCommandHandler("offduty", bloodback)
 

My problem is If I fall down or  Something explosing i die.

Link to comment
function giveblood (thePlayer)
    local account = getAccountName ( getPlayerAccount ( thePlayer ) )
    if isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then
        outputChatBox ("#FC7D01[Owner] #FFFFFF"..getPlayerName(thePlayer).."#00FF00 Is now onduty NO DM !",root,255,255,255,true)
        setElementData(thePlayer,"dutyON",1)
    end
end
addCommandHandler("duty", giveblood)

 

function bloodback(thePlayer)
    local account = getAccountName ( getPlayerAccount ( thePlayer ) )
    if isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then
        outputChatBox ("#FC7D01[Owner]  #FFFFFF"..getPlayerName(thePlayer).."#FF0000 Is now offduty",root,255,255,255,true)
        setElementData(thePlayer,"dutyON",0)
    end
end
addCommandHandler("offduty", bloodback)

-- Client side!

addEventHandler("onClientPlayerDamage", getRootElement(), function() 
    if getElementData(localPlayer, "dutyON") == 1 then
            cancelEvent()
        end
    end
)

 

Edited by TheMOG
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...