Hey, what i`m doing wrong?

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

SynixTM

Member
Aug 22, 2024
1
0
1
I don`t even know what to do. Can someone help me?

ERROR CODE THAT IT GIVES:

[Skript] Line 2: (TeamSystem.sk)
Can't compare an entity with 'npc'
Line: if clicked entity is npc:

THE SCRIPT THAT I WANT TO MAKE:

on right click on entity:
if clicked entity is npc:
set {_npcId} to id of clicked entity
if {_npcId} is 0: # Territory Claim NPC (Marie)
if player's tool is sugar:
if difference between {last_sugar::%player%} and now is greater than 30 minutes:
remove 25 sugar from player
set {last_sugar::%player%} to now
set {_team} to "%{metadata value of player "team"}%"
add 1 to {territory::%{_team}%}
send "&aSa lisasid 1% oma tiimi territooriumile!" to player
broadcast "&bTiim %{_team}% on suurendanud oma territooriumi protsenti!" to all players
else:
send "&cSa pead ootama enne kui saad uuesti suhkrut anda!" to player
else:
send "&cSul peab olema suhkur käes, et territooriumi suurendada!" to player
if {_npcId} is 1: # Reward NPC (Tyrese)
set {_team} to "%{metadata value of player "team"}%"
if {territory::%{_team}%} is greater than or equal to 100:
give player 1 diamond
send "&aPalju õnne! Sinu tiim on vallutanud territooriumi!" to player
else:
send "&cSinu tiim ei ole veel piisavalt protsente kogunud!" to player

every 1 minute:
set {_totalPercent} to 0
loop {territory::*}:
add loop-value to {_totalPercent}

loop {territory::*}:
set {_newPercent} to (loop-value / {_totalPercent}) * 100
set {territory::%loop-index%} to {_newPercent}

broadcast "&aTerritooriumi protsendid on uuendatud!"

command /territory:
trigger:
set {_team} to "%{metadata value of player "team"}%"
send "&aSinu tiimil on hetkel %{territory::%{_team}%}% territooriumist."

command /resetterritory:
permission: op
trigger:
delete {territory::*}
send "&cKõik territooriumid on lähtestatud!" to all players