icekis
Member
- Joined
- Jan 18, 2018
- Messages
- 91
- Reaction score
- 5
Hello to everyone!
I am trying to make one trade premium days script using talkactions + creaturescripts with TFS 0.4
The script is working perfectly, but i got a problem and i would like your help.
when i type !tradepremium name days, script creates an item (1968) and starts a trade window with the target. If I accept the trade action, itemID 1968 will be transferred from player(cid) to the target, but if i cancel the trade action itemID 1968 will remain in the player's(cid) backpack and I would like it to disappear.
Could someone help me?
I am trying to make one trade premium days script using talkactions + creaturescripts with TFS 0.4
The script is working perfectly, but i got a problem and i would like your help.
Lua:
function onSay(cid, words, param, param2, channel)
local t = string.explode(param, ",")
local target = getCreatureByName(t[1])
local points = tonumber(t[2])
local item = 1968
local storage = 2122
if(param == '') then
return doPlayerSendTextMessage (cid, MESSAGE_INFO_DESCR, '!tradepremium name days')
end
if (target ~= nil) and isPlayer(target) then
if (points ~= nil) and (type(points) == 'number') and (points>1) then
if getPlayerTradeState(cid) >= 1 then
return false
end
if getPlayerPremiumDays(cid) > points then
local addItem = doPlayerAddItem(cid, item, 1)
doItemSetAttribute(addItem, "description", "trasfer premium days")
doStartTrade(cid, target, addItem)
setPlayerStorageValue(cid, storage, points)
else
return false
end
else
return false
end
else
return false
end
return true
end
when i type !tradepremium name days, script creates an item (1968) and starts a trade window with the target. If I accept the trade action, itemID 1968 will be transferred from player(cid) to the target, but if i cancel the trade action itemID 1968 will remain in the player's(cid) backpack and I would like it to disappear.
Could someone help me?
Last edited: