whimsical_puppy_88613
📎 1 file 2,944 chars
📄
pasted-code-1789286415116.txt
txt 1 lines
▶
أريد منك إنشاء سكربت بلغة Skript لسيرفر Minecraft Java يعمل على Aternos. أريد نظام اسمه Kill Sword، والتفاصيل كالتالي: 1. عندما يدخل أي لاعب السيرفر، يحصل تلقائيًا على Wooden Sword خاص بالنظام، حتى لو كان أول مرة يدخل أو رجع للسيرفر بعد الموت. 2. السيف الخاص بالنظام يكون اسمه: &6Kill Sword 3. كلما قتل اللاعب لاعبًا آخر وهو ماسك سيف Kill Sword، يزيد عداد قتلاته بمقدار 1. 4. تطور السيف يكون كل قتله: - 0 إلى 1 قتلة = Wooden Sword - بعد قتله = Stone Sword - بعد 2 قتلات = Iron Sword - بعد 3 قتلات = Diamond Sword - بعد 4 قتلات = Netherite Sword يعني يحتاج اللاعب 4 قتلات بالمجموع حتى يصل إلى Netherite. 5. عندما يصل اللاعب إلى Netherite بعد القتلة رقم 4، تفتح أمامه قائمة GUI ولا أريد أن يستطيع إغلاقها بدون اختيار قدرة. القائمة تحتوي على 3 اختيارات: الخيار الأول: 🪶 Feather الاسم: DASH الوصف: اندفاع سريع للأمام. إذا اختار DASH: - تصبح قدرة اللاعب Dash. - عندما يمسك Netherite Kill Sword ويضغط Right Click، يندفع اللاعب إلى الأمام. - أريد أن يرتفع اللاعب قليلًا أثناء الـDash. - ضع كولداون للـDash مدته 20 { ادا استعملها يضهر التايمر على السورد يصير كدا ف الهوتبار بلور مغطيه وينزل هدا البلور تدريجي لين يلخص التايمر هدي الميزه تطبق على قدره التصغير برضو } حتى لا يستطيع استخدامه بشكل متكرر بسرعة. الخيار الثاني: 📖 Enchanted Book الاسم: SHARPNESS VI إذا اختارها: - يحصل Kill Sword على Sharpness VI. - لا تظهر قائمة الاختيارات مرة أخرى. الخيار الثالث: 🧪 Potion الاسم: SHRINK إذا اختارها: - تصبح لديه قدرة التصغير. - عندما يكون اللاعب Sneaking (يضغط Shift) ثم يضغط Right Click باستخدام Netherite Kill Sword، يصغر حجم اللاعب. - أريد أن يكون حجمه تقريبًا 0.5 من الحجم الطبيعي. - يستمر التصغير لمدة 20 ثوانٍ { يضهر له التايمر }. - بعدها يرجع لحجمه الطبيعي. - ضع كولداون مناسب حتى لا يستطيع استخدام القدرة بشكل متكرر. - لا يحتاج إلى أي Reach. 6. مهم جدًا: عندما تظهر قائمة اختيار القدرة بعد الوصول إلى Netherite، لا أريد أن يستطيع اللاعب إغلاق القائمة بزر ESC أو بأي طريقة بدون اختيار قدرة. إذا حاول إغلاقها، يجب أن تفتح القائمة مرة أخرى تلقائيًا حتى يختار إحدى القدرات الثلاث. 7. عندما يموت اللاعب: - يتم تصفير عدد قتلاته إلى 0. - يرجع مستوى السيف إلى Wooden. - يتم حذف القدرة التي اختارها. - يرجع اللاعب بعد الـRespawn ومعه Wooden Kill Sword. - يبدأ من جديد ويحتاج 8 قتلات للوصول إلى Netherite. - مهم جدًا: سيف Kill Sword لا يجب أن يسقط على الأرض عند موت اللاعب. - أي سيف Kill Sword موجود في Drops يجب حذفه من الـDrops. - لا أريد أن يمنع السكربت سقوط باقي أغراض اللاعب، فقط Kill Sword. 8. إذا خرج اللاعب من السيرفر ثم رجع: - لا يتم تصفير تقدمه. - يحتفظ بعدد قتلاته ومستوى السيف وقدرته. - إذا كان عنده Kill Sword أصلًا، لا تعطه سيفًا ثانيًا. 9. أريد السكربت يعمل بدون SkBee إذا كان ذلك ممكنًا. إذا كانت هناك وظيفة لا يمكن تنفيذها في Skript العادي، استخدم أبسط طريقة متوافقة مع Minecraft Java 1.21.11 وAternos. 10. أريد منك في النهاية أن تعطيني: - ملف .sk جاهز. - وتأكد أن صيغة السكربت متوافقة مع Skript. - اكتب لي أيضًا أسماء الـAddons المطلوبة إن كانت ضرورية. - لا تستخدم Reach نهائيًا. - لا تجعل قائمة اختيار القدرة قابلة للإغلاق قبل الاختيار.
Kodari AI
KodariSep 13 at 8:02 am 1
KillSwordSystem
A Minecraft Skript plugin for Aternos servers. Players receive a special Kill Sword on spawn, which upgrades from Wooden to Netherite through 4 kills. Upon reaching Netherite, a forced GUI appears with three ability choices: DASH (forward dash with cooldown), SHARPNESS VI (sword enchant), or SHRINK (size reduction for 20 seconds). Progress persists across sessions but resets on death, with the Kill Sword never dropping on the ground. The system prevents GUI closure without selection and works without SkBee.

المطلوب فقط هو إضافة ملف kill-sword.sk إلى:

Plain Text
plugins/Skript/scripts/

ثم تنفيذ:

Plain Text
/sk reload kill-sword

الإضافات المطلوبة: لا توجد إضافات؛ السكربت يستخدم Skript فقط. يعتمد التصغير على أمر Minecraft الأصلي الخاص بـ minecraft:scale.

Kodari can make mistakes. Review important code before using.
Files
kill-sword.sk
Code
1 206
kill-sword.sk
# Kill Sword
# Requires: Skript 2.9+ on Minecraft Java 1.21.x
# No addon is required.

options:
    sword-name: &6Kill Sword
    menu-title: &8Kill Sword - Choose Ability

function makeKillSword(p: player) :: item:
    set {_kills} to {ks.kills::%uuid of {_p}%}
    set {_ability} to {ks.ability::%uuid of {_p}%}

    if {_kills} is not set:
        set {_kills} to 0

    if {_kills} <= 0:
        set {_sword} to wooden sword named "{@sword-name}"
    else if {_kills} = 1:
        set {_sword} to stone sword named "{@sword-name}"
    else if {_kills} = 2:
        set {_sword} to iron sword named "{@sword-name}"
    else if {_kills} = 3:
        set {_sword} to diamond sword named "{@sword-name}"
    else:
        set {_sword} to netherite sword named "{@sword-name}"

    set lore of {_sword} to "&7Kills: &f%{_kills}%"
    add "&7Ability: &f%{_ability}%" to lore of {_sword}

    if {_ability} is "SHARPNESS VI":
        enchant {_sword} with sharpness 6

    return {_sword}

function hasKillSword(p: player) :: boolean:
    loop all items in {_p}'s inventory:
        if loop-item is not air:
            if name of loop-item is "{@sword-name}":
                return true
    return false

function giveKillSword(p: player):
    give makeKillSword({_p}) to {_p}

function openKillMenu(p: player):
    open chest inventory with 1 row named "{@menu-title}" to {_p}
    wait 1 tick

    if {_p} is online:
        set slot 2 of {_p}'s current inventory to feather named "&e🪶 DASH" with lore "&7اندفاع سريع إلى الأمام."
        set slot 4 of {_p}'s current inventory to enchanted book named "&bSHARPNESS VI" with lore "&7يحصل Kill Sword على Sharpness VI."
        set slot 6 of {_p}'s current inventory to potion named "&d🧪 SHRINK" with lore "&7تصغير الحجم إلى 0.5 لمدة 20 ثانية."

on join:
    set {_id} to uuid of player

    if {ks.kills::%{_id}%} is not set:
        set {ks.kills::%{_id}%} to 0

    if hasKillSword(player) is false:
        giveKillSword(player)

    if {ks.kills::%{_id}%} >= 4:
        if {ks.ability::%{_id}%} is not set:
            wait 2 ticks
            if player is online:
                openKillMenu(player)

on respawn:
    wait 1 tick

    loop all items in player's inventory:
        if loop-item is not air:
            if name of loop-item is "{@sword-name}":
                remove loop-item from player's inventory

    giveKillSword(player)

on quit:
    set {_id} to uuid of player

    if {ks.shrinking::%{_id}%} is set:
        execute console command "attribute %player% minecraft:scale base set 1"
        delete {ks.shrinking::%{_id}%}

on death of player:
    set {_id} to uuid of player

    set {ks.kills::%{_id}%} to 0
    delete {ks.ability::%{_id}%}
    delete {ks.cooldown::%{_id}%}
    delete {ks.shrinking::%{_id}%}

    execute console command "attribute %player% minecraft:scale base set 1"

    loop drops:
        if loop-item is not air:
            if name of loop-item is "{@sword-name}":
                remove loop-item from drops

on death of player:
    if attacker is a player:
        set {_killer} to attacker
        set {_killer-id} to uuid of {_killer}

        if name of {_killer}'s tool is "{@sword-name}":
            if {ks.kills::%{_killer-id}%} is not set:
                set {ks.kills::%{_killer-id}%} to 0

            add 1 to {ks.kills::%{_killer-id}%}
            set {_kills} to {ks.kills::%{_killer-id}%}

            set {_killer}'s tool to makeKillSword({_killer})

            if {_kills} >= 4:
                if {ks.ability::%{_killer-id}%} is not set:
                    wait 1 tick
                    if {_killer} is online:
                        openKillMenu({_killer})

on right click:
    if name of player's tool is not "{@sword-name}":
        stop

    set {_id} to uuid of player

    if {ks.kills::%{_id}%} < 4:
        stop

    if {ks.ability::%{_id}%} is not set:
        openKillMenu(player)
        stop

    if {ks.ability::%{_id}%} is "SHRINK":
        if player is not sneaking:
            stop

    if {ks.cooldown::%{_id}%} is set:
        if difference between now and {ks.cooldown::%{_id}%} is less than 20 seconds:
            send action bar "&cKill Sword ability is on cooldown." to player
            stop

    set {ks.cooldown::%{_id}%} to now
    set item cooldown of player's tool for player to 20 seconds

    if {ks.ability::%{_id}%} is "DASH":
        push player forwards at speed 1.35
        push player upwards at speed 0.35

        loop 20 times:
            wait 1 second
            if {_id} is set:
                if {ks.cooldown::%{_id}%} is set:
                    if loop-number < 20:
                        send action bar "&6Kill Sword &7Cooldown: &e%20 - loop-number% seconds" to player

        delete {ks.cooldown::%{_id}%}
        stop

    if {ks.ability::%{_id}%} is "SHRINK":
        set {ks.shrinking::%{_id}%} to true
        execute console command "attribute %player% minecraft:scale base set 0.5"

        loop 20 times:
            wait 1 second

            if player is online:
                if {ks.cooldown::%{_id}%} is set:
                    if loop-number < 20:
                        send action bar "&dShrink &7Remaining: &e%20 - loop-number% seconds" to player

        execute console command "attribute %player% minecraft:scale base set 1"
        delete {ks.shrinking::%{_id}%}
        delete {ks.cooldown::%{_id}%}

on inventory click:
    if name of event-inventory is "{@menu-title}":
        cancel event

        if clicked slot is 2:
            set {ks.ability::%uuid of player%} to "DASH"
            send "&aYour Kill Sword ability is now &eDASH&a." to player
            close player's inventory

        else if clicked slot is 4:
            set {ks.ability::%uuid of player%} to "SHARPNESS VI"
            set player's tool to makeKillSword(player)
            send "&aYour Kill Sword now has &bSharpness VI&a." to player
            close player's inventory

        else if clicked slot is 6:
            set {ks.ability::%uuid of player%} to "SHRINK"
            send "&aYour Kill Sword ability is now &dSHRINK&a." to player
            close player's inventory

on inventory drag:
    if name of event-inventory is "{@menu-title}":
        cancel event

on inventory close: