elnelson
Lunaria World Dev
Hello otlanders, i still dont get how to stop an event. Can someone please give me a detailed explanation how to stop this event when a player logoff? My console get tons of messages trying to find the player logged
TFS 0.4
i've searh on the forums, but the explanations are poor they only say "you must create a local blah and stopEvent(blah)" but that is not enough i need to know how this works properly, a clear example please... try to teach me like you teach your granpa pls... be kind. Thanks
TFS 0.4
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1 * 60 * 1000)
function inmunePoison(number, cid)
local n = number
for i = 1, number do
addEvent(doRemoveCondition, i*1000, cid, CONDITION_POISON)
n = n -1
end
n = number
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerFood(cid) >= 120 then
doPlayerSendCancel(cid, "You are full.")
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, " [Feed]: Full")
return false
end
if getPlayerFood(cid) < 120 then
if getPlayerStorageValue(cid, 44558) == -1 then
doPlayerPopupFYI(cid, "[Tutorial]: Green mushroom!\n\
Use it to gain innmunity to poison condition.\
You can get this with herbalism.\
")
setPlayerStorageValue(cid, 44558, 1)
end
if(hasCondition(cid, CONDITION_EXHAUST)) then
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
doCreatureSay(cid, "You cant eat so fast.",TALKTYPE_ORANGE_1)
else
local exhausted_seconds = 120
local exhausted_storagevalue = 78959
if (os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
local tiempo = doNumberFormat(math.ceil((getPlayerStorageValue(cid, exhausted_storagevalue) - os.time())))
doPlayerSendTextMessage(cid, 19, "[Status]: You already ate green mushroom (remaining time: ".. tiempo .." seconds).")
return false
end
if (os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
doPlayerSendCancel(cid, "You are feeding.")
if(not isSorcerer(cid) and not isDruid(cid)) then
local pos = getPlayerPosition(cid)
doRemoveCondition(cid, CONDITION_POISON)
doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doRemoveItem(item.uid,1)
doPlayerFeed(cid, 14)
inmunePoison(1*120, cid)
doSendAnimatedText(pos, "[Innmune] Poison.", 18)
addEvent(doPlayerSendTextMessage, 1*110*1000, cid, 19, "[Status]: Green mushroom effect will fade in 10 seconds.")
addEvent(doPlayerSendTextMessage, 1*120*1000, cid, 19, "[Status]: Green mushroom effect has fade.")
return true
end
if(not isKnight(cid) and not isPaladin(cid)) then
local pos = getPlayerPosition(cid)
doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doRemoveItem(item.uid,1)
doPlayerFeed(cid, 14)
doRemoveCondition(cid, CONDITION_POISON)
doSendAnimatedText(pos, "[Innmune] Poison.", 18)
addEvent(doPlayerSendTextMessage, 1*110*1000, cid, 19, "[Status]: Green mushroom effect will fade in 10 seconds.")
addEvent(doPlayerSendTextMessage, 1*120*1000, cid, 19, "[Status]: Green mushroom effect has fade.")
end
return true
end
end
end
end
i've searh on the forums, but the explanations are poor they only say "you must create a local blah and stopEvent(blah)" but that is not enough i need to know how this works properly, a clear example please... try to teach me like you teach your granpa pls... be kind. Thanks