-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added 'PostCommandUsed' hook called after a command succeeds in running. * *Contributed by NightAngel.* * Added 'StaticAreaAdd' and 'StaticAreaRemove' commands for adding static entities in a certain radius around you. * *Contributed by NightAngel.* * Added two new functions in the player library, CanPromote and CanDemote (focussed on rank promotions/demotions). * *Contributed by Vortix.* * Added two new commands, RankPromote and RankDemote. * *Contributed by Vortix.* * GetLowestRank and GetHighestRank functions now return rank table as well as name. * *Contributed by Vortix.* * SetFactionRank now checks if the rank is valid and, if it is, sets the player's rank to the provided rank and provides the new rank's model, class and weapons. * *Contributed by Vortix.* * Fixed sorting for tab menu items that don't have icons. * *Contributed by kurozael.* * Fixed issue with players being unable to make another character without having to rejoin. * *Contributed by NightAngel.* * Added theme hooks 'PreCharacterFadeOutNavigation', 'PreCharacterFadeInNavigation', 'PreCharacterFadeOutTitle' and 'PreCharacterFadeInTitle'. * *Contributed by NightAngel.* * Shifted PreCharacterMenuPaint to include everything inside the paint function. * *Contributed by NightAngel.* * Fixed errors that occured from the display typing plugin with utf8 len function. * *Contributed by NightAngel.* * Added whitelist/blacklist system for classes that can be staticed * *Contributed by NightAngel.* * Added EditStaticWhitelist and EditStaticBlacklist hooks to modify what can and cannot be staticed * *Contributed by NightAngel.* * Added 'target_id_delay' config to modify the delay for when a target ID appears on a player's screen. * *Contributed by kurozael.* * Added config options for intro background and logo. ('intro_background_url', 'intro_logo_url') * *Contributed by kurozael.* * Added work in progress translate command along with 'translate_api_key' config option. * *Contributed by Vortix.*
- Loading branch information
Showing
22 changed files
with
573 additions
and
112 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
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
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
55 changes: 55 additions & 0 deletions
55
Clockwork/garrysmod/gamemodes/clockwork/framework/commands/sh_rankdemote.lua
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,55 @@ | ||
--[[ | ||
© 2015 CloudSixteen.com do not share, re-distribute or modify | ||
without permission of its author (kurozael@gmail.com). | ||
Clockwork was created by Conna Wiles (also known as kurozael.) | ||
http://cloudsixteen.com/license/clockwork.html | ||
--]] | ||
local COMMAND = Clockwork.command:New("RankDemote"); | ||
COMMAND.tip = "Demote someone to the next rank down."; | ||
COMMAND.text = "<string Name> [boolean Force]"; | ||
COMMAND.arguments = 1; | ||
COMMAND.optionalArguments = 1; | ||
-- Called when the command has been run. | ||
function COMMAND:OnRun(player, arguments) | ||
local target = Clockwork.player:FindByID(arguments[1]); | ||
local force = tobool(arguments[2]); | ||
if (force) then | ||
if (player:IsAdmin()) then | ||
local lowestRank, rankTable = Clockwork.faction:GetLowestRank(target:GetFaction()); | ||
local targetRank, targetRankTable = Clockwork.player:GetFactionRank(target); | ||
if (istable(rankTable) and targetRankTable.position and targetRankTable.position != rankTable.position) then | ||
local rank, rankTable = target:GetFactionRank(); | ||
Clockwork.player:SetFactionRank(target, Clockwork.faction:GetLowerRank(target:GetFaction(), rankTable)); | ||
Clockwork.player:NotifyAll(player:Name().." has force-demoted "..target:Name().." to rank "..target:GetFactionRank()); | ||
else | ||
Clockwork.player:Notify(player, "You cannot demote this player!") | ||
end; | ||
else | ||
Clockwork.player:Notify(player, "You must be an admin or superadmin to force demote!"); | ||
end; | ||
else | ||
if (player:GetFaction() == target:GetFaction()) then | ||
if (Clockwork.player:CanDemote(player, target)) then | ||
local rank, rankTable = target:GetFactionRank(); | ||
Clockwork.player:SetFactionRank(target, Clockwork.faction:GetHigherRank(target:GetFaction(), rankTable)); | ||
Clockwork.player:NotifyAll(player:Name().." has demoted "..target:Name().." to rank "..target:GetFactionRank()); | ||
else | ||
Clockwork.player:Notify(player, "You do not have permission to demote this player."); | ||
end; | ||
else | ||
Clockwork.player:Notify(player, "You can only demote someone within your own faction!"); | ||
end; | ||
end; | ||
end; | ||
COMMAND:Register(); |
55 changes: 55 additions & 0 deletions
55
Clockwork/garrysmod/gamemodes/clockwork/framework/commands/sh_rankpromote.lua
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,55 @@ | ||
--[[ | ||
© 2015 CloudSixteen.com do not share, re-distribute or modify | ||
without permission of its author (kurozael@gmail.com). | ||
Clockwork was created by Conna Wiles (also known as kurozael.) | ||
http://cloudsixteen.com/license/clockwork.html | ||
--]] | ||
local COMMAND = Clockwork.command:New("RankPromote"); | ||
COMMAND.tip = "Promote someone to the next rank up."; | ||
COMMAND.text = "<string Name> [boolean Force]"; | ||
COMMAND.arguments = 1; | ||
COMMAND.optionalArguments = 1; | ||
-- Called when the command has been run. | ||
function COMMAND:OnRun(player, arguments) | ||
local target = Clockwork.player:FindByID(arguments[1]); | ||
local force = tobool(arguments[2]); | ||
if (force) then | ||
if (player:IsAdmin()) then | ||
local highestRank, rankTable = Clockwork.faction:GetHighestRank(target:GetFaction()); | ||
local targetRank, targetRankTable = Clockwork.player:GetFactionRank(target); | ||
if (istable(rankTable) and targetRankTable.position and targetRankTable.position != rankTable.position) then | ||
local rank, rankTable = target:GetFactionRank(); | ||
Clockwork.player:SetFactionRank(target, Clockwork.faction:GetHigherRank(target:GetFaction(), rankTable)); | ||
Clockwork.player:NotifyAll(player:Name().." has force-promoted "..target:Name().." to rank "..target:GetFactionRank()); | ||
else | ||
Clockwork.player:Notify(player, "You cannot promote this player!") | ||
end; | ||
else | ||
Clockwork.player:Notify(player, "You must be an admin or superadmin to force promote!"); | ||
end; | ||
else | ||
if (player:GetFaction() == target:GetFaction()) then | ||
if (Clockwork.player:CanPromote(player, target)) then | ||
local rank, rankTable = target:GetFactionRank(); | ||
Clockwork.player:SetFactionRank(target, Clockwork.faction:GetHigherRank(target:GetFaction(), rankTable)); | ||
Clockwork.player:NotifyAll(player:Name().." has promoted "..target:Name().." to rank "..target:GetFactionRank()); | ||
else | ||
Clockwork.player:Notify(player, "You do not have permission to promote this player."); | ||
end; | ||
else | ||
Clockwork.player:Notify(player, "You can only promote someone within your own faction!"); | ||
end; | ||
end; | ||
end; | ||
COMMAND:Register(); |
88 changes: 88 additions & 0 deletions
88
Clockwork/garrysmod/gamemodes/clockwork/framework/commands/sh_translate.lua
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,88 @@ | ||
--[[ | ||
© 2015 CloudSixteen.com do not share, re-distribute or modify | ||
without permission of its author (kurozael@gmail.com). | ||
Clockwork was created by Conna Wiles (also known as kurozael.) | ||
http://cloudsixteen.com/license/clockwork.html | ||
--]] | ||
local COMMAND = Clockwork.command:New("Translate"); | ||
COMMAND.tip = "Translate given text to the specified language and print it in chat."; | ||
COMMAND.text = "<string Source> <string Language> <string Text>"; | ||
COMMAND.arguments = 3; | ||
-- Called when the command has been run. | ||
function COMMAND:OnRun(player, arguments) | ||
if (Clockwork.config:Get("translate_api_key"):Get() != "") then | ||
http.Fetch("https://www.googleapis.com/language/translate/v2/languages?key="..Clockwork.config:Get("translate_api_key"):Get().."&target=en", | ||
function(body, length, headers, code) | ||
body = Clockwork.json:Decode(body); | ||
if (body["data"]) then | ||
local languages = {}; | ||
local source = ""; | ||
local target = ""; | ||
for i = 1, #body["data"]["languages"] do | ||
languages[string.lower(body["data"]["languages"][i].name)] = string.lower(body["data"]["languages"][i].language); | ||
if (string.lower(body["data"]["languages"][i].name) == string.lower(arguments[1]) or string.lower(body["data"]["languages"][i].language) == string.lower(arguments[1])) then | ||
source = string.lower(body["data"]["languages"][i].language); | ||
end; | ||
if (string.lower(body["data"]["languages"][i].name) == string.lower(arguments[2]) or string.lower(body["data"]["languages"][i].language) == string.lower(arguments[2])) then | ||
target = string.lower(body["data"]["languages"][i].language); | ||
end; | ||
end; | ||
if (source != "") then | ||
if (target != "") then | ||
http.Fetch("https://www.googleapis.com/language/translate/v2?key="..Clockwork.config:Get("translate_api_key"):Get().."&source="..source.."&target="..v.."&q="..arguments[3], | ||
function(body, length, headers, code) | ||
body = Clockwork.json:Decode(body); | ||
if (body["data"]) then | ||
Clockwork.chatBox:AddInRadius(player, "ic", body["data"]["translations"][1].translatedText, player:GetPos(), Clockwork.config:Get("talk_radius"):Get()); | ||
elseif (body["error"]) then | ||
local errorsString = body["error"]["errors"][1].reason; | ||
for i = 2, #body["error"]["errors"] do | ||
errorsString = ", "..body["error"]["errors"][i].reason; | ||
end; | ||
Clockwork.player:Notify(player, "Error(s): "..errorsString); | ||
end; | ||
end, | ||
function(error) | ||
Clockwork.player:Notify(player, "Error: "..error); | ||
end | ||
); | ||
else | ||
Clockwork.player:Notify(player, "Invalid target language."); | ||
end; | ||
else | ||
Clockwork.player:Notify(player, "Invalid source language."); | ||
end; | ||
elseif (body["error"]) then | ||
local errorsString = body["error"]["errors"][1].reason; | ||
for i = 2, #body["error"]["errors"] do | ||
errorsString = ", "..body["error"]["errors"][i].reason; | ||
end; | ||
Clockwork.player:Notify(player, "Error(s): "..errorsString); | ||
end; | ||
end, | ||
function(error) | ||
Clockwork.player:Notify(player, "Error: "..error); | ||
end | ||
); | ||
else | ||
Clockwork.player:Notify(player, "There must be a Google Translate API key set for the value of the translate_api_key config to use this feature."); | ||
end; | ||
end; | ||
--COMMAND:Register(); |
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
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
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
Oops, something went wrong.