player's balance

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

skanto123

Active Member
Jan 8, 2018
70
0
0
34
options:
chickenspawner = 52:61

on mine:
if event-block is {chickenspawner}:
if player's balance is more than or equal to 1000:
subtract 1000 from player's balance
cancel the event
drop 1 blaze spawner

http://prntscr.com/i5waqu

how do i make it so when a player mines a chicken spawner if he has 1k it takes 1k from him and drops the spawn
 
The first error is because you haven't indented properly. the next line after a colon had to be tabbed.
The second error is likely because you used "subtract" and not "remove"
try "remove 1000 from player's balance"
 
you just have to indent your line after the if statement, like this:
code_language.skript:
on script load:

  import "ch.njol.skript.entity.EntityData"

expression blocks property spawned type:

  loop expressions-1:

    set {_entity} to loop-value.getState().getSpawnedType()
    set {_entity} to {EntityData}.fromClass({_entity}.getEntityClass())
    add {_entity} to {_output::*}
  continue {_output::*}

expression item types property spawned type:

  if type of expressions-1 isn't mob spawner:
    stop
  loop expressions-1:

    set {_item} to loop-value.getRandom()
    set {_state} to {_item}.getItemMeta().getBlockState()
    set {_entity} to {EntityData}.fromClass({_state}.getSpawnedType().getEntityClass())
    add {_entity} to {_output::*}
  continue {_output::*}

get expression %entity type% spawner:

  set {_item} to mob spawner.getRandom()
  set {_meta} to {_item}.getItemMeta()
  set {_type} to expression-1.getType()
  set {_state} to {_meta}.getBlockState()

  {_state}.setSpawnedType({_type});
  {_meta}.setBlockState({_state});
  {_item}.setItemMeta({_meta});
  continue {_item}

on break of mob spawner:

  if spawned type of event-block is chicken:
    if player's balance is greater than 1000:
      remove 100 from player's balance
      cancel event
      drop 1 of blaze mob spawner
You need skript-mirror to use these custom syntaxes I added above.
 
Status
Not open for further replies.