command /givepistol [<player>]:
permission: op
description: Gives gun
trigger:
execute console command "give %arg-1% minecraft:carrot_on_a_stick{CustomModelData:1,display:{Name:'{\"text\":\"Pistol\",\"color\":\"white\"}'}} 1"
give 64 gold nuggets named "&6Pistol Ammo" to the player
might work
I fixed it by setting a variable to the result of the function then using that in the string instead.
Example:
set {_genCost} to getGenCost()
set slot 10 of {_gui} to white stained glass named "&rTier 1 Generator (&a$%{_genCost}%&r)"
Now I get this:
[08:55:57 INFO]: [Skript] Reloading buyGen.sk...
[08:55:57 INFO]: Line 19: (buyGen.sk)
[08:55:57 INFO]: This function doesn't return any value. Please use 'stop' or 'exit' if you want to stop the function.
[08:55:57 INFO]: Line: return "{@cost}"
[08:55:57 INFO]:
[08:55:57 INFO]: [Skript] Encountered 1 error while reloading buyGen.sk! (7ms)
For some reason all the items have <none> as the cost (example: "Tier 1 Generator ($<none>)"
I don't have much experience with functions in skript, so I don't know why it's happening.
command /servershop:
permission: wirednetwork.servershop
permission message: &cYou don't have permission to run this command.
executable by: players
trigger:
shopGUI(player)
function shopGUI(p: player):
set {_gui} to chest inventory with 6 rows named "WiredGens Shop"
set slot (integers between 0 and 54) of {_gui} to gray stained glass pane named " "
set slot 10 of {_gui} to white stained glass named "&rTier 1 Generator (&a$%{getGenCost()}%&r)"
set slot 12 of {_gui} to command block named "&rGen Slot (&a%{getSlotCost(%{_p}%)}% tokens&r)"
set slot 14 of {_gui} to blaze rod named "&rSellwand (&a%{getSellwandCost()}% tokens&r)"
set slot 16 of {_gui} to paper named "&rRanks"
open {_gui} to {_p}
on inventory click:
name of event-inventory is "WiredGens Shop"
cancel event
event-inventory is not player's inventory
if clicked slot is 10:
make player execute command "/buygen"
if clicked slot is 12:
make player execute command "/buygenslots"
if clicked slot is 14:
make player execute command "/buysellwand"
if clicked slot is 16:
close player's inventory
make player execute command "/ranks"
#This is what one of the functions looks like
function getGenCost() :: number:
#cost is set in the options at the beginning of this script
return {@cost}
Turns out it was dropping them, just in the wrong world. I fixed this by changing the line "set {_loc} to location({_x},{_y},{_z}, world "%{_c}%'s world")" to "set {_loc} to location({_x},{_y},{_z}, "myworldname")"