local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
local area = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)
function onGetFormulaValues(cid, level, maglevel)
min = -(maglevel*3) -level/5 -76
max = -(maglevel*4) -level/5 -108
return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
if getPlayerIdleTime(cid) < 10000 then
local tm = math.floor((10000 - getPlayerIdleTime(cid))/1000)
local rtime = tm >= 1 and tm or 1
doPlayerSendCancel(cid, "Stand still for 10 seconds before using this spell, "..rtime.." "..(rtime == 1 and "second" or "seconds").." to go.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return false
end
return doCombat(cid, combat, var)
end
if getCreatureCondition(cid, CONDITION_INFIGHT) then
doPlayerSendCancel(cid, "You can't do this spell when you're in a fight.")
return false
end
function onCastSpell(cid, var)
local fight = getCreatureCondition(cid, CONDITION_INFIGHT)
local move = getCreatureNoMove(cid)
if getCreatureNoMove(cid) and (fight == false) then
doCreatureChangeOutfit(cid, {lookType=130})
doSendMagicEffect(getCreaturePosition(cid), 35)
elseif getCreatureNoMove(cid) == false and (fight == false) then
doPlayerSendCancel(cid, "Stand still for 5 seconds before using this technique.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
elseif (fight == true) then
doPlayerSendCancel(cid, "You can't use technique when you're in a fight.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end
end
function onCastSpell(cid, var)
local fight = getCreatureCondition(cid, CONDITION_INFIGHT)
if getPlayerIdleTime(cid) >= 5000 and (fight == false) then
doCreatureChangeOutfit(cid, {lookType=130})
doSendMagicEffect(getCreaturePosition(cid), 35)
elseif getPlayerIdleTime(cid) < 5000 and (fight == false) then
doPlayerSendCancel(cid, "Stand still for 5 seconds before using this technique.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
elseif (fight == true) then
doPlayerSendCancel(cid, "You can't use technique when you're in a fight.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end
end
function onCastSpell(cid, var)
if getCreatureCondition(cid, CONDITION_INFIGHT) then
doPlayerSendCancel(cid, "You can't use technique when you're in a fight.")
return false
elseif getPlayerIdleTime(cid) < 5000 then
doPlayerSendCancel(cid, "Stand still for 5 seconds before using this this technique.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return false
end
local outfit = getCreatureOutfit(cid)
outfit.lookType = 130
doCreatureChangeOutfit(cid, outfit)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HEARTS)
return true
end
print(getPlayerIdleTime(cid))
[11/07/2014 17:37:47] 0
[11/07/2014 17:37:47] 0
[11/07/2014 17:37:48] 0
[11/07/2014 17:37:48] 0
[11/07/2014 17:37:49] 0
[11/07/2014 17:37:49] 0
[11/07/2014 17:37:50] 0
[11/07/2014 17:37:50] 0
[11/07/2014 17:37:51] 0
[11/07/2014 17:37:51] 0
[11/07/2014 17:37:52] 0
[11/07/2014 17:37:52] 0
[11/07/2014 17:37:53] 0
[11/07/2014 17:37:53] 0
[11/07/2014 17:37:54] 0
[11/07/2014 17:37:54] 0
[11/07/2014 17:37:55] 0
[11/07/2014 17:37:55] 0
[11/07/2014 17:37:56] 0
[11/07/2014 17:37:56] 0
[11/07/2014 17:37:57] 0
[11/07/2014 17:37:57] 0
[11/07/2014 17:37:58] 0
[11/07/2014 17:37:58] 0
[11/07/2014 17:37:59] 0
[11/07/2014 17:37:59] 0
local config = {
idleWarning = getConfigValue('idleWarningTime'),
idleKick = getConfigValue('idleKickTime')
}
function onThink(cid, interval)
print(getPlayerIdleTime(cid))
if(getTileInfo(getCreaturePosition(cid)).nologout or getCreatureNoMove(cid) or
getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_ALLOWIDLE)) then
return true
end
local idleTime = getPlayerIdleTime(cid) + interval
doPlayerSetIdleTime(cid, idleTime)
if(config.idleKick > 0 and idleTime > config.idleKick) then
doRemoveCreature(cid)
elseif(config.idleWarning > 0 and idleTime == config.idleWarning) then
local message = "You have been idle for " .. math.ceil(config.idleWarning / 60000) .. " minutes"
if(config.idleKick > 0) then
message = message .. ", you will be disconnected in "
local diff = math.ceil((config.idleWarning - config.idleKick) / 60000)
if(diff > 1) then
message = message .. diff .. " minutes"
else
message = message .. "one minute"
end
message = message .. " if you are still idle"
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, message .. ".")
end
return true
end