* Create factions.js

Placeholder: %javascript_factions%

Returns brackets around the faction name if the user is in a faction

* Update factions.js

Smaller changes
This commit is contained in:
Frcsty 2020-03-10 09:09:52 +01:00 committed by GitHub
parent 1190734f8d
commit 9f1162a6c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

34
scripts/factions.js Normal file
View File

@ -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();