Variables - comparison

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

    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!

Status
Not open for further replies.

temakan

Member
Jan 29, 2017
12
0
0
25
I tried to add block to variable {block.%event-block%.%player%} but it didn't work so i devised that on block place there will be variable {coords.%location%.%player%} and it works but how to make comparison
like: If player instanceof %player% then do something else do smth.
 
I tried to add block to variable {block.%event-block%.%player%} but it didn't work so i devised that on block place there will be variable {coords.%location%.%player%} and it works but how to make comparison
like: If player instanceof %player% then do something else do smth.
code_language.skript:
set {blocks::*} to block at location at player
# Set a variable to a block at a specific location. This example uses a list variable in case you want to add multiple blocks.

if {blocks::1} is event-block:
    send "That is a block."
    # Check if a block is one of the blocks saved to a variable later on in your script.
    # You could also use "if {blocks::*} contains ..." if you have multiple blocks saved to the same list variable.

set {players::*} to the player
# Set a list variable to a player, in case you want to add multiple players to the same variable.

if {players::1} is the player:
    send "That is a player."
    # Check if a player is one of the players saved to a variable later on in your script.
    # You could also use "if {players::*} contains ..." if you have multiple players saved to the same list variable.
 
code_language.skript:
set {blocks::*} to block at location at player
# Set a variable to a block at a specific location. This example uses a list variable in case you want to add multiple blocks.

if {blocks::1} is event-block:
    send "That is a block."
    # Check if a block is one of the blocks saved to a variable later on in your script.
    # You could also use "if {blocks::*} contains ..." if you have multiple blocks saved to the same list variable.

set {players::*} to the player
# Set a list variable to a player, in case you want to add multiple players to the same variable.

if {players::1} is the player:
    send "That is a player."
    # Check if a player is one of the players saved to a variable later on in your script.
    # You could also use "if {players::*} contains ..." if you have multiple players saved to the same list variable.

I wanna do something like this:

on place:
if event-block is something:
set event-block to {blocksowner.%player%}
stop

on break:
if player is equal to player-arg from blocksowner variable:
set block to 0
else:
set block to dirt
 
I wanna do something like this:

on place:
if event-block is something:
set event-block to {blocksowner.%player%}
stop

on break:
if player is equal to player-arg from blocksowner variable:
set block to 0
else:
set block to dirt
code_language.skript:
on place:
    add location of event-block to {owned.blocks::%uuid of player%::*}

on break:
    if {owned.blocks::%uuid of player%::*} does not contain location of event-block:
        cancel the event
Is that what you want? It currently only allows players to break blocks if they have placed them.
 
Last edited by a moderator:
@EDIT
[doublepost=1486157824,1485737088][/doublepost]
code_language.skript:
on place:
    add location of event-block to {owned.blocks::%uuid of player%::*}

on break:
    if {owned.blocks::%uuid of player%::*} does not contain location of event-block:
        cancel the event
Is that what you want? It currently only allows players to break blocks if they have placed them.

Does not work I tested it

@edit2
But i managed it and did like this:
on join:
if {password.%player%} is not set:
set {password.%player%} to "password.%player%"
else:
stop

on place:
if block is something:
set {password.%block%} to "%{password.%player%}%"

on break:
if {password.%block%} contains "%{password.%player%}%":
stop
else:
cancel event
send "Your f4ggot" to player
 
Last edited by a moderator:
Status
Not open for further replies.