averatec
Advanced OT User
Lua:
local config =
{
code = "code",
itemid = 111, -- put your item id(writeable!!!)
gift =
{
id = 111, -- put your gift id
count = 1
}
}
function onTextEdit(cid, item, newText)
if (item.itemid ~= config.itemid) then
return false
end
if (newText ~= config.code) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Fail")
return false
end
doPlayerAddItem(cid, config.gift.id, config.gift.count)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Pass")
return true
end
Code:
<event type="texedit" name="RewardOnTextEdit" event="script" value="script.lua"/>
Rep++