• 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!

New Script idea

Sir Mido

New Member
Joined
Dec 14, 2015
Messages
62
Reaction score
0
Hello today i need that script which i will explain ,also i think it need someone who had expereince in scripting
i will explain the script
Token that if i put it on normal item it will take his name like (
12:41 You see a Demon Armor (Arm:12, magic level +3, protection physical +3%, energy +3%, earth +3%,
It Belongs to Sir Mido)
---------
and talkaction script that if the item has my name and i write !getmyitem demon armor i will get it from anyone who had it.but it's only allowed to use this command one time per day)

tfs 0.4 r3884
 
Off the top of my head, the easiest (and maybe the most efficient) way to do this would be to simply mark the item with a players GUID and another unique id of some sort. (you can still display it as a name to players on look ofc). When they type the command to get their item back, simply flag the unique id you gave to the item as "deleted" and give the players item back. You can then check items as players log in or when an item is used, w.e ways you can think of so that if a flagged item exists, it is removed as needed rather than looping through every item in the server, and every offline player all at once upon execution of said command.

Small incomplete example but maybe it will help you understand my concept...

Player gives demon armor to Billy.
Player types command to get it back.
Player gets item back.
Old item is flagged as deleted.


-- Billy was online at the time of the command being used --
  1. Billy trys to move the demon armor.
  2. Check if its a deleted item. If yes, remove it and display a message to billy explaining why the item was deleted.

-- Billy already had the item equipped when the command was used and will never need to move it again --
  1. On global save every hour or w.e it's set to on the server, check all online players equipped items. Remove if they are flagged as deleted.

-- Billy was offline at the time of the command being used --
  1. Billy logs in.
  2. Loop through his inventory to see if item exists. Remove if it does.

-- Billy put the item in his depot so the login inventory check couldn't find it --
  1. Billy clicks on his depot later.
  2. Loop through depot items to see if item exists. Remove if it does.
-- Billy put the item in his house --
  1. Any time an item is looked at in a house, it checks if the item is flagged. Remove if it is.
  2. On server startup (or server save) check house items to see if they are flagged. This may not be needed to prevent abuse but would clean up any "duplicated" items in real time without the need for a player to attempt looking at or moving the item before it's deleted.

As you can see in each of these situations, the player gets the item back instantly and the item is removed the next time it is in some way interacted with.
You are essentially duplicating the item, and adding the old one to a "deletion queue".
The only way an old item can remain in the game is if the item is never interacted with again and if that is the case, then it doesn't matter if the item exists anyway because it is unused.

Keep in mind, this will not work for stackable items and will be more difficult to implement for containers.
 
Last edited:
Off the top of my head, the easiest (and maybe the most efficient) way to do this would be to simply mark the item with a players GUID and another unique id of some sort. (you can still display it as a name to players on look ofc). When they type the command to get their item back, simply flag the unique id you gave to the item as "deleted" and give the players item back. You can then check items as players log in or when an item is used, w.e ways you can think of so that if a flagged item exists, it is removed as needed rather than looping through every item in the server, and every offline player all at once upon execution of said command.

Small incomplete example but maybe it will help you understand my concept...

Player gives demon armor to Billy.
Player types command to get it back.
Player gets item back.
Old item is flagged as deleted.


-- Billy was online at the time of the command being used --
  1. Billy trys to move the demon armor.
  2. Check if its a deleted item. If yes, remove it and display a message to billy explaining why the item was deleted.

-- Billy already had the item equipped when the command was used and will never need to move it again --
  1. On global save every hour or w.e it's set to on the server, check all online players equipped items. Remove if they are flagged as deleted.

-- Billy was offline at the time of the command being used --
  1. Billy logs in.
  2. Loop through his inventory to see if item exists. Remove if it does.

-- Billy put the item in his depot so the login inventory check couldn't find it --
  1. Billy clicks on his depot later.
  2. Loop through depot items to see if item exists. Remove if it does.
-- Billy put the item in his house --
  1. Any time an item is looked at in a house, it checks if the item is flagged. Remove if it is.
  2. On server startup (or server save) check house items to see if they are flagged. This may not be needed to prevent abuse but would clean up any "duplicated" items in real time without the need for a player to attempt looking at or moving the item before it's deleted.

As you can see in each of these situations, the player gets the item back instantly and the item is removed the next time it is in some way interacted with.
You are essentially duplicating the item, and adding the old one to a "deletion queue".
The only way an old item can remain in the game is if the item is never interacted with again and if that is the case, then it doesn't matter if the item exists regardless because it is unused.

Keep in mind, this will not work for stackable items and will be more difficult to implement for containers.
Oo my head!you make from small script to hugggge script
i know that things but i don't have expreience on scripts so i need you help to make thoes scripts
 
Oo my head!you make from small script to hugggge script
Well the concept you are proposing is not really a "small script" xD It is quite a complex system you want to have.

You either have to remove the items on an as needed basis like I suggested, or you will need to loop through thousands of items both online and in the database at once. Any item in the database must be checked to make sure it does not currently exist in-game otherwise the removal will fail.

In short, no matter how this system is created, it will not be as simple as "make item belong to player" > "type !getback to get it back". There is going to be an elaborate removal process to prevent the duplication of items.
 
Well the concept you are proposing is not really a "small script" xD It is quite a complex system you want to have.

You either have to remove the items on an as needed basis like I suggested, or you will need to loop through thousands of items both online and in the database at once. Any item in the database must be checked to make sure it does not currently exist in-game otherwise the removal will fail.

In short, no matter how this system is created, it will not be as simple as "make item belong to player" > "type !getback to get it back". There is going to be an elaborate removal process to prevent the duplication of items.

bro i won't it work on rare items only not all items
 
bro i won't it work on rare items only not all items
removing and giving is not the problem.
tracking the item is.

giving item UID and removing it any time is easy. However if we have to take in account that item might be in offline player container or depot. then its gona be a problem.
If item is placed to containers it's hard to track it town, because TFS has not yet implemented the improvements for this.
 
Back
Top