Jump to content

Function Shop Not Working


AgentGamerPro
 Share

Recommended Posts

function BuyDirt(p: player):
	if {DirtPurchased.%{_p}%} is not set: # makes it so you can only purchase once
		if {balance::%{_p}'s uuid%} >= 20000: # check if player has sufficent balance
			set {DirtPurchased.%{_p}%} to true # makes it so you can only purchase once
			remove 20000 from {balance::%{_p}'s uuid%} # removes money from balance
			make console execute command "SetBooster %{_p}% 2" # sets players boost from console
		else:
			send "&4&lError: &cInsufficent Balance!" to {_p} # message saying not enough money
	else:
		send "&4&lError: &cYou already purchased this!" to {_p} # message saying already purchase

Im having trouble with this. When i click a GUI item its supposed to do this, yet it dosent. Heres the line:
 

format slot 0 of player with dirt named "&7&lDirt Boost" with lore "&7This booster multiplys", "&7money by 2!" and "&6Cost: 20000" to run [set {DirtPP.%player%} to true]

 

Edited by AgentGamerPro

rsz_11eeeee.png.ab648d36415ac6b046b203554d1a054d.pngyes.PNG.1253f2798cf9bfd3dbbb7385af5885ed.PNG

[VIP] 12/26/20 - Present

Link to comment
Share on other sites

You need to do set {_u} to {_p}'s uuid and use {balance::%{_u}%} instead. You have to do this when getting the uuid of a variable in another variable. In your skript, you use {balance::%{_p}'s uuid%}. Change it to what I said and it should fix it. 

  • Thanks 1

Discord - Tarna256#8675

In-game name - _Tarna_

---------------------------------------------------------

[VIP] - 7/27/2020

Support - 7/8/20 | 11/3/20

Helper  - 11/3/20 - 2/21/21

Moderator - 2/21/21 - 5/17/21

---------------------------------------------------------
image.png.2111009afbd8bef10966ba9ede35a199.pngimage.png.70849a9b84e0347ce107b8e3eaee312c.png
 

Link to comment
Share on other sites

10 hours ago, _Tarna_ said:

You need to do set {_u} to {_p}'s uuid and use {balance::%{_u}%} instead. You have to do this when getting the uuid of a variable in another variable. In your skript, you use {balance::%{_p}'s uuid%}. Change it to what I said and it should fix it. 

I have another question tho. How do i call for a function in a function?
Here are my 2 peices of skript:
(first one is in a function)

format slot 11 of {_p} with wooden sword named "&f&lWooden Sword" with lore "" and "&6300 Coins" to close then run [BuyWoodSword({_p})]
function BuyWoodSword(p: player):
	set {_u} to uuid of {_p}
	if {balance::%{_u}%} >= 300:
		remove 300 from {balance::%{_u}%}
		give wooden sword to {_p}
		send "&aSuccessfully purchased &2Wooden Sword!" to {_p}
	else:
		send "&4&lError: &cInsufficent Balance!" to {_p}

 

rsz_11eeeee.png.ab648d36415ac6b046b203554d1a054d.pngyes.PNG.1253f2798cf9bfd3dbbb7385af5885ed.PNG

[VIP] 12/26/20 - Present

Link to comment
Share on other sites

  • 3 weeks later...
On 12/17/2020 at 8:13 PM, AgentGamerPro said:

I have another question tho. How do i call for a function in a function?
Here are my 2 peices of skript:
(first one is in a function)


format slot 11 of {_p} with wooden sword named "&f&lWooden Sword" with lore "" and "&6300 Coins" to close then run [BuyWoodSword({_p})]

function BuyWoodSword(p: player):
	set {_u} to uuid of {_p}
	if {balance::%{_u}%} >= 300:
		remove 300 from {balance::%{_u}%}
		give wooden sword to {_p}
		send "&aSuccessfully purchased &2Wooden Sword!" to {_p}
	else:
		send "&4&lError: &cInsufficent Balance!" to {_p}

 

Just do functionname(params) inside of said function

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share



×
×
  • Create New...