D3VILH4RRT a4b5e1bfdef74b93af06cbd3c8b3f76b
이해도 | 입문자 |
---|---|
게임버전 (JE) | 1.20.1 |
게임버전 (BE) | 관련없음 |
스크립트 버전 | 2.7.2 |
상점 스크립트를 만드는데 구매를 막을려면 어떻게 해야하나요?
#명령어로 여는 상점
command /광부상점:
trigger:
open chest with 6 row named "&1&l광부상점" to player
set {_slot} to 0
loop 54 times:
set slot {_slot} of current inventory of player to black stained glass pane
add 1 to {_slot}
set slot 10 of current inventory of player to coal with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 11 of current inventory of player to raw copper with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 12 of current inventory of player to copper ingot with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 13 of current inventory of player to raw iron with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 14 of current inventory of player to iron ingot with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 15 of current inventory of player to raw gold with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 16 of current inventory of player to gold ingot with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 19 of current inventory of player to lapis lazuli with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 20 of current inventory of player to diamond with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 21 of current inventory of player to redstone with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 22 of current inventory of player to emerald with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 23 of current inventory of player to ancient debris with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 24 of current inventory of player to netherite ingot with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 25 of current inventory of player to coal block with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 28 of current inventory of player to copper block with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 29 of current inventory of player to iron block with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 30 of current inventory of player to gold block with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 31 of current inventory of player to diamond block with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 32 of current inventory of player to redstone block with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 33 of current inventory of player to lapis lazuli block with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 34 of current inventory of player to netherite block with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 39 of current inventory of player to quartz with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 40 of current inventory of player to iron nugget with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
set slot 41 of current inventory of player to gold nugget with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"
#아이템을 구매 및 판매하는 구문
on inventory click:
if inventory name is "&1&l광부상점":
cancel event
if clicked item is black stained glass pane:
else:
if click type is left mouse button:
if clicked raw slot is smaller than 54:
set {_lore} to uncolored line 0 of lore of clicked item
replace all "구매가격 " and ":" and " " and "구매불가" with "" in {_lore}
set {_lore} to {_lore} parsed as integer
if {%uuid of player%.돈} is smaller than {_lore}:
send "&c돈이 부족합니다" to player
play sound "entity.experience_orb.pickup" with volume 0.5 and pitch 1 to the player
else:
set {_item} to clicked item
delete lore of {_item}
if player has enough space for {_item}:
give {_item} to player
subtract {_lore} from {%uuid of player%.돈}
play sound "UI_BUTTON_CLICK" with volume 0.3 and pitch 3 to the player
else:
send "&c&l인벤토리에 충분한 공간이 없습니다!" to player
else if click type is right mouse button:
if clicked raw slot is smaller than 54:
set {_lore} to uncolored line 2 of lore of clicked item
replace all "판매가격 " and ":" and " " and "원" with "" in {_lore}
set {_lore} to {_lore} parsed as integer
set {_item} to clicked item
delete lore of {_item}
if player has 1 of {_item}:
remove 1 of {_item} from player's inventory
add {_lore} to {%uuid of player%.돈}
play sound "entity.experience_orb.pickup" with volume 0.5 and pitch 3 to the player
else:
send "&c현재 해당 아이템을 가지고 있지 않아 판매할 수 없습니다" to player
play sound "UI_BUTTON_CLICK" with volume 0.3 and pitch 3 to the player
on rightclick on entity:
if entity's name is "광부":
player command "광부상점"
데노
2023.11.08왼쪽클릭시 아래 구문을 실행하기전에 로어에 구매불가가 적혀있는지 확인하고
만약 구매불가라고 적혀있다면 return 해버리면 될 것 같습니다.
replace all "구매가격 " and ":" and " " and "구매불가" with "" in {_lore}