Comparison returning false, even though everything looks correct

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

TACStudios

Member
Apr 21, 2025
10
0
1
In a previous post I mentioned doing "spleef checks" (checking if one player spleef'd andother)

I tried to impliment this, but it doesnt work. Heres the code im using:

Script 1:
Code:
on walking on snow block:
  name of player's world is "combatspleef":
    if {pvsGameStarted} is false:
      stop
    if {pvsGameStarted} is true:
      set {lastWakedSnow.%event-player%} to "%x-coord of event-block%, %y-coord of event-block%, %z-coord of event-block%"
      broadcast "%event-player% walked on %{lastWakedSnow.%event-player%}%"
     
on server tick start:
  loop all players:
    if name of loop-value's world is "combatspleef":
      if loop-value is in water:
        set {_victim} to loop-value
        loop all players:
          set {_attacker} to loop-value-1
          contains({brokenBlocks.%{_attacker}%::*}, %{lastWalkedSnow.%{_victim}%}%) is true:
            broadcast "%{_attacker}% spleef'd %{_victim}%"

on break:
  name of event-player's world is "combatspleef":
    {pvsGameStarted} is false:
      player has permission "op":
        stop
      cancel event
  {pvsGameStarted} is true:
    add "%x-coord of event-block%, %y-coord of event-block%, %z-coord of event-block%" to {brokenBlocks.%event-player%::*}
    broadcast "%event-player% broke %{brokenBlocks.%event-player%::*}%"
    wait 10 seconds
    remove "%x-coord of event-block%, %y-coord of event-block%, %z-coord of event-block%" from {brokenBlocks.%event-player%::*}

Script 2
Code:
function contains(list: objects, check: object) :: boolean:
  loop {_list::*}:
    if location at block of loop-value is location at block of {_check}:
      broadcast "Check has passed"
      return true
  broadcast "Check has failed"
  return false


All of the correct variables get set, everything is running, but the check is failing. I even check that the locations that are getting compared are the *exact same*, and they are

I have no idea why this is happening, any help is appreciated
 
Last edited:
You’re comparing location and location in contains function
But list itself and “check” object contains only “x,y,z”
Try just:
Code:
if loop-value contains {_check}: