#execute console command function

1 messages · Page 1 of 1 (latest)

spiral hinge
#

how do i execute console comands in a function, this is my code

function ocelotbuybuy(p: player):
execute console command "/give %player% minecraft:player_head{display:{Name:"{"text":"Ocelot Pet"}"},SkullOwner:{Id:[I;1044976568,1986609309,-1614770531,1138340903],Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTE4Zjc3MzMxYjJjYWI2NGUyYjQzMGZhOGU0MjczZTRkYjdmNzhmY2RmYTRiMWE5YTQxOGFmNDczNzUwNTZlYiJ9fX0="}]}}} 1"
execute console command "/clear %player% diamond{display:{Name:'{"text":"Token","color":"gold","bold":true,"italic":true}'}} 1"

an it doesnt work

#

@here

sonic dune
#

Double quotes in strings

#

Also pinging here doesn’t do anything

spiral hinge
#

ok

spiral hinge
sonic dune
#

Double your quotes if you wanna use them in a string

spiral hinge
#

??? WDYM WITH THAT

sonic dune
#

You should use double quotes whenever you wanna put them in a string

#

If you don’t know what a string is go watch a tutorial because this is really basic coding stuff

spiral hinge
#

wait

#

here i wanna use this

on inventory click:
if name of event-inventory is "&5Buy Pet":

    if event-inventory is player's inventory:

        stop
    cancel event


    if clicked slot is 2:
        ocelotbuybuy(player)
#

at "if clicked slot is"

#

but it doesnt work

sonic dune
#

Too bad

spiral hinge
#

too bad what

sonic dune
#

Too bad that it doesn’t work