Need help with detecting player 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 our Wiki for downloads and any other information about Skript!

Status
Not open for further replies.

Contridiction

Member
May 7, 2020
8
0
1
23
I'm trying to make a skript to which once you right click a block it takes an amount of money from the player and then gives you a different block
the player balance should not be able to go negative though, if you could please help me that would be greatly appreciated!

I have this code but it doesnt work:

on rightclick of glass block:
if player's money is more than or equal to 2000:
execute console command "/eco take %player% 2000!"
remove event-block's location from {generator::1::*}
set event-block to air
give glass block named "&9Block Level 2" to player
stop
else:
send action bar "{@prefix} You Do Not Have Enough Money For This!" to player
 
Last edited:
When executing console commands, you should not put "/" in, as the console automaticly does that.
So am I correct in saying that, your issue is the money is not deducted from the players balance?
 
When executing console commands, you should not put "/" in, as the console automaticly does that.
So am I correct in saying that, your issue is the money is not deducted from the players balance?
So im very new to scripts and i really just dont know how to code it, so im asking for help on the forum so i can figure out if my code would work for the task that needs to be done... the code did not work in general so i really need help on this
 
this should work
Code:
on mine:
    if player's balance > 1999
        execute console command "eco take %player% 2000!"
        remove location of event-block from {generator::1::*}
        set event-block to air
        give glass block named "&9Block Level 2" to player
        stop
    else:
        send action bar "{@prefix} You Do Not Have Enough Money For This!" to player
 
this should work
Code:
on mine:
    if player's balance > 1999
        execute console command "eco take %player% 2000!"
        remove location of event-block from {generator::1::*}
        set event-block to air
        give glass block named "&9Block Level 2" to player
        stop
    else:
        send action bar "{@prefix} You Do Not Have Enough Money For This!" to player
Thank you so much for helping me I really appreciate it
 
this should work
Code:
on mine:
    if player's balance > 1999
        execute console command "eco take %player% 2000!"
        remove location of event-block from {generator::1::*}
        set event-block to air
        give glass block named "&9Block Level 2" to player
        stop
    else:
        send action bar "{@prefix} You Do Not Have Enough Money For This!" to player
how would i make it so when I right click on a glass block it the code runs
 
Rightclick on a normal glass block
Code:
on right click on grass:
    if player's balance > 1999
        execute console command "/eco take %player% 2000!"
        remove location of event-block from {generator::1::*}
        set event-block to air
        give glass block named "&9Block Level 2" to player
        stop
    else:
        send action bar "{@prefix} You Do Not Have Enough Money For This!" to player
 
Code:
on right click on grass:
    if player's balance > 1999
        execute console command "/eco take %player% 2000!"
        remove location of event-block from {generator::1::*}
        set event-block to air
        give glass block named "&9Block Level 2" to player
        stop
    else:
        send action bar "{@prefix} You Do Not Have Enough Money For This!" to player
nothing happens when i right click the block
 
Ohh pardon me, remove the "/" in the console command, i forgot to remove that.. xD
 
this is better than the balance check code.
Code:
if balance of player >= 2000:
so what it does it checks if its 2000 or more sometimes there is decimals idk
 
this is better than the balance check code.
Code:
if balance of player >= 2000:
so what it does it checks if its 2000 or more sometimes there is decimals idk
Thanks
[doublepost=1588836158,1588835865][/doublepost]
this is better than the balance check code.
Code:
if balance of player >= 2000:
so what it does it checks if its 2000 or more sometimes there is decimals idk
my code is


options:
prefix: Server -
cooldown: 5 seconds
item: paper



variables:
{generator::1::*} = none

every {@cooldown}:
drop 1 {@item} named "&6Cash &7(&e+1$)" 0.5 meters above {generator::1::*}


#Adds the blocks location so that items will spawn on top of it

on place glass block:
add event-block's location to {generator::1::*}
send action bar "{@prefix} You placed a level 1 generator" to player


#Removes the blocks location so that items will not spawn on top of it


on break of glass block:
if {generator::1::*} contains event-block's location:
cancel event
remove event-block's location from {generator::1::*}
send action bar "{@prefix} You removed a level 1 generator" to player
set event-block to air
give glass block named "&9Generator Level 1" to player
stop


on right click on glass block:
if balance of player >= 2000:
execute console command "eco take %player% 2000"
remove location of event-block from {generator::1::*}
set event-block to air
give glass block named "&9Generator Level 2" to player
stop
else:
send action bar "{@prefix} You Do Not Have Enough Money For This!" to player


but the right click function still doesnt seem to work is there a reason why?
 
please use the code format
upload_2020-5-7_9-23-31.png
 
Status
Not open for further replies.