Lopaskurwa
Active Member
- Joined
- Oct 6, 2017
- Messages
- 873
- Solutions
- 2
- Reaction score
- 49
Hello so i found this system which gives you random item when you click on it
How to send a message what item you got from that box. Example
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You got ' ...ITEMNAME... ' ")
Lua:
local presents = {
[6570] = { -- item id of the item that will give u random items
{2687, 10}, {6394, 3}, 6280, 6574, 6578, 6575, 6577, 6569, 6576, 6572, 2114 --Setup the rewards here
}
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local count = 1
local targetItem = presents[item.itemid]
if not targetItem then
return true
end
local gift = targetItem[math.random(#targetItem)]
if type(gift) == "table" then
gift = gift[1]
count = gift[2]
end
player:addItem(gift, count)
item:remove(1)
fromPosition:sendMagicEffect(CONST_ME_GIFT_WRAPS)
return true
end
How to send a message what item you got from that box. Example
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You got ' ...ITEMNAME... ' ")