D
Deleted member 9590
- Script Version: https://gist.github.com/AggerTV/1c18016963ed2e9b7f1b275db1fb1174
- Full Code: https://gist.github.com/AggerTV/4a9159b467646923177fe867835bd631
- no errors on reload:
So, my issue is, that I am converting my old skript from 1.12.2 to 1.16.5, and I can no longer use item ids in the variables list. Here is an example of how it would have been on my old 1.12.2 server
Code:
{vagtpris::338} = 80 #sugar
And in 1.16.5 you cannot use item ids, so this is how I have put it
Code:
{vagtpris::sugar_cane} = 80 #sugar
So what my code is, is a sell skript that check what items are in the menu, and then it removes those items and gives the player x amount of money.
But previously when I could use item ids instead of item names, I would check what items the player had put in the menu like this:
Code:
if inventory name of player's current inventory is "&cVagt Kiste":
if player doesn't have permission "ag":
set {_Money} to 0
loop all items in event-inventory:
if {vagtpris::%id of loop-item%} is set:
loop 64 times:
add {vagtpris::%id of loop-item%} to {_money}
remove 1 of loop-item from player's current inventory
else:
add loop-item to {_items::*}
loop all items in event-inventory:
if loop-item isn't air:
if player can hold loop-item:
give loop-item to player
else:
drop loop-item at player's location
set loop-item to air
if {_money} is greater than 0:
add {_money} to player's balance
send "&aDu tjente &c$%{_money}%&a på at sælge dine ting!"
But in 1.16.5 I obviously cannot do this, and I'm unsure how to do it.
I tried doing it like this
Code:
if name of player's current inventory is "&cVagt Kiste":
if player doesn't have permission "ag":
set {_money} to 0
loop all items in event-inventory:
if {vagtpris::%loop-item%} is set:
loop 64 times:
add {vagtpris::%loop-item%} to {_money}
remove 1 of loop-item from player's current inventory
else:
add loop-item to {_items::*}
loop all items in event-inventory:
if loop-item isn't air:
if player can hold loop-item:
give loop-item to player
else:
drop loop-item at player's location
set loop-item to air
if {_money} is greater than 0:
add {_money} to player's balance
send "{@p} &aDu tjente &c$%{_money}%&a på at sælge dine ting!"
but this doesn't work. I'm unsure if it's because the code is somehow incorrect, or if I'm setting the variable incorrectly.
If you need me to elaborate on something, please say so!
[doublepost=1616574700,1616519137][/doublepost]bump