Hello, I made a special Bag, for loot when you exp and do not want us to be stolen loot when, for example, we do not have Cap. Backpack owner (the person who purchased) can open it, and the wrong person can not open it! Backpack ceases to be a person after a certain period of time!
Command to buy BP: !ownbp
first in data/talkactions/talkactions.xml
and in data/talkactions/scripts/ownbp.lua
now in data/actions/actions.xml
and in data/actions/scripts/ownbp.lua
Your's
ersiu.
Command to buy BP: !ownbp
first in data/talkactions/talkactions.xml
Code:
<talkaction words="!ownbp" script="ownbp.lua"/>
and in data/talkactions/scripts/ownbp.lua
Code:
function onSay(cid, words, param)
[b]
--//CONFIG//--
local cost = 1000 -- cost( GP)
local ownTime = (60*60*24) -- seconds (default 24h)
--//CONFIG//--[/b]
local playerID = getPlayerGUID(cid)
local owner = (playerID + 100)
local ownerName = getPlayerName(cid)
local function noOwner(o)
doSetItemSpecialDescription(o.backpack, '')
doSetItemActionId(o.backpack, 0)
end
if(doPlayerRemoveMoney(cid, cost) == TRUE)then
local backpack = doPlayerAddItem(cid, 2000, 1)
doSetItemSpecialDescription(backpack, ownerName..' owns this container.')
doSetItemActionId(backpack, owner)
addEvent(noOwner, 1000*ownTime, {'backpack'=backpack})
end
end
now in data/actions/actions.xml
Code:
<action itemid="2000" script="ownbp.lua"/>
and in data/actions/scripts/ownbp.lua
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local playerID = getPlayerGUID(cid)
local owner = item.actionid-100
if(owner > 0)then
if(owner ~= playerID)then
doPlayerSendCancel(cid, 'You aren\'t owner of this container.')
return TRUE
end
end
end
Your's
ersiu.
Last edited: