-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit cd9742f
Showing
10 changed files
with
635 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
name: Update Lua Version and Create Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' # Uruchamiaj workflow dla każdego tagu | ||
|
||
jobs: | ||
versioning: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write # Potrzebne do commitowania zmian | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Git | ||
run: | | ||
git config user.name 'GitHub Actions' | ||
git config user.email 'actions@github.com' | ||
- name: Checkout to master branch | ||
run: | | ||
git checkout master || git checkout -b master | ||
- name: Update Lua file version | ||
id: update_version | ||
run: | | ||
VERSION_FILE="plugins/tags/manifest.lua" | ||
echo "Version file: $VERSION_FILE" | ||
# Odczytaj aktualną wersję z funkcji GetPluginVersion | ||
CURRENT_VERSION=$(awk -F'"' '/function GetPluginVersion()/, /end/ { if ($0 ~ /return/) print $2 }' "$VERSION_FILE") | ||
echo "Current version: $CURRENT_VERSION" | ||
# Sprawdź, czy wersja została prawidłowo odczytana | ||
if [ -z "$CURRENT_VERSION" ]; then | ||
echo "Failed to extract current version." | ||
exit 1 | ||
fi | ||
# Zwiększ wersję | ||
IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT_VERSION" | ||
PATCH=${VERSION_PARTS[2]} | ||
PATCH=$((PATCH + 1)) | ||
NEW_VERSION="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.$PATCH" | ||
echo "New version: $NEW_VERSION" | ||
# Zaktualizuj wersję w pliku Lua | ||
sed -i "/function GetPluginVersion()/,/end/s|return \"$CURRENT_VERSION\"|return \"$NEW_VERSION\"|" "$VERSION_FILE" | ||
# Commit zmiany | ||
git add "$VERSION_FILE" | ||
git commit -m "Bump version to $NEW_VERSION" | ||
git push origin master | ||
- name: Create ZIP archive | ||
id: create_zip | ||
run: | | ||
REPO_NAME=$(basename -s .git `git config --get remote.origin.url`) | ||
ZIP_NAME="${REPO_NAME}-v${NEW_VERSION}.zip" | ||
echo "ZIP Name: $ZIP_NAME" | ||
zip -r "$ZIP_NAME" . -x "*.git*" | ||
echo "ZIP_PATH=$ZIP_NAME" >> $GITHUB_ENV | ||
- name: Upload ZIP artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: repository-archive | ||
path: ${{ env.ZIP_PATH }} | ||
|
||
- name: Get commits since last tag | ||
id: get_commits | ||
run: | | ||
# Find the last tag | ||
LAST_TAG=$(git describe --tags --abbrev=0) | ||
echo "Last tag: $LAST_TAG" | ||
# Get commits since last tag | ||
COMMIT_MESSAGES=$(git log "${LAST_TAG}..HEAD" --pretty=format:"* %s") | ||
echo "Commits since last tag:" | ||
echo "$COMMIT_MESSAGES" | ||
# Save the commit messages to an environment variable | ||
echo "COMMITS=${COMMIT_MESSAGES}" >> $GITHUB_ENV | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
body: | | ||
Changes: | ||
${{ env.COMMITS }} | ||
- name: Upload Release Asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ${{ env.ZIP_PATH }} | ||
asset_name: ${{ env.ZIP_PATH }} | ||
asset_content_type: application/zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<p align="center"> | ||
<a href="https://github.com/swiftly-solution/weapon_restrictor"> | ||
<img src="https://cdn.swiftlycs2.net/swiftly-logo.png" alt="SwiftlyLogo" width="80" height="80"> | ||
</a> | ||
|
||
<h3 align="center">[Swiftly] Tags</h3> | ||
|
||
<p align="center"> | ||
A simple plugin for Swiftly that implements tags on chat/scoreboard. | ||
<br/> | ||
</p> | ||
</p> | ||
|
||
<p align="center"> | ||
<img src="https://img.shields.io/github/downloads/m3ntorsky/tags/total" alt="Downloads"> | ||
<img src="https://img.shields.io/github/contributors/m3ntorsky/tags?color=dark-green" alt="Contributors"> | ||
<img src="https://img.shields.io/github/issues/m3ntorsky/tags" alt="Issues"> | ||
<img src="https://img.shields.io/github/license/m3ntorsky/tags" alt="License"> | ||
</p> | ||
|
||
|
||
|
||
## Installation 👀 | ||
1. Download the newest [release](https://github.com/swiftly-solution/weapon_restrictor/releases) | ||
2. Everything is drag & drop, so I think you can do it! | ||
|
||
### Configuring the plugin 🧐 | ||
- After installing the plugin, you can change the prefix and the database settings from `addons/swiftly/configs/plugins/tags.json` | ||
|
||
## Supported identifiers 🤝 | ||
- `everyone` | ||
- `team:tt` | ||
- `team:ct` | ||
- `team:spec` | ||
- `steamid:(steamid64)` Example: `steamid:7571572137123713` | ||
- `vip:(group_name)` Example: `vip:group_1` [VIPCore](https://github.com/swiftly-solution/vip-core/releases) required | ||
- `admin:group:(group_name)` Example: `admin:group:root` [Admins](https://github.com/swiftly-solution/admins/releases) required | ||
- `admin:flags:(flags_string)` Example: `admin:flags:abc` [Admins](https://github.com/swiftly-solution/admins/releases) required | ||
|
||
## Supported colors 🎨 | ||
`default`, `white`, `darkred`, `lightpurple`, `green`, `olive`, `lime`, `red`, `gray`, `grey`, `lightyellow`, `yellow`, `silver`, `bluegrey`, `lightblue`, `blue`, `darkblue`, `purple`, `magenta`, `lightred`, `gold`, `orange`,`teamcolor` | ||
|
||
## Available Commands 📋 | ||
- `sw_tags add <identifier> <tag> <color> <name_color> <msg_color> <scoreboard (0/1)>` | ||
- Adds a new tag with the specified properties. The scoreboard value should be 0 or 1. | ||
|
||
- `sw_tags edit <identifier> <tag/color/name_color/msg_color/scoreboard> <value>` | ||
- Edits the specified property of an existing tag. | ||
|
||
- `sw_tags remove <identifier>` | ||
- Removes the tag with the given identifier. | ||
|
||
- `sw_tags list` | ||
- Lists all the tags currently in the system. | ||
|
||
- `sw_tags reload` | ||
- Reloads the tags configuration from the database. | ||
|
||
|
||
### Creating A Pull Request 😃 | ||
|
||
1. Fork the Project | ||
2. Create your Feature Branch | ||
3. Commit your Changes | ||
4. Push to the Branch | ||
5. Open a Pull Request | ||
|
||
### Have ideas/Found bugs? 💡 | ||
|
||
Join [Swiftly Discord Server](https://swiftlycs2.net/discord) and send a message in the topic from `📕╎plugins-sharing` of this plugin! | ||
|
||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"prefix": "{DARKRED}[TAGS]{DEFAULT}", | ||
|
||
"database": { | ||
"connection":"default_connection", | ||
"tablesname": { | ||
"tags" : "sw_tags" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Plugins = {} | ||
Tags = {} | ||
TagsIndexMap = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function GetPluginAuthor() | ||
return "m3ntorsky" | ||
end | ||
function GetPluginVersion() | ||
return "v1.0.0" | ||
end | ||
function GetPluginName() | ||
return "tags" | ||
end | ||
function GetPluginWebsite() | ||
return "https://github.com/m3ntorsky/tags" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
local consoleCommands = { | ||
|
||
add = function(playerid, args, argc, silent) | ||
-- sw_tags add <identifier> <tag> <color> <name_color> <msg_color> <scoreboard (0/1)> | ||
if argc < 7 then | ||
return ReplyToCommand(playerid, config:Fetch("tags.prefix"), | ||
"Syntax: sw_tags add <identifier> <tag> <color> <name_color> <msg_color> <scoreboard (0/1)>") | ||
end | ||
|
||
local identifier = args[2] | ||
if TagsIndexMap[identifier] then | ||
return ReplyToCommand(playerid, config:Fetch("tags.prefix"), | ||
FetchTranslation("tags.exists"):gsub("{ID}", identifier)) | ||
end | ||
|
||
local tag = args[3] | ||
local color = args[4] | ||
local name_color = args[5] | ||
local msg_color = args[6] | ||
local scoreboard = tonumber(args[7]) | ||
if not scoreboard and scoreboard ~= 0 or scoreboard ~= 1 then | ||
return ReplyToCommand(playerid, config:Fetch("tags.prefix"), | ||
"Syntax: sw_tags add <identifier> <tag> <color> <name_color> <msg_color> <scoreboard (0/1)>") | ||
end | ||
|
||
|
||
local addRowQuery = | ||
"INSERT INTO @tablename VALUES ('@identifier', '@tag', '@color', '@name_color', '@msg_color', @scoreboard)" | ||
local addRowParams = { | ||
["tablename"] = config:Fetch("tags.database.tablesname.tags"), | ||
["identifier"] = identifier, | ||
["tag"] = tag, | ||
["color"] = color, | ||
["name_color"] = name_color, | ||
["msg_color"] = msg_color, | ||
["scoreboard"] = scoreboard | ||
} | ||
|
||
db:QueryParams(addRowQuery, addRowParams, function(err, result) | ||
if #err > 0 then | ||
return print("{DARKRED} ERROR: {DEFAULT}" .. err) | ||
end | ||
ReplyToCommand(playerid, config:Fetch("tags.prefix"), FetchTranslation("tags.added"):gsub("{ID}", identifier)) | ||
ReloadTags() | ||
end) | ||
end, | ||
|
||
remove = function(playerid, args, argc, silent) | ||
-- sw_tags remove <identifier> | ||
if argc < 2 then | ||
return ReplyToCommand(playerid, config:Fetch("tags.prefix"), "Syntax: sw_tags remove <identifier>") | ||
end | ||
|
||
local identifier = args[2] | ||
|
||
if not TagsIndexMap[identifier] then | ||
return ReplyToCommand(playerid, config:Fetch("tags.prefix"), | ||
FetchTranslation("tags.not_exists"):gsub("{ID}", identifier)) | ||
end | ||
|
||
local removeRowQuery = "DELETE FROM @tablename WHERE identifier = '@identifier' LIMIT 1;" | ||
local removeRowParams = { | ||
["tablename"] = config:Fetch("tags.database.tablesname.tags"), | ||
["identifier"] = identifier | ||
} | ||
|
||
db:QueryParams(removeRowQuery, removeRowParams, function(err, result) | ||
if #err > 0 then | ||
return print("{DARKRED} ERROR: {DEFAULT}" .. err) | ||
end | ||
ReplyToCommand(playerid, config:Fetch("tags.prefix"), | ||
FetchTranslation("tags.removed"):gsub("{ID}", identifier)) | ||
ReloadTags() | ||
end) | ||
end, | ||
|
||
edit = function(playerid, args, argc, silent) | ||
-- sw_tags edit <identifier> <tag/color/name_color/msg_color/scoreboard> <value> | ||
if argc < 4 then | ||
return ReplyToCommand(playerid, config:Fetch("tags.prefix"), | ||
"Syntax: sw_tags edit <identifier> <tag/color/name_color/msg_color/scoreboard> <value>") | ||
end | ||
|
||
local identifier = args[2] | ||
if not TagsIndexMap[identifier] then | ||
return ReplyToCommand(playerid, config:Fetch("tags.prefix"), | ||
FetchTranslation("tags.not_exists"):gsub("{ID}", identifier)) | ||
end | ||
|
||
local option = args[3] | ||
|
||
if option == "tag" and option ~= "color" and option ~= "name_color" and option ~= "msg_color" and option ~= "scoreboard" then | ||
return ReplyToCommand(playerid, config:Fetch("tags.prefix"), | ||
"Syntax: sw_tags edit <identifier> <tag/color/name_color/msg_color/scoreboard> <value>)") | ||
end | ||
local value = args[4] | ||
|
||
|
||
local updateRowQuery = "UPDATE @tablename SET @option = '@value' WHERE identifier = '@identifier'"; | ||
local updateRowParams = { | ||
["tablename"] = config:Fetch("tags.database.tablesname.tags"), | ||
["option"] = option, | ||
["value"] = value, | ||
["identifier"] = identifier | ||
} | ||
|
||
db:QueryParams(updateRowQuery, updateRowParams, function(err, result) | ||
if #err > 0 then | ||
return print("{DARKRED} ERROR: {DEFAULT}" .. err) | ||
end | ||
ReplyToCommand(playerid, config:Fetch("tags.prefix"), | ||
FetchTranslation("tags.updated"):gsub("{ID}", identifier)) | ||
ReloadTags() | ||
end) | ||
end, | ||
|
||
list = function(playerid, args, argc, silent) | ||
if #Tags == 0 then | ||
return ReplyToCommand(playerid, config:Fetch("tags.prefix"), FetchTranslation("tags.empty_list")) | ||
end | ||
local tagsList = { | ||
{ "identifier", "tag", "color", "name_color", "msg_color", "scoreboard" } | ||
} | ||
for i = 1, #Tags do | ||
if type(Tags[i]) == "table" then | ||
table.insert(tagsList, { | ||
Tags[i].identifier, | ||
Tags[i].tag, | ||
Tags[i].color, | ||
Tags[i].name_color, | ||
Tags[i].msg_color, | ||
tostring(Tags[i].scoreboard) | ||
}) | ||
end | ||
end | ||
|
||
print(CreateTextTable(tagsList)) | ||
end, | ||
|
||
reload = function(playerid, args, argc, silent) | ||
ReloadTags() | ||
ReplyToCommand(playerid, config:Fetch("tags.prefix"), FetchTranslation("tags.reloaded")) | ||
end | ||
} | ||
|
||
|
||
commands:Register("tags", function(playerid, args, argc, silent, prefix) | ||
if playerid < 0 then | ||
if argc < 1 then | ||
return ReplyToCommand(playerid, config:Fetch("tags.prefix"), "Syntax: sw_tags <add/remove/edit/list/reload>") | ||
end | ||
|
||
local option = args[1] | ||
|
||
if not consoleCommands[option] then | ||
ReplyToCommand(playerid, config:Fetch("tags.prefix"), "Syntax: sw_tags <add/remove/edit/list/reload>") | ||
end | ||
|
||
return consoleCommands[option](playerid, args, argc, silent) | ||
end | ||
-- TODO: Player menu style | ||
return | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
AddEventHandler("OnAllPluginsLoaded", function (event) | ||
local supportedPlugins = {"vipcore","admins"} | ||
|
||
for i = 1, #supportedPlugins, 1 do | ||
local pluginName = supportedPlugins[i] | ||
if GetPluginState(pluginName) == PluginState_t.Started then | ||
Plugins[pluginName] = true | ||
print("Plugin found: {green}" .. pluginName.."{default}") | ||
end | ||
end | ||
|
||
end) |
Oops, something went wrong.