So I am testing this simple script because I have a future project in mind that will use a similar code. Player uses a talkaction and receives 50 health. The action has 5 seconds cooldown as you can see below. This script is working fine btw, I tested it and found no issues.
However, I want to make the player get damaged by 10 hit points after like 2 seconds of using the talkaction. How can I make something happen to the player after X seconds of using a talkaction?
Lua:
local ex_storage = 9919
local ex_time = 5
function onSay(cid, words, param)
if exhaustion.get(cid, ex_storage) then
local remaining = exhaustion.get(cid, ex_storage)
doPlayerSendCancel(cid, 'You have to wait ' .. remaining .. ' more seconds.')
return true
end
exhaustion.set(cid, ex_storage, ex_time)
doCreatureAddHealth(cid, 50)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HEARTS)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Rawr!")
return true
end
However, I want to make the player get damaged by 10 hit points after like 2 seconds of using the talkaction. How can I make something happen to the player after X seconds of using a talkaction?