• 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!

How to detect if addEvent has ended?

waqmaz

Member
Joined
Jun 17, 2015
Messages
203
Reaction score
11
TFS 0.3.6
Code:
function onKill(cid, target)

    local pos = {x = 1050,  y = 1050,  z = 7}
    local time_ = 3000
    local item_uid = 1036
    local value = 1
    local monster = 'Cave Rat'
    local wall = getTileItemById(poz, item_uid).uid

    if getCreatureName(target) == monster then

        if wall > 0 then
       
            doRemoveItem(wall)
            doCreatureSay(cid, "wall removed", TALKTYPE_ORANGE_1)
     
        end
    
    event = addEvent(doCreateItem, time_, item_uid, value, pos)

    end

    return true

end
I am searchin this forums since two hours and haven't found anything.
There is an event.
Code:
event = addEvent(doCreateItem, time, item_id, value, pos)

I remove a wall in onKill event and then a text appears: "Wall removed".

I do not know how to detect if an event has been done to say "Wall created". I 've tried to use many script like:
Code:
if event == 0/nil/false, I've tried storage to, anything works :(
 
Last edited:
just use a second addEvent to say wall created? or write a function that places item + says x created and addEvent that one
event = addEvent(...)
event will be the event id in this case (>0)
 
So to check if an event's time has ended, just use "if event == 0"? doesn't work. tfs 0.3.6
this doesnt work too:
Code:
        if stopEvent(event) then
            doCreatureSay(cid, "event stopped", TALKTYPE_ORANGE_1)
        end
 
Last edited:
afaik there is no way to check if event has been executed yet without storing variables, but you could just have
addEvent(doCreatureSay, time_, cid, "Wall created", TALKTYPE_ORANGE_1)
under or above ur other event
 
Code:
addEvent(sendStuff, time_, cid, item_uid, value, pos)
local function sendStuff(cid, itemid, value, pos)
   doCreateItem(itemid, value, pos)
   doCreatureSay(cid, "wall created", TALKTYPE_ORANGE_1, pos)
end
all you need
 
Check this one.
Code:
function onKill(cid, target)

    local pos = {x = 1050,  y = 1050,  z = 7}
    local time_ = 3000
    local item_uid = 1036
    local value = 1
    local monster = 'Cave Rat'

    if getCreatureName(target) == monster then
        if(getThingFromPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 254}).itemid) == item_uid then
            doRemoveThing(getTileItemById(pos, item_uid).uid, 1)
            doCreatureSay(cid, "Wall Removed!", TALKTYPE_ORANGE_1)
            return true
        end
        event = addEvent(doCreateItem, time_, item_uid, value, pos)
    end
    return true
end
 
Last edited:
Can I ask something? What does really stackpos mean?
Stackpos 1 = ground, stackpos 2 = mountain, stackpos 3 = item on mountain???
 
Can I ask something? What does really stackpos mean?
Stackpos 1 = ground, stackpos 2 = mountain, stackpos 3 = item on mountain???
0 = base/floor
1 = thing on top of base/floor or nil
2 = thing on top of (thing on top of base/floor) or nil
et cetera
(Although I think 253/254/255 have special stackpos meanings)
sLKaVE5.png
 
Back
Top