function whatever(cid)
local playerPos = getCreaturePosition(cid)
local playerDir = getPlayerLookDir(cid)
--STORAGE_GEN is 99990010, a storage index number for this scripts generation of storage values.
----the next script will use STORAGE_GEN2 99990020 etc..
storageIDX = STORAGE_GEN + 1
storageIDY = STORAGE_GEN + 2
storageIDZ = STORAGE_GEN + 3
storageIDDir = STORAGE_GEN + 4
setPlayerStorageValue(cid, storageIDX, playerPos.x)
setPlayerStorageValue(cid, storageIDY, playerPos.y)
setPlayerStorageValue(cid, storageIDZ, playerPos.z)
setPlayerStorageValue(cid, storageIDDir, playerDir)
addEvent(repeater, 500, cid)
end
repeater(cid)
local playerPos = getCreaturePosition(cid)
local playerDir = getPlayerLookDir(cid)
storageIDX = STORAGE_GEN + 1
storageIDY = STORAGE_GEN + 2
storageIDZ = STORAGE_GEN + 3
storageIDDir = STORAGE_GEN + 4
oldX = getPlayerStorageValue(cid, storageIDX)
oldY = getPlayerStorageValue(cid, storageIDY)
oldZ = getPlayerStorageValue(cid, storageIDZ)
oldDir = getPlayerStorageValue(cid, storageIDDir)
newX = playerPos.x
newY = playerPos.y
newZ = playerPos.z
newDir = playerDir
if((newX == oldX) and (newY == oldY) and (newZ == oldZ) and (newDir == oldDir)) then
--insert any code that should be repeated here
addEvent(repeater, 1500, cid)
else
--code before repeat stops goes here
return true
end
end