Skip to content

Commit

Permalink
Add a whitelist check for PlyTransfer
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgrist committed Jul 12, 2020
1 parent 5a203e6 commit 2083e5b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
20 changes: 13 additions & 7 deletions gamemode/core/sh_commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -716,15 +716,21 @@ ix.command.Add("PlyTransfer", {
end

if (faction) then
target.vars.faction = faction.uniqueID
target:SetFaction(faction.index)
local bHasWhitelist = client:HasWhitelist(faction.index)

if (faction.OnTransferred) then
faction:OnTransferred(target)
end
if (bHasWhitelist) then
target.vars.faction = faction.uniqueID
target:SetFaction(faction.index)

if (faction.OnTransferred) then
faction:OnTransferred(target)
end

for _, v in ipairs(player.GetAll()) do
v:NotifyLocalized("cChangeFaction", client:GetName(), target:GetName(), L(faction.name, v))
for _, v in ipairs(player.GetAll()) do
v:NotifyLocalized("cChangeFaction", client:GetName(), target:GetName(), L(faction.name, v))
end
else
return "@charNotWhitelisted", target:GetName(), L(faction.name, client)
end
else
return "@invalidFaction"
Expand Down
1 change: 1 addition & 0 deletions gamemode/languages/sh_english.lua
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ LANGUAGE = {
whitelist = "%s has whitelisted %s for the %s faction.",
unwhitelist = "%s has unwhitelisted %s from the %s faction.",
noWhitelist = "You do not have the whitelist for this character!",
charNotWhitelisted = "%s is not whitelisted for the %s faction.",
gettingUp = "You are now getting up...",
wakingUp = "You are regaining consciousness...",
Weapons = "Weapons",
Expand Down

0 comments on commit 2083e5b

Please sign in to comment.