Jump to content

[Help] With text


dex.

Recommended Posts

Hey. I have little issue with adding two text to script

What i wanna do is

If Admin writes /duty then scripts says outchatbox for everyone "Admin is on duty" and if Admin writes again /duty then then scripts says outchatbox for everyone "Admin is off duty"

 

script:

function duty(thePlayer)
	 accountname = getAccountName(getPlayerAccount(thePlayer))
		if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then
			setTimer ( function()
			setElementData (thePlayer, "brokenbone", false)
			setElementData (thePlayer, "bleeding", false)
			setElementData (thePlayer, "pain", false)
			setElementData (thePlayer, "cold", false)
			setElementData (thePlayer, "temperature", 36.5)
			setElementData (thePlayer, "blood", 12000)
			setElementData (thePlayer, "food", 100)
			setElementData (thePlayer, "thirst", 75)
end, 50,0)
end
end
addCommandHandler("duty", duty)

 

Link to comment
local onDuty = {}

addCommandHandler('duty',function(player,cmd)
	local accName = getAccountName(getPlayerAccount(player))
	if isObjectInACLGroup('user.'..accName,aclGetGroup('Admin')) then
		if not onDuty[player] or onDuty[player] == false then
			onDuty[player] = true
			outputChatBox(getPlayerName(player)..' is now on duty!',root)
			local timer1 = setTimer(function()
				setElementData(player,'brokenbone',false)
				setElementData(player,'bleeding',false)
				setElementData(player,'pain',false)
				setElementData(player,'cold',false)
				setElementData(player,'temperature',36.5)
				setElementData(player,'blood',12000)
				setElementData(player,'food',100)
				setElementData(player,'thirst',75)
			end,50,0)
		else
			onDuty[player] = false
			outputChatBox(getPlayerName(player)..' is now off duty!',root)
			if isTimer(timer1) then
				killTimer(timer1)
			end
		end
	end
end)

 

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