Jump to content

Else if error


pnguin

Recommended Posts

Hi there! So i decided to make a sort of shop skript but if i add a else if it gives me an error

Heres the code and an error screenshot

command /rankshop:
	trigger:
		open virtual chest inventory with size 3 named "&b&l● &3&lRankShop &b&l●" to player
		format gui slot 10 of player with paper named "&8[&3ASTRONAUT&8] &3Rank" with lore " " and "&3&oNote:", "&3&oNo refunds will", "&3&obe made upon this", "&3&opurchase! Choose wisely!" to run:
			if {coins::%player's uuid%} < 25:
			send "{@nem}"
			else if {coins::%player's uuid%} >= 25:
				remove 25 from {coins::%player's uuid%}
				give player 16 oak slabs

2021-04-27_09_53_00.thumb.png.7ee90c3b241e1b9d4c0a7cf3cc65303a.png

I used to play Minehut I guess?
Yeah, I still watch the forums for some reason. (15/5/2023)
Link to comment
Share on other sites

spacing issue.

command /rankshop:
	trigger:
		open virtual chest inventory with size 3 named "&b&l● &3&lRankShop &b&l●" to player
		format gui slot 10 of player with paper named "&8[&3ASTRONAUT&8] &3Rank" with lore " " and "&3&oNote:", "&3&oNo refunds will", "&3&obe made upon this", "&3&opurchase! Choose wisely!" to run:
			if {coins::%player's uuid%} < 25:
				send "{@nem}"
			else if {coins::%player's uuid%} >= 25:
				remove 25 from {coins::%player's uuid%}
				give player 16 oak slabs

 

If I have helped you out in your post or you liked what I posted, please upvote and react to my post! It helps me a lot!

Some Minehut Links:

Server Rules • Staff Applications • News & Updates • Reports • Appeals


Minehut: VIP (07/04/2021 --> Current)
Elestra/Versa Realms: Manager (12/04/2021 --> Current)

If you have any questions contact me!
My Discord: BanditEagle#2481
My Spigot Profile: https://www.spigotmc.org/members/banditeagle.935281/
My IGN: BanditEagle

Link to comment
Share on other sites

13 minutes ago, BanditEagle said:

spacing issue.


command /rankshop:
	trigger:
		open virtual chest inventory with size 3 named "&b&l● &3&lRankShop &b&l●" to player
		format gui slot 10 of player with paper named "&8[&3ASTRONAUT&8] &3Rank" with lore " " and "&3&oNote:", "&3&oNo refunds will", "&3&obe made upon this", "&3&opurchase! Choose wisely!" to run:
			if {coins::%player's uuid%} < 25:
				send "{@nem}"
			else if {coins::%player's uuid%} >= 25:
				remove 25 from {coins::%player's uuid%}
				give player 16 oak slabs

 

Thanks for the help but if i like have enough money it doesnt give the item

I used to play Minehut I guess?
Yeah, I still watch the forums for some reason. (15/5/2023)
Link to comment
Share on other sites

oh you are using money?

You need to make sure you set {coins::%uuid of player%} to the player's balance when they join, like this:

on join:
	set {coins::%uuid of player%} to balance of player

or, if you are using a custom eco for coins, make sure you set {coins::%uuid of player%} and have a way of setting, increasing, and decreasing it so you can control the balance.

If I have helped you out in your post or you liked what I posted, please upvote and react to my post! It helps me a lot!

Some Minehut Links:

Server Rules • Staff Applications • News & Updates • Reports • Appeals


Minehut: VIP (07/04/2021 --> Current)
Elestra/Versa Realms: Manager (12/04/2021 --> Current)

If you have any questions contact me!
My Discord: BanditEagle#2481
My Spigot Profile: https://www.spigotmc.org/members/banditeagle.935281/
My IGN: BanditEagle

Link to comment
Share on other sites

4 minutes ago, BanditEagle said:

oh you are using money?

You need to make sure you set {coins::%uuid of player%} to the player's balance when they join, like this:


on join:
	set {coins::%uuid of player%} to balance of player

or, if you are using a custom eco for coins, make sure you set {coins::%uuid of player%} and have a way of setting, increasing, and decreasing it so you can control the balance.

On that on join i have an cant understand expression error

2021-04-27_11_00_08.thumb.png.217bb94c9eb798c86e519cf81a0be0a9.png

I used to play Minehut I guess?
Yeah, I still watch the forums for some reason. (15/5/2023)
Link to comment
Share on other sites

what plugins do you have on the server?

If I have helped you out in your post or you liked what I posted, please upvote and react to my post! It helps me a lot!

Some Minehut Links:

Server Rules • Staff Applications • News & Updates • Reports • Appeals


Minehut: VIP (07/04/2021 --> Current)
Elestra/Versa Realms: Manager (12/04/2021 --> Current)

If you have any questions contact me!
My Discord: BanditEagle#2481
My Spigot Profile: https://www.spigotmc.org/members/banditeagle.935281/
My IGN: BanditEagle

Link to comment
Share on other sites

I think you also need to have EssentialsX for the "balance of player" thing

If I have helped you out in your post or you liked what I posted, please upvote and react to my post! It helps me a lot!

Some Minehut Links:

Server Rules • Staff Applications • News & Updates • Reports • Appeals


Minehut: VIP (07/04/2021 --> Current)
Elestra/Versa Realms: Manager (12/04/2021 --> Current)

If you have any questions contact me!
My Discord: BanditEagle#2481
My Spigot Profile: https://www.spigotmc.org/members/banditeagle.935281/
My IGN: BanditEagle

Link to comment
Share on other sites

1 minute ago, BanditEagle said:

I think you also need to have EssentialsX for the "balance of player" thing

im using skripted eco though

I used to play Minehut I guess?
Yeah, I still watch the forums for some reason. (15/5/2023)
Link to comment
Share on other sites

even so, you will need to have essentialsx for it. try to download it and try with it

If I have helped you out in your post or you liked what I posted, please upvote and react to my post! It helps me a lot!

Some Minehut Links:

Server Rules • Staff Applications • News & Updates • Reports • Appeals


Minehut: VIP (07/04/2021 --> Current)
Elestra/Versa Realms: Manager (12/04/2021 --> Current)

If you have any questions contact me!
My Discord: BanditEagle#2481
My Spigot Profile: https://www.spigotmc.org/members/banditeagle.935281/
My IGN: BanditEagle

Link to comment
Share on other sites

1 minute ago, BanditEagle said:

even so, you will need to have essentialsx for it. try to download it and try with it

I dont want to though cuz it will probs override my skripted chat format

I used to play Minehut I guess?
Yeah, I still watch the forums for some reason. (15/5/2023)
Link to comment
Share on other sites

it wouldn't. If you want, temporarily disable it and download it and try with it.

If I have helped you out in your post or you liked what I posted, please upvote and react to my post! It helps me a lot!

Some Minehut Links:

Server Rules • Staff Applications • News & Updates • Reports • Appeals


Minehut: VIP (07/04/2021 --> Current)
Elestra/Versa Realms: Manager (12/04/2021 --> Current)

If you have any questions contact me!
My Discord: BanditEagle#2481
My Spigot Profile: https://www.spigotmc.org/members/banditeagle.935281/
My IGN: BanditEagle

Link to comment
Share on other sites

2 minutes ago, BanditEagle said:

it wouldn't. If you want, temporarily disable it and download it and try with it.

Now it does work but is there any option to do it without EssentialsX

I used to play Minehut I guess?
Yeah, I still watch the forums for some reason. (15/5/2023)
Link to comment
Share on other sites

1 minute ago, pizzaschut said:

Now it does work but is there any option to do it without EssentialsX

you would need to create a custom global variable [kind of like what you did with the coins thing] but you will need to use that. Personally, I would go with EssentialsX since it is more reliable and would cause in less data leaks, but it IS possible without it. It'll just be much more complicated, but it won't stop you.

If I have helped you out in your post or you liked what I posted, please upvote and react to my post! It helps me a lot!

Some Minehut Links:

Server Rules • Staff Applications • News & Updates • Reports • Appeals


Minehut: VIP (07/04/2021 --> Current)
Elestra/Versa Realms: Manager (12/04/2021 --> Current)

If you have any questions contact me!
My Discord: BanditEagle#2481
My Spigot Profile: https://www.spigotmc.org/members/banditeagle.935281/
My IGN: BanditEagle

Link to comment
Share on other sites

13 minutes ago, BanditEagle said:

you would need to create a custom global variable [kind of like what you did with the coins thing] but you will need to use that. Personally, I would go with EssentialsX since it is more reliable and would cause in less data leaks, but it IS possible without it. It'll just be much more complicated, but it won't stop you.

I used EssentialsX but even if i have enough skripted balance it says i dont have enough money

I used to play Minehut I guess?
Yeah, I still watch the forums for some reason. (15/5/2023)
Link to comment
Share on other sites

can you send your code?

If I have helped you out in your post or you liked what I posted, please upvote and react to my post! It helps me a lot!

Some Minehut Links:

Server Rules • Staff Applications • News & Updates • Reports • Appeals


Minehut: VIP (07/04/2021 --> Current)
Elestra/Versa Realms: Manager (12/04/2021 --> Current)

If you have any questions contact me!
My Discord: BanditEagle#2481
My Spigot Profile: https://www.spigotmc.org/members/banditeagle.935281/
My IGN: BanditEagle

Link to comment
Share on other sites

command /rankshop:
	trigger:
		open virtual chest inventory with size 3 named "&b&l● &3&lRankShop &b&l●" to player
		format gui slot 10 of player with paper named "&8[&3ASTRONAUT&8] &3Rank" with lore " " and "&3&oNote:", "&3&oNo refunds will", "&3&obe made upon this", "&3&opurchase! Choose wisely!" to run:
			if {coins::%player's uuid%} < 25:
				send "{@nem}"
			else if {coins::%player's uuid%} >= 25:
				remove 25 from {coins::%player's uuid%}
				give player 16 oak slabs

 

I used to play Minehut I guess?
Yeah, I still watch the forums for some reason. (15/5/2023)
Link to comment
Share on other sites

have you set {coins::%player's uuid} anywhere? if you did, send that as well and how you set it. if not, you need to set it.

If I have helped you out in your post or you liked what I posted, please upvote and react to my post! It helps me a lot!

Some Minehut Links:

Server Rules • Staff Applications • News & Updates • Reports • Appeals


Minehut: VIP (07/04/2021 --> Current)
Elestra/Versa Realms: Manager (12/04/2021 --> Current)

If you have any questions contact me!
My Discord: BanditEagle#2481
My Spigot Profile: https://www.spigotmc.org/members/banditeagle.935281/
My IGN: BanditEagle

Link to comment
Share on other sites

Just now, BanditEagle said:

have you set {coins::%player's uuid} anywhere? if you did, send that as well and how you set it. if not, you need to set it.

Wdym im kinda confused

I used to play Minehut I guess?
Yeah, I still watch the forums for some reason. (15/5/2023)
Link to comment
Share on other sites

right now you have {coins::%player's uuid} exist as a variable, but have you set it to any value at any point? For example, if you want to give players 50 coins when they first join, have you set that? Or do you have any command or function to set that variable to any value?

If I have helped you out in your post or you liked what I posted, please upvote and react to my post! It helps me a lot!

Some Minehut Links:

Server Rules • Staff Applications • News & Updates • Reports • Appeals


Minehut: VIP (07/04/2021 --> Current)
Elestra/Versa Realms: Manager (12/04/2021 --> Current)

If you have any questions contact me!
My Discord: BanditEagle#2481
My Spigot Profile: https://www.spigotmc.org/members/banditeagle.935281/
My IGN: BanditEagle

Link to comment
Share on other sites

1 minute ago, BanditEagle said:

right now you have {coins::%player's uuid} exist as a variable, but have you set it to any value at any point? For example, if you want to give players 50 coins when they first join, have you set that? Or do you have any command or function to set that variable to any value?

i have it like this

on join:
	set %{coins::player's uuid%} to 0

 

I used to play Minehut I guess?
Yeah, I still watch the forums for some reason. (15/5/2023)
Link to comment
Share on other sites

well if you have it set to 0, and you are not changing the value at all afterwards, then of course it will never be greater than 25. Also, if you set it to 0 everytime they join, that mean they will never make progress on their balance unless they are always on. You need to set that to 0 "on first join:" not "on join".

If I have helped you out in your post or you liked what I posted, please upvote and react to my post! It helps me a lot!

Some Minehut Links:

Server Rules • Staff Applications • News & Updates • Reports • Appeals


Minehut: VIP (07/04/2021 --> Current)
Elestra/Versa Realms: Manager (12/04/2021 --> Current)

If you have any questions contact me!
My Discord: BanditEagle#2481
My Spigot Profile: https://www.spigotmc.org/members/banditeagle.935281/
My IGN: BanditEagle

Link to comment
Share on other sites

On 4/27/2021 at 5:39 AM, pizzaschut said:

i have it like this


on join:
	set %{coins::player's uuid%} to 0

 

If you use on join, it will reset the player's coins everytime they relog. Also its set {coins::%player's uuid%} to 0. The extra percentage doesn't belong there. 

 

On 4/27/2021 at 5:33 AM, pizzaschut said:

command /rankshop:
	trigger:
		open virtual chest inventory with size 3 named "&b&l● &3&lRankShop &b&l●" to player
		format gui slot 10 of player with paper named "&8[&3ASTRONAUT&8] &3Rank" with lore " " and "&3&oNote:", "&3&oNo refunds will", "&3&obe made upon this", "&3&opurchase! Choose wisely!" to run:
			if {coins::%player's uuid%} < 25:
				send "{@nem}"
			else if {coins::%player's uuid%} >= 25:
				remove 25 from {coins::%player's uuid%}
				give player 16 oak slabs

 

Also instead of checking if player's balance is lower  than 25 than having an elseif statement to check if it more than 25, you can just use an else statement

if {coins::%player's uuid%} >= 25:
	# give stuff. player has enough money
else:
	send "You do not have 25 coins"

This makes it if the player has 25 or more coins, it will do the stuff where it shows the comment. But if not, it will just do the stuff in the else statement. An else if isn't required here. 

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

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
×
×
  • Create New...