TalkAction Own Loot Backpack

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Best answers
0
Reaction score
51
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:
  • Like
Reactions: Qwe

Fare

Well-Known Member
Joined
Apr 3, 2008
Messages
2,386
Best answers
0
Reaction score
92
Location
Ukraine
aaaahaha, nice creativity :D
 

Benkeb

♫ OohWee ♫
Joined
Aug 6, 2007
Messages
235
Best answers
0
Reaction score
0
Location
Sweden, Stockholm
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 :)
 

Saj

Remember my name
Joined
Feb 26, 2008
Messages
2,127
Best answers
0
Reaction score
5
this is very good! But, could u make it so they can't throw it in water, trash it or something like that?
 

Markey

Ashandra War Scripter
Joined
Feb 7, 2008
Messages
114
Best answers
0
Reaction score
1
Location
Austria
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 <_<
 
OP
Azi

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Best answers
0
Reaction score
51
Location
Włocławek
#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:

EvulMastah

๏̯͡๏﴿
Premium User
Joined
Aug 19, 2007
Messages
4,833
Best answers
0
Reaction score
184
#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.
 
Top