im trying to make furniture store and heres script but theres bug in the line 35 37 and 39

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

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

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

cemal

Member
Oct 20, 2024
12
0
1
# /satisakoy <fiyat> komutu - yalnızca OP'ler
command /satisakoy <number>:
permission: op
trigger:
set {_target} to targeted block
if {_target} is not set:
send "&cBakılan bir blok bulunamadı."
stop
set {_loc} to location of {_target}
set {_key} to "%world of {_loc}%:%x of {_loc}%:%y of {_loc}%:%z of {_loc}%"
set {satisbloklari::%{_key}%::fiyat} to arg-1
set {satisbloklari::%{_key}%::blok} to type of {_target}
send "&aBlok fiyatı ayarlandı: %{arg-1}%$"

every 1 tick:
loop all players:
set {_block} to loop-player's targeted block
if {_block} is not air:
set {_loc} to location of {_block}
set {_key} to "%world of {_loc}%:%x of {_loc}%:%y of {_loc}%:%z of {_loc}%"
if {satisbloklari::%{_key}%::fiyat} is set:
set {_fiyat} to {satisbloklari::%{_key}%::fiyat}
send action bar "&eFiyat: %{_fiyat}%$ &7(Sağ tıkla almak için)" to loop-player

on right click:
if event-block is a block:
set {_loc} to location of event-block
set {_key} to "%world of {_loc}%:%x of {_loc}%:%y of {_loc}%:%z of {_loc}%"
if {satisbloklari::%{_key}%::fiyat} is set:
set {_fiyat} to {satisbloklari::%{_key}%::fiyat}
set {_bloktipi} to {satisbloklari::%{_key}%::blok}
if balance of player >= {_fiyat}:
withdraw {_fiyat} from player
give {_bloktipi} to player
send "&aSatın alındı! %{_fiyat}%$ ödediniz."
else:
send "&cYeterli paranız yok. Gerekli: %{_fiyat}%$"
 
Your code actually didnt work and it kept saying "<none>" and it wouldnt let you buy the block. And it gave any block you looked at. So I fixed it :emoji_slight_smile:
:emoji_warning: Constantly looping will cause lags within server:emoji_warning:

CSS:
command /satisakoy <number>:
    permission: op
    trigger:
        set {_target} to targeted block
        if {_target} is not set:
            send "&cBakılan bir blok bulunamadı."
            stop
        set {_loc} to location of {_target}
        set {_key} to "%world of {_loc}%:%x of {_loc}%:%y of {_loc}%:%z of {_loc}%"
        set {blocks::%{_key}%::price} to arg-1
        set {blocks::%{_key}%::type} to type of {_target}
        send "&aBlok fiyatı ayarlandı: %{blocks::%{_key}%::price}%$"

on right click:
    if event-block is a block:
        set {_loc} to location of event-block
        set {_key} to "%world of {_loc}%:%x of {_loc}%:%y of {_loc}%:%z of {_loc}%"
        if {blocks::%{_key}%::price} is set:
            set {_price} to {blocks::%{_key}%::price}
            set {_storedType} to {blocks::%{_key}%::type}
            # Only sell if clicked block type matches stored type
            if type of event-block is {_storedType}:
                set {_balance} to balance of player
                if {_balance} >= {_price}:
                    remove {_price} from player's balance
                    give {_storedType} to player
                    send "&aSatın alındı! %{_price}%$ ödediniz." to player
                else:
                    send "&cYeterli paranız yok. Gerekli: %{_price}%$" to player
            else:
                send "&cBu blok satışa uygun değil." to player
        else:
            send "&cBu blok için fiyat ayarlanmamış." to player
 
Last edited: