i tried doing the area push thing but storage works weird with printer's exhaust check, returns false 100% of the time so ill look into it later
Code:
function Player:isInArea(center, rangeX, rangeY)
local pos = self:getPosition()
return (pos.x >= center.x-rangeX and pos.x <= center.x+rangeX and pos.y >= center.y-rangeY and pos.y <= center.y+rangeY)
end
this works perfectly fine he just had a + instead of a - for the 1st center.y
edit: nevermind i got the push thing working
player lib
Code:
function Player.setExhaustion(self, value, time)
self:setStorageValue(value, time + os.time())
end
function Player.getExhaustion(self, value)
local storage = self:getStorageValue(value)
if not storage or storage <= os.time() then
return 0
end
return storage - os.time()
end
function Player:hasExhaustion(value)
return self:getExhaustion(value) >= os.time() and true or false
end
player events (onmovecreature)
Code:
local storage, time = 80005, 10
local pos = Position(1022, 1001, 7)
function Player:onMoveCreature(creature, fromPosition, toPosition)
local player = creature:getPlayer()
if player then
if player:isInArea(pos, 3, 3) then
if self:getExhaustion(storage) > 0 then
self:sendTextMessage(MESSAGE_STATUS_SMALL, 'You may not push players this fast.')
return false
end
self:setExhaustion(storage, time)
end
end
return true
end
[/QUOTE
Oh yeah, managed to work, thanks!
But I explained myself bad... The idea is to control the time by pushing a creature