• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TalkAction Own Loot Backpack

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Reaction score
53
Location
Włocławek
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
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:
Haha, this is simply amazing xD But unfortunately it can't keep any evul players from throwing the bp into the water/swamp ;< Nicely done anyways, could be very useful :)
 
this is very good! But, could u make it so they can't throw it in water, trash it or something like that?
 
this is very good! But, could u make it so they can't throw it in water, trash it or something like that?
maybe a movement onAddItem or onRemoveItem could help...
But I can't help ya today cuz I have to learn for an english test <_<
 
#OWN BACKPACK IS NOT MOVEABLE!

Here it comes, I'm not sure whether it works, because I do not know too much about performance of the functions. :)
Not tested, but should work.

movements.xml:
Code:
<movevent event="AddItem" tileitem="1" itemid="2000" script="ownbp.lua"/>

movements/scripts/ownbp.lua:
Code:
function onAddItem(moveitem, tileitem, position)
	if(moveitem.actionid > 0)then
	  return 0
	end
end

Yours,
ersiu.
 
Last edited:
#OWN BACKPACK IS NOT MOVEABLE!

Here it comes, I'm not sure whether it works, because I do not know too much about performance of the functions. :)
Not tested, but should work.

movements.xml:
Code:
<movevent event="AddItem" tileitem="1" itemid="2000" script="ownbp.lua"/>

movements/scripts/ownbp.lua:
Code:
function onAddItem(moveitem, tileitem, position)
	if(moveitem.actionid > 0)then
	  doPlayerSendCancel(cid, 'It\'s not your own backpack.')
	  return 0
	end
end

Yours,
ersiu.

Well, if this will work, you won't get message, since "cid" returns nil. Also, if you remove this message, even the player that owns the backpack will not be able to move it.
 
This script had a error in ownbp.lua
Talk action :S
 
Back
Top