if player used x items he must w8 5 min to move again if he move before 5 min will diewhat u need i dont understand u
do an onThink(), add thisi need script for
if player move = die
but not need stepin need function check if move or no
tfs 0.4
function checkPos(cid, prevPos)
local playerPos = getCreaturePosition(cid)
--if positions are different.
if(playerPos~=prevPos)then
--kill player
doPlayerAddHealth(cid, -500)
else
--if they arent different check in 200 MS again
addEvent(checkPos, 200, cid, playerPos)
end
return true
end
Why not use movement script? Since you are going to just kill the player if he moves and not register any attempts of moving under x time, it seems to me that there is no point in not using the movement interface:i need script for
if player move = die
but not need stepin need function check if move or no
tfs 0.4
function onStepOut(cid, item, toPosition, fromPosition)
if getPlayerStorageValue(cid, 500) == 1 then
local damage = getCreatureHealth(cid) + getCreatureMana(cid)
doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -damage, -damage, 18)
end
return true
end
Movements are registered for one or more ids that you step on, so if his script has to work on any id, then movements are useless.Why not use movement script? Since you are going to just kill the player if he moves and not register any attempts of moving under x time, it seems to me that there is no point in not using the movement interface:
LUA:function onStepOut(cid, item, toPosition, fromPosition) if getPlayerStorageValue(cid, 500) == 1 then local damage = getCreatureMaxHealth(cid) + getCreatureMaxMana(cid) doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -damage, -damage, 18) end return true end
I suppose you are right.Movements are registered for one or more ids that you step on, so if his script has to work on any id, then movements are useless.
local config = {
duration = 5 * 60,
storage = 500,
interval = 200,
}
local function check(cid, pos)
if not isPlayer(cid) or getPlayerStorageValue(cid, config.storage) <= 0 then
return
end
return pos ~= getThingPos(cid) and doCreatureAddHealth(cid, -getCreatureHealth(cid)) or addEvent(check, config.interval, cid, pos)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
--[[
if item.itemid == some_item_id then
-- doSomething()
end
--]]
return addEvent(check, config.interval, cid, getThingPos(cid)), setPlayerStorageValue(cid, config.storage, os.time() + config.duration)
end