From 9f1162a6c70c221e7f50bc35a7f8e93a2ecb9071 Mon Sep 17 00:00:00 2001 From: Frcsty <50297792+Frcsty@users.noreply.github.com> Date: Tue, 10 Mar 2020 09:09:52 +0100 Subject: [PATCH] Merge (#13) * Create factions.js Placeholder: %javascript_factions% Returns brackets around the faction name if the user is in a faction * Update factions.js Smaller changes --- scripts/factions.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 scripts/factions.js diff --git a/scripts/factions.js b/scripts/factions.js new file mode 100644 index 0000000..9921170 --- /dev/null +++ b/scripts/factions.js @@ -0,0 +1,34 @@ +/* +A simple placeholder which will return brackets around the faction name if the user +is in a faction, if they are not it will return nothing + +Creating our faction variable which is the user's faction name (if the user is not in a faction it +will return the specified value in the factions config) +*/ +var faction = "%factionsuuid_faction_name%"; + +/* +Creating our hasFaction function which will return the correct value +*/ +function hasFaction() +{ + /* + If the faction variable returns an empty string, we return an empty string back, + and if the faction variable isn't empty we return colored brackets around it + */ + if (faction == '') + { + return ''; + } + return '&8[&f' + faction + '&8]'; + + /* + A compacter way of defining if statements + Checked value ? Boolean true : Boolean false + return faction == '' ? '' : '&8[&f' + faction + '&8]'; + */ +} +/* +Calling the hasFaction function +*/ +hasFaction();