I just had a question about functions inside of other functions. If I have repetitive action within a current function, is it more efficient or useless to make those functions as well? Currently for me it's just a lot of messaging for different outcomes based on perms, but in general?
EDIT: This is the code I'm using. No issue with it or anything, I just want to know if having so many functions like this is benefiting me or not^-^ I'm trying to get more efficient
EDIT: This is the code I'm using. No issue with it or anything, I just want to know if having so many functions like this is benefiting me or not^-^ I'm trying to get more efficient
code_language.skript:
function homeMsg(p: player, t: text):
set {homes::%{_p}%::%{_t}%} to location of {_p}
send "&e&l[&b&l✔&e&l] &r&7Home &l%{_t}% &7 set to %{homes::%{_p}%::%{_t}%}%"
#--------------------------------
function sizeMsg(p: player):
send "&e&l[&d&l✖&e&l] &r&7Home limit reached. Delete a home to set a new one" to {_p}
stop
#--------------------------------
function setHome(p: player, t: text):
loop {homes::%{_p}%::*}:
if loop-index = {_t}:
send "home name already exists." to {_p}
stop
if {_p} has permission "unlim.homes":
homeMsg({_p}, {_t})
else if {_p} has permission "10.homes":
if size of {homes::%{_p}%::*} = 10:
sizeMsg({_p})
homeMsg({_p}, {_t})
else if {_p} has permission "5.homes":
if size of {homes::%{_p}%::*} = 5:
sizeMsg({_p})
homeMsg({_p}, {_t})
else if {_p} has permission "4.homes":
if size of {homes::%{_p}%::*} = 4:
sizeMsg({_p})
homeMsg({_p}, {_t})
else if {_p} has permission "3.homes":
if size of {homes::%{_p}%::*} = 3:
sizeMsg({_p})
homeMsg({_p}, {_t})
else if {_p} has permission "1.homes":
if size of {homes::%{_p}%::*} = 1:
sizeMsg({_p})
homeMsg({_p}, {_t})
Last edited: