Jump to content

Problem with executing /give with display names


Vantant

Recommended Posts

I have been having problems trying to find out what the problem with this skript piece as when I reload it it says the 3rd line has an error with something. Is anything spelt wrong? Is there more code to add? Is there less code to have? I don't know.

Heres the skript:

on rightclick with coal:
    if name of tool of player is "&7specific name":
        execute console command "/give %player% gold_nugget {display:{Name:[{"text":"specific name 2"}]}}"

Link to comment
Share on other sites

Here, try this:

on right click:
  if player's tool is coal named "&7NAME":
    give player gold nugget named "&7NAME 2"

I think this is what you were going for. It will give the player a gold nugget named name 2 if they right click using the coal named name 1

alternatively, you could do this: 

on right click:
  if player's tool is coal named "&7NAME"
    set {_name} to name of player's tool
    give player gold nugget named "%{_name}%"

What this will do is give the player a gold nugget with the same name as the coal (I haven't tested this so it may not work)

Edited by coatedterror439
Link to comment
Share on other sites

on rightclick on coal:
	if name of player's held item is "name here":
		give player 1 gold nugget named "name here"

 

— OMBS —

Hello. I am ombs, a chill server developer and FPS enthusiast.

Currently working on a server with a queue-style arena PVP.

Battle500 is my completed server. 
 

Have a great day!

 

Link to comment
Share on other sites

On 2/6/2022 at 11:22 PM, Vantant said:

I have been having problems trying to find out what the problem with this skript piece as when I reload it it says the 3rd line has an error with something. Is anything spelt wrong? Is there more code to add? Is there less code to have? I don't know.

Heres the skript:

on rightclick with coal:
    if name of tool of player is "&7specific name":
        execute console command "/give %player% gold_nugget {display:{Name:[{"text":"specific name 2"}]}}"

Use:

make console execute command

instead of 

execute console command

Hope this helps!

Main MC account: Gam3rBoi (VIP in MH)

Alt MC account: *Gam3rBoi2147

Farcade server owner

Skripter with 6+ months experience + time learning coding concepts

Message me through the forums if you need anything!

Link to comment
Share on other sites

21 minutes ago, Disvand said:

execute is the same thing...

Oh. Good to know.

On 2/6/2022 at 11:22 PM, Vantant said:

I have been having problems trying to find out what the problem with this skript piece as when I reload it it says the 3rd line has an error with something. Is anything spelt wrong? Is there more code to add? Is there less code to have? I don't know.

Heres the skript:

on rightclick with coal:
    if name of tool of player is "&7specific name":
        execute console command "/give %player% gold_nugget {display:{Name:[{"text":"specific name 2"}]}}"

You do need to take away the space in between gold_nugget and {display}: gold_nugget{display:{N...

Also, make sure you formatted the custom name of the item in the give command correctly. Or you could use the examples above for a simple skript item.

Main MC account: Gam3rBoi (VIP in MH)

Alt MC account: *Gam3rBoi2147

Farcade server owner

Skripter with 6+ months experience + time learning coding concepts

Message me through the forums if you need anything!

Link to comment
Share on other sites

1 hour ago, Gam3rBoi said:

Oh. Good to know.

You do need to take away the space in between gold_nugget and {display}: gold_nugget{display:{N...

Also, make sure you formatted the custom name of the item in the give command correctly. Or you could use the examples above for a simple skript item.

he needs to remove the / on the console command, console commands dont use slashes

Vip: 20/12/2021

Skript is fun, I am currently working on SkChat and making stuff for market rank!

| NEWEST VERSION |

https://forums.minehut.com/topic/51451-skchat-v11-release/

1335430724_SkChatLogo.jpg.8d5d2c23ac226fcb4cd300eccd8f07c3.jpg

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