Jump to content

[!] Need help making a custom sell command!


Sythical

Recommended Posts

Hello.

Recently, I have began development on my new skyblock server. I have gotten way better at skript ever since I started this project, but I still have no idea how to create a custom /sell command.
What I want the command to do is when you do /sell, the skript checks all the items in your inventory and if one of your items matches the skripts variables, you sell it for a custom amount.

And, for people that buy ranks, they get a multiplier. For example, (1,3x 1.5x 1.7x 2.0x).

Any help would be greatly appreciated.

Link to comment
Share on other sites

command /sell:
	trigger:
		set {_s} to amount of stone in player's inventory
		add {_s}*10*{multi::%player's uuid%} to {money::%player's uuid%} and {_total}
		send "You have sold all your stuff for $%{_total}%"

Here is an example of how you can make a sell command. I added it to the money variable and a local total variable so you can display how much you sold everything for. And what do you mean by if the item matches the skript variables? Are you going to have a variable for the prices of each items? You can just use that variable instead of putting 10 like I did in the skript. Also if you want it to say like you have no items to sell, you could check if {_total} is 0 and send that messages instead of the other one. 

Discord - tarna256

In-game name - _Tarna_

Website - https://tarna.dev
Paste Site: https://paste.tarna.dev

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

[VIP] - 7/27/2020

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

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

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

❤️ - 5/17/21 - now

Moderator - 12/20/22 - now

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

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

Link to comment
Share on other sites

35 minutes ago, _Tarna_ said:

command /sell:
	trigger:
		set {_s} to amount of stone in player's inventory
		add {_s}*10*{multi::%player's uuid%} to {money::%player's uuid%} and {_total}
		send "You have sold all your stuff for $%{_total}%"

Here is an example of how you can make a sell command. I added it to the money variable and a local total variable so you can display how much you sold everything for. And what do you mean by if the item matches the skript variables? Are you going to have a variable for the prices of each items? You can just use that variable instead of putting 10 like I did in the skript. Also if you want it to say like you have no items to sell, you could check if {_total} is 0 and send that messages instead of the other one. 

Hey, could you explain what this line does?
add {_s}*10*{multi::%player's uuid%} to {money::%player's uuid%} and {_total}

Link to comment
Share on other sites

6 minutes ago, Sythical said:

Hey, could you explain what this line does?
add {_s}*10*{multi::%player's uuid%} to {money::%player's uuid%} and {_total}

{_s} holds the amount of stone the player has. and 10 is the price for each stone so it multiplies the amount of stone by the price. Then you said you also wanted a multi for players. So the variable {multi::%player's uuid%} can hold a number like 2 for a 2x multi. So it will also multiple it by 2 so the cost of the stone goes higher. Then it gets added to the player's money, which is {money::%player's uuid%}. You can change the variable to what ever your economy variable is. And it also gets added to {_total} so at the end, you can display how much you sold everything for since you will have multiple things to sell. 

Discord - tarna256

In-game name - _Tarna_

Website - https://tarna.dev
Paste Site: https://paste.tarna.dev

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

[VIP] - 7/27/2020

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

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

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

❤️ - 5/17/21 - now

Moderator - 12/20/22 - now

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

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

Link to comment
Share on other sites

1 minute ago, _Tarna_ said:

{_s} holds the amount of stone the player has. and 10 is the price for each stone so it multiplies the amount of stone by the price. Then you said you also wanted a multi for players. So the variable {multi::%player's uuid%} can hold a number like 2 for a 2x multi. So it will also multiple it by 2 so the cost of the stone goes higher. Then it gets added to the player's money, which is {money::%player's uuid%}. You can change the variable to what ever your economy variable is. And it also gets added to {_total} so at the end, you can display how much you sold everything for since you will have multiple things to sell. 

Wow, thank you so much! Do you mind if I add your discord? I want to continue the skript and if I'm stuck I'll probably need some help.

Link to comment
Share on other sites

2 minutes ago, Sythical said:

Wow, thank you so much! Do you mind if I add your discord? I want to continue the skript and if I'm stuck I'll probably need some help.

Sure. You can message me if you need help with anything else. You can also join the Minehut Discord and ask for skript help there in the skript channel.

discord.gg/minehut

Discord - tarna256

In-game name - _Tarna_

Website - https://tarna.dev
Paste Site: https://paste.tarna.dev

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

[VIP] - 7/27/2020

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

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

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

❤️ - 5/17/21 - now

Moderator - 12/20/22 - now

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

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

Link to comment
Share on other sites

  • 7 months later...
  • 1 month later...
Guest
This topic is now closed to further replies.
×
×
  • Create New...