• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.2 Spell Check Pos

lazarus321

Member
Joined
May 8, 2017
Messages
209
Reaction score
20
How could I check if the player (selftarget) is in the same position after 2 and 5 seconds?
 
Solution
Do the same thing for 5 seconds as well, use 5000 for milliseconds in the addEvent.

Lua:
local function checkPosition(cid, pos)
    local player = Player(cid)
    if not player then
        return
    end
    if player:getPosition() == pos then
        -- do something
    end
end

function onCastSpell(creature, variant)
    addEvent(checkPosition, 2000, creature:getId(), creature:getPosition())
    return true
end
Do the same thing for 5 seconds as well, use 5000 for milliseconds in the addEvent.

Lua:
local function checkPosition(cid, pos)
    local player = Player(cid)
    if not player then
        return
    end
    if player:getPosition() == pos then
        -- do something
    end
end

function onCastSpell(creature, variant)
    addEvent(checkPosition, 2000, creature:getId(), creature:getPosition())
    return true
end
 
Solution
Back
Top