Saving Custom item on MYSQL

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

medivh

Member
Jan 28, 2017
43
0
0
33
Its possible save a custom item on a MYSQL table and convert then to give to inventory again, without use of variables (permanent variables), for save this item? Like a diamond sword with sharpness 10 and named &b&lTest
 
You can convert the item into a string (ID, SubID and NBT) and just convert it back into an item
 
Try this:
code_language.skript:
function ItemToString(i: item) :: text:
    set {_nbt} to "%nbt of {_i}%"
    return "%{_i}%|%damage value of {_i}%|%encode base64 {_nbt}%"

function StringToItem(s: text) :: item:
    set {_x::*} to {_s} split at "|"
    set {_i} to "%{_x::1}%:%{_x::2}%" parsed as item
    return {_i} with custom nbt "%base64 decode {_x::3}%"

   
command /test123:
    trigger:
        set {_itemstring} to ItemToString(player's tool)
        send "STRING: %{_itemstring}%"
        set {_item} to StringToItem({_itemstring})
        send "ITEM: %{_item}%"