diff --git a/entities/weapons/nut_hands.lua b/entities/weapons/nut_hands.lua index 39addcee..e3809b48 100644 --- a/entities/weapons/nut_hands.lua +++ b/entities/weapons/nut_hands.lua @@ -77,7 +77,7 @@ PLAYER_PICKUP_RANGE = 200 with prop pushing. CARRY_STRENGTH_GOD: 0 - You can push player with prop on this strength levle. the grabbing never fails. - Try this if you're playing with very trustful community. + Try this if you're playing with very trustful community. ]]-- CARRY_FORCE_LIMIT = CARRY_FORCE_LEVEL[CARRY_STRENGTH_CHAD] -- default strength level is CHAD. @@ -506,7 +506,7 @@ function SWEP:doPickup(throw, entity, trace) -- increase refire to make rags easier to drag --self.Weapon:SetNextSecondaryFire(CurTime() + 0.04) end - + if (IsValid(phys)) then self:dragObject(phys, pdir, 6000, is_ragdoll) return @@ -591,7 +591,7 @@ function SWEP:pickup(entity, trace) local max_force = CARRY_FORCE_LIMIT if (entity:GetClass() == "prop_ragdoll") then - self.dt.carried_rag = ent + self.dt.carried_rag = entity bone = trace.PhysicsBone max_force = 0 @@ -611,8 +611,9 @@ end local down = Vector(0, 0, -1) function SWEP:allowEntityDrop() local client = self:GetOwner() + local ent = self.carryHack - if (not IsValid(client)) or (not IsValid(self.carryHack)) then return false end + if (not IsValid(client)) or (not IsValid(ent)) then return false end local ground = client:GetGroundEntity() if ground and (ground:IsWorld() or IsValid(ground)) then return true end diff --git a/gamemode/config/sh_config.lua b/gamemode/config/sh_config.lua index daf3b332..4a73606e 100644 --- a/gamemode/config/sh_config.lua +++ b/gamemode/config/sh_config.lua @@ -30,6 +30,16 @@ nut.config.add("genericFont", "Segoe UI", "The font used to display generic text end end, {category = "appearance"}) +nut.config.add("fontScale", 1.0, "The scale for the font.", function(oldValue, newValue) + if (CLIENT) then + hook.Run("LoadNutFonts", nut.config.get("font"), nut.config.get("genericFont")) + end +end, { + form = "Float", + data = {min = 0.1, max = 2.0}, + category = "appearance" +}) + nut.config.add("chatRange", 280, "The maximum distance a person's IC chat message goes to.", nil, { form = "Float", data = {min = 10, max = 5000}, diff --git a/gamemode/core/derma/cl_inventory.lua b/gamemode/core/derma/cl_inventory.lua index 9d1ad015..bc3d8abd 100644 --- a/gamemode/core/derma/cl_inventory.lua +++ b/gamemode/core/derma/cl_inventory.lua @@ -34,12 +34,14 @@ function PANEL:setItemType(itemTypeOrID) if (isnumber(itemTypeOrID)) then item = nut.item.instances[itemTypeOrID] self.itemID = itemTypeOrID + else + self.itemType = itemTypeOrID end assert(item, "invalid item type or ID "..tostring(item)) self.nutToolTip = true self.itemTable = item - self:SetModel(item.model, item.skin) + self:SetModel(item:getModel(), item:getSkin()) self:updateTooltip() if (item.exRender) then @@ -97,14 +99,20 @@ function PANEL:Init() self:SetSize(NS_ICON_SIZE, NS_ICON_SIZE) end +--[[ function PANEL:Think() + self.itemTable = nut.item.instances[self.itemID] + self:updateTooltip() +end ]] + function PANEL:PaintOver(w, h) local itemTable = nut.item.instances[self.itemID] - if (itemTable and itemTable.paintOver) then local w, h = self:GetSize() itemTable.paintOver(self, itemTable, w, h) end + + hook.Run("ItemPaintOver", self, itemTable, w, h) end function PANEL:PaintBehind(w, h) @@ -308,20 +316,20 @@ hook.Add("CreateMenuButtons", "nutInventory", function(tabs) local childPanels = inventory:show(mainPanel) nut.gui["inv"..inventory:getID()] = childPanels table.insert(sortPanels, childPanels) - + totalSize.x = totalSize.x + childPanels:GetWide() + margin totalSize.y = math.max(totalSize.y, childPanels:GetTall()) end end - + local px, py, pw, ph = mainPanel:GetBounds() - local x, y = px + pw/2 - totalSize.x / 2, py + ph/2 + local x, y = px + pw/2 - totalSize.x / 2, py + ph/2 for _, panel in pairs(sortPanels) do panel:ShowCloseButton(true) panel:SetPos(x, y - panel:GetTall()/2) x = x + panel:GetWide() + margin end - + hook.Add("PostRenderVGUI", mainPanel, function() hook.Run("PostDrawInventory", mainPanel) end) diff --git a/gamemode/core/hooks/cl_hooks.lua b/gamemode/core/hooks/cl_hooks.lua index e4359592..ce0d3e0f 100644 --- a/gamemode/core/hooks/cl_hooks.lua +++ b/gamemode/core/hooks/cl_hooks.lua @@ -1,6 +1,6 @@ function GM:LoadNutFonts(font, genericFont) local oldFont, oldGenericFont = font, genericFont - + local scale = math.Round(nut.config.get("fontScale", 1), 2) surface.CreateFont("nut3D2DFont", { font = font, size = 2048, @@ -10,28 +10,28 @@ function GM:LoadNutFonts(font, genericFont) surface.CreateFont("nutTitleFont", { font = font, - size = ScreenScale(30), + size = ScreenScale(30) * scale, extended = true, weight = 1000 }) surface.CreateFont("nutSubTitleFont", { font = font, - size = ScreenScale(18), + size = ScreenScale(18) * scale, extended = true, weight = 500 }) surface.CreateFont("nutMenuButtonFont", { font = font, - size = ScreenScale(14), + size = ScreenScale(14) * scale, extended = true, weight = 1000 }) surface.CreateFont("nutMenuButtonLightFont", { font = font, - size = ScreenScale(14), + size = ScreenScale(14) * scale, extended = true, weight = 200 }) @@ -45,21 +45,21 @@ function GM:LoadNutFonts(font, genericFont) surface.CreateFont("nutDynFontSmall", { font = font, - size = ScreenScale(22), + size = ScreenScale(22) * scale, extended = true, weight = 1000 }) surface.CreateFont("nutDynFontMedium", { font = font, - size = ScreenScale(28), + size = ScreenScale(28) * scale, extended = true, weight = 1000 }) surface.CreateFont("nutDynFontBig", { font = font, - size = ScreenScale(48), + size = ScreenScale(48) * scale, extended = true, weight = 1000 }) @@ -69,63 +69,63 @@ function GM:LoadNutFonts(font, genericFont) surface.CreateFont("nutCleanTitleFont", { font = font, - size = 200, + size = 200 * scale, extended = true, weight = 1000 }) surface.CreateFont("nutHugeFont", { font = font, - size = 72, + size = 72 * scale, extended = true, weight = 1000 }) surface.CreateFont("nutBigFont", { font = font, - size = 36, + size = 36 * scale, extended = true, weight = 1000 }) surface.CreateFont("nutMediumFont", { font = font, - size = 25, + size = 25 * scale, extended = true, weight = 1000 }) surface.CreateFont("nutMediumLightFont", { font = font, - size = 25, + size = 25 * scale, extended = true, weight = 200 }) surface.CreateFont("nutGenericFont", { font = font, - size = 20, + size = 20 * scale, extended = true, weight = 1000 }) surface.CreateFont("nutGenericLightFont", { font = font, - size = 20, + size = 20 * scale, extended = true, weight = 500 }) surface.CreateFont("nutChatFont", { font = font, - size = math.max(ScreenScale(7), 17), + size = math.max(ScreenScale(7), 17) * scale, extended = true, weight = 200 }) surface.CreateFont("nutChatFontItalics", { font = font, - size = math.max(ScreenScale(7), 17), + size = math.max(ScreenScale(7), 17) * scale, extended = true, weight = 200, italic = true @@ -133,21 +133,21 @@ function GM:LoadNutFonts(font, genericFont) surface.CreateFont("nutChatFontBold", { font = font, - size = math.max(ScreenScale(7), 17), + size = math.max(ScreenScale(7), 17) * scale, extended = true, weight = 800, }) surface.CreateFont("nutSmallFont", { font = font, - size = math.max(ScreenScale(6), 17), + size = math.max(ScreenScale(6), 17) * scale, extended = true, weight = 500 }) surface.CreateFont("nutItemDescFont", { font = font, - size = math.max(ScreenScale(6), 17), + size = math.max(ScreenScale(6), 17) * scale, extended = true, shadow = true, weight = 500 @@ -155,7 +155,7 @@ function GM:LoadNutFonts(font, genericFont) surface.CreateFont("nutSmallBoldFont", { font = font, - size = math.max(ScreenScale(8), 20), + size = math.max(ScreenScale(8), 20) * scale, extended = true, weight = 800 }) @@ -163,7 +163,7 @@ function GM:LoadNutFonts(font, genericFont) surface.CreateFont("nutItemBoldFont", { font = font, shadow = true, - size = math.max(ScreenScale(8), 20), + size = math.max(ScreenScale(8), 20) * scale, extended = true, weight = 800 }) @@ -286,7 +286,6 @@ end function GM:CharacterListLoaded() local shouldPlayIntro = nut.config.get("alwaysPlayIntro", true) or not nut.localData.intro or nil - print("shouldPlayIntro", shouldPlayIntro) timer.Create("nutWaitUntilPlayerValid", 0.5, 0, function() if (not IsValid(LocalPlayer())) then return end timer.Remove("nutWaitUntilPlayerValid") @@ -345,7 +344,7 @@ function GM:CalcView(client, origin, angles, fov) view.origin = data.Pos view.angles = data.Ang end - + return view end end @@ -387,7 +386,7 @@ end function GM:PlayerBindPress(client, bind, pressed) bind = bind:lower() - + if ((bind:find("use") or bind:find("attack")) and pressed) then local menu, callback = nut.menu.getActiveMenu() @@ -428,7 +427,7 @@ function GM:ItemShowEntityMenu(entity) local options = {} local itemTable = entity:getItemTable() - if (!itemTable) then return end -- MARK: This is the where error came from. + if (not itemTable) then return end -- MARK: This is the where error came from. local function callback(index) if (IsValid(entity)) then @@ -440,16 +439,14 @@ function GM:ItemShowEntityMenu(entity) itemTable.entity = entity if (input.IsShiftDown()) then - callback("take") + callback("take") end for k, v in SortedPairs(itemTable.functions) do if (k == "combine") then continue end -- yeah, noob protection - if (isfunction(v.onCanRun)) then - if (not v.onCanRun(itemTable)) then - continue - end + if (isfunction(v.onCanRun)) and (not v.onCanRun(itemTable)) then + continue end options[L(v.name or k)] = function() @@ -505,7 +502,7 @@ function GM:SetupQuickMenu(menu) local button = menu:addCheck(name, function(panel) panel.checked = true - + if (IsValid(current)) then if (current == panel) then return @@ -518,7 +515,7 @@ function GM:SetupQuickMenu(menu) RunConsoleCommand("nut_language", k) end, enabled) - if (enabled and !IsValid(current)) then + if (enabled and not IsValid(current)) then current = button end end diff --git a/gamemode/core/hooks/sh_hooks.lua b/gamemode/core/hooks/sh_hooks.lua index df8dbdad..aa94c1e1 100644 --- a/gamemode/core/hooks/sh_hooks.lua +++ b/gamemode/core/hooks/sh_hooks.lua @@ -214,7 +214,7 @@ end function GM:CalcMainActivity(client, velocity) client.CalcIdeal = ACT_MP_STAND_IDLE - + oldCalcSeqOverride = client.CalcSeqOverride client.CalcSeqOverride = -1 @@ -270,6 +270,15 @@ function GM:GetDefaultCharName(client, faction) end end +function GM:GetDefaultCharDesc(client, faction) + local info = nut.faction.indices[faction] + + if (info and info.onGetDefaultDesc) then + return info:onGetDefaultDesc(client) + end +end + + function GM:CanPlayerUseChar(client, char) local banned = char:getData("banned") @@ -301,7 +310,7 @@ function GM:CheckFactionLimitReached(faction, character, client) -- By default, the limit is the number of players allowed in that faction. local maxPlayers = faction.limit - + -- If some number less than 1, treat it as a percentage of the player count. if (faction.limit < 1) then maxPlayers = math.Round(#player.GetAll() * faction.limit) @@ -326,7 +335,7 @@ function GM:PhysgunPickup(client, entity) if (client:IsSuperAdmin()) then return true end - + if (client:IsAdmin() and !(entity:IsPlayer() and entity:IsSuperAdmin())) then return true end @@ -364,8 +373,8 @@ function GM:Move(client, moveData) ms = ratio end - moveData:SetForwardSpeed(mf * speed) - moveData:SetSideSpeed(ms * speed) + moveData:SetForwardSpeed(mf * speed) + moveData:SetSideSpeed(ms * speed) end end end @@ -373,7 +382,7 @@ end function GM:CanItemBeTransfered(itemObject, curInv, inventory) if (itemObject.onCanBeTransfered) then local itemHook = itemObject:onCanBeTransfered(curInv, inventory) - + return (itemHook ~= false) end end diff --git a/gamemode/core/hooks/sv_hooks.lua b/gamemode/core/hooks/sv_hooks.lua index 9609dd18..a1911aa7 100644 --- a/gamemode/core/hooks/sv_hooks.lua +++ b/gamemode/core/hooks/sv_hooks.lua @@ -728,7 +728,7 @@ function GM:CreateSalaryTimer(client) local class = nut.class.list[character:getClass()] local pay = hook.Run("GetSalaryAmount", client, faction, class) or (class and class.pay) or (faction and faction.pay) or nil - + local limit = hook.Run("GetSalaryLimit", client, faction, class) or (class and class.payLimit) or (faction and faction.playLimit) or nil if (not pay) then return end local timerID = "nutSalary"..client:SteamID() @@ -740,7 +740,9 @@ function GM:CreateSalaryTimer(client) timer.Remove(timerID) return end - + if limit and character:getMoney() >= limit then + return + end character:giveMoney(pay) client:notifyLocalized("salary", nut.currency.get(pay)) end) diff --git a/gamemode/core/libs/sh_character.lua b/gamemode/core/libs/sh_character.lua index 8338bd0d..29dcaec4 100644 --- a/gamemode/core/libs/sh_character.lua +++ b/gamemode/core/libs/sh_character.lua @@ -265,10 +265,16 @@ do newData.data.skin = model[2] or 0 local groups = {} - local i = 0 - for value in model[3]:gmatch("%d") do - groups[i] = tonumber(value) - i = i + 1 + if isstring(model[3]) then + local i = 0 + for value in model[3]:gmatch("%d") do + groups[i] = tonumber(value) + i = i + 1 + end + elseif istable(model[3]) then + for k, v in pairs(model[3]) do + groups[tonumber(k)] = tonumber(v) + end end newData.data.groups = groups end @@ -422,7 +428,7 @@ do function playerMeta:Name() local character = self.getChar(self) - + return character and character.getName(character) or self.steamName(self) diff --git a/gamemode/core/libs/sh_chatbox.lua b/gamemode/core/libs/sh_chatbox.lua index db0b4e41..8efd7614 100644 --- a/gamemode/core/libs/sh_chatbox.lua +++ b/gamemode/core/libs/sh_chatbox.lua @@ -3,22 +3,41 @@ nut.chat.classes = nut.char.classes or {} local DUMMY_COMMAND = {syntax = "", onRun = function() end} -if (!nut.command) then +if (not nut.command) then include("sh_command.lua") end -- Returns a timestamp function nut.chat.timestamp(ooc) - return nut.config.get("chatShowTime") and (ooc and " " or "").."("..nut.date.getFormatted("%H:%M")..")"..(ooc and "" or " ") or "" + return nut.config.get("chatShowTime") and (ooc and " " or "") .. "(" .. nut.date.getFormatted("%H:%M") .. ")" .. (ooc and "" or " ") or "" end -- Registers a new chat type with the information provided. function nut.chat.register(chatType, data) - if (!data.onCanHear) then - -- Have a substitute if the canHear property is not found. - data.onCanHear = function(speaker, listener) - -- The speaker will be heard by everyone. - return true + if (not data.onCanHear) then + -- Let's see first if a dynamic radius has been set. + if (isfunction(data.radius)) then + -- If this is the case, then it gives the same situation where onCanHear property is a number. + -- But instead of entering a static number, the radius function will be called each time. + -- This can be useful if you want it to be linked to a variable that can be changed. + data.onCanHear = function(speaker, listener) + -- Squared distances will always perform better than standard distances. + return (speaker:GetPos() - listener:GetPos()):LengthSqr() <= (data.radius() ^ 2) + end + elseif (isnumber(data.radius)) then + -- To avoid confusion, the radius can be a static number. + -- In this case, we use the same method as the one used for the "onCanHear" property. + local range = data.radius ^ 2 + + data.onCanHear = function(speaker, listener) + return (speaker:GetPos() - listener:GetPos()):LengthSqr() <= range + end + else + -- Have a substitute if the canHear and radius properties are not found. + data.onCanHear = function(speaker, listener) + -- The speaker will be heard by everyone. + return true + end end elseif (isnumber(data.onCanHear)) then -- Use the value as a range and create a function to compare distances. @@ -31,9 +50,9 @@ function nut.chat.register(chatType, data) end -- Allow players to use this chat type by default. - if (!data.onCanSay) then + if (not data.onCanSay) then data.onCanSay = function(speaker, text) - if (!data.deadCanChat and !speaker:Alive()) then + if (not data.deadCanChat and not speaker:Alive()) then speaker:notifyLocalized("noPerm") return false @@ -46,19 +65,19 @@ function nut.chat.register(chatType, data) -- Chat text color. data.color = data.color or Color(242, 230, 160) - if (!data.onChatAdd) then + if (not data.onChatAdd) then data.format = data.format or "%s: \"%s\"" data.onChatAdd = function(speaker, text, anonymous) local color = data.color - local name = anonymous and L"someone" or hook.Run("GetDisplayedName", speaker, chatType) or (IsValid(speaker) and speaker:Name() or "Console") + local name = anonymous and L("someone") or hook.Run("GetDisplayedName", speaker, chatType) or (IsValid(speaker) and speaker:Name() or "Console") if (data.onGetColor) then color = data.onGetColor(speaker, text) end local timestamp = nut.chat.timestamp(false) - local translated = L2(chatType.."Format", name, text) + local translated = L2(chatType .. "Format", name, text) chat.AddText(timestamp, color, translated or string.format(data.format, name, text)) end @@ -66,7 +85,7 @@ function nut.chat.register(chatType, data) if (CLIENT and data.prefix) then if (type(data.prefix) == "table") then - for k, v in ipairs(data.prefix) do + for _, v in ipairs(data.prefix) do if (v:sub(1, 1) == "/") then nut.command.add(v:sub(2), DUMMY_COMMAND) end @@ -97,17 +116,17 @@ function nut.chat.parse(client, message, noSend) if (type(v.prefix) == "table") then for _, prefix in ipairs(v.prefix) do -- Checking if the start of the message has the prefix. - if (message:sub(1, #prefix + (noSpaceAfter and 0 or 1)):lower() == prefix..(noSpaceAfter and "" or " "):lower()) then + if (message:sub(1, #prefix + (noSpaceAfter and 0 or 1)):lower() == prefix .. (noSpaceAfter and "" or " "):lower()) then isChosen = true - chosenPrefix = prefix..(v.noSpaceAfter and "" or " ") + chosenPrefix = prefix .. (v.noSpaceAfter and "" or " ") break end end -- Otherwise the prefix itself is checked. elseif (type(v.prefix) == "string") then - isChosen = message:sub(1, #v.prefix + (noSpaceAfter and 1 or 0)):lower() == v.prefix..(noSpaceAfter and "" or " "):lower() - chosenPrefix = v.prefix..(v.noSpaceAfter and "" or " ") + isChosen = message:sub(1, #v.prefix + (noSpaceAfter and 1 or 0)):lower() == v.prefix .. (noSpaceAfter and "" or " "):lower() + chosenPrefix = v.prefix .. (v.noSpaceAfter and "" or " ") end -- If the checks say we have the proper chat type, then the chat type is the chosen one! @@ -127,12 +146,12 @@ function nut.chat.parse(client, message, noSend) end end - if (!message:find("%S")) then + if (not message:find("%S")) then return end -- Only send if needed. - if (SERVER and !noSend) then + if (SERVER and not noSend) then -- Send the correct chat type out so other player see the message. nut.chat.send(client, chatType, hook.Run("PlayerMessageSend", client, chatType, message, anonymous) or message, anonymous) end @@ -148,10 +167,10 @@ if (SERVER) then local class = nut.chat.classes[chatType] if (class and class.onCanSay(speaker, text) ~= false) then - if (class.onCanHear and !receivers) then + if (class.onCanHear and not receivers) then receivers = {} - for k, v in ipairs(player.GetAll()) do + for _, v in ipairs(player.GetAll()) do if (v:getChar() and class.onCanHear(speaker, v) ~= false) then receivers[#receivers + 1] = v end @@ -202,14 +221,16 @@ do -- Otherwise, use the normal chat color. return nut.config.get("chatColor") end, - onCanHear = nut.config.get("chatRange", 280) + radius = function() + return nut.config.get("chatRange", 280) + end }) -- Actions and such. nut.chat.register("me", { format = "**%s %s", onGetColor = nut.chat.classes.ic.onGetColor, - onCanHear = nut.config.get("chatRange", 280), + radius = function() return nut.config.get("chatRange", 280) end, prefix = {"/me", "/action"}, font = "nutChatFontItalics", filter = "actions", @@ -219,9 +240,11 @@ do -- Actions and such. nut.chat.register("it", { onChatAdd = function(speaker, text) - chat.AddText(nut.chat.timestamp(false), nut.config.get("chatColor"), "**"..text) + chat.AddText(nut.chat.timestamp(false), nut.config.get("chatColor"), "**" .. text) + end, + radius = function() + return nut.config.get("chatRange", 280) end, - onCanHear = nut.config.get("chatRange", 280), prefix = {"/it"}, font = "nutChatFontItalics", filter = "actions", @@ -237,7 +260,9 @@ do -- Make the whisper chat slightly darker than IC chat. return Color(color.r - 35, color.g - 35, color.b - 35) end, - onCanHear = nut.config.get("chatRange", 280) * 0.25, + radius = function() + return nut.config.get("chatRange", 280) * 0.25 + end, prefix = {"/w", "/whisper"} }) @@ -250,37 +275,36 @@ do -- Make the yell chat slightly brighter than IC chat. return Color(color.r + 35, color.g + 35, color.b + 35) end, - onCanHear = nut.config.get("chatRange", 280) * 2, + radius = function() + return nut.config.get("chatRange", 280) * 2 + end, prefix = {"/y", "/yell"} }) -- Out of character. nut.chat.register("ooc", { onCanSay = function(speaker, text) - if (!nut.config.get("allowGlobalOOC")) then - speaker:notifyLocalized("Global OOC is disabled on this server.") - return false - else - local delay = nut.config.get("oocDelay", 10) - - -- Only need to check the time if they have spoken in OOC chat before. - if (delay > 0 and speaker.nutLastOOC) then - local lastOOC = CurTime() - speaker.nutLastOOC - - -- Use this method of checking time in case the oocDelay config changes. - if (lastOOC <= delay) then - -- Admin delay bypass - if (!speaker:IsAdmin() or speaker:IsAdmin() and nut.config.get("oocDelayAdmin", false)) then + if (not nut.config.get("allowGlobalOOC")) then + speaker:notifyLocalized("Global OOC is disabled on this server.") + return false + else + local delay = nut.config.get("oocDelay", 10) + + -- Only need to check the time if they have spoken in OOC chat before. + if (delay > 0 and speaker.nutLastOOC) then + local lastOOC = CurTime() - speaker.nutLastOOC + + -- Use this method of checking time in case the oocDelay config changes (may not affect admins). + if (lastOOC <= delay and (not speaker:IsAdmin() or speaker:IsAdmin() and nut.config.get("oocDelayAdmin", false))) then speaker:notifyLocalized("oocDelay", delay - math.ceil(lastOOC)) return false end end - end - -- Save the last time they spoke in OOC. - speaker.nutLastOOC = CurTime() - end + -- Save the last time they spoke in OOC. + speaker.nutLastOOC = CurTime() + end end, onChatAdd = function(speaker, text) local icon = "icon16/user.png" @@ -309,7 +333,7 @@ do icon = Material(hook.Run("GetPlayerIcon", speaker) or icon) - chat.AddText(icon, nut.chat.timestamp(true), Color(255, 50, 50), " [OOC] ", speaker, color_white, ": "..text) + chat.AddText(icon, nut.chat.timestamp(true), Color(255, 50, 50), " [OOC] ", speaker, color_white, ": " .. text) end, prefix = {"//", "/ooc"}, noSpaceAfter = true, @@ -322,19 +346,14 @@ do local delay = nut.config.get("loocDelay", 0) -- Only need to check the time if they have spoken in LOOC chat before. - if (speaker:IsAdmin() and nut.config.get("loocDelayAdmin", false)) then - if (delay > 0 and speaker.nutLastLOOC) then - local lastLOOC = CurTime() - speaker.nutLastLOOC - - -- Use this method of checking time in case the oocDelay config changes. - if (lastLOOC <= delay) then - -- Admin delay bypass - if (!speaker:IsAdmin() or speaker:IsAdmin() and nut.config.get("oocDelayAdmin", false)) then - speaker:notifyLocalized("oocDelay", delay - math.ceil(lastOOC)) - - return false - end - end + if (speaker:IsAdmin() and nut.config.get("loocDelayAdmin", false) and delay > 0 and speaker.nutLastLOOC) then + local lastLOOC = CurTime() - speaker.nutLastLOOC + + -- Use this method of checking time in case the oocDelay config changes (may not affect admins). + if (lastLOOC <= delay and (not speaker:IsAdmin() or speaker:IsAdmin() and nut.config.get("loocDelayAdmin", false))) then + speaker:notifyLocalized("loocDelay", delay - math.ceil(lastLOOC)) + + return false end end @@ -342,9 +361,11 @@ do speaker.nutLastLOOC = CurTime() end, onChatAdd = function(speaker, text) - chat.AddText(nut.chat.timestamp(false), Color(255, 50, 50), "[LOOC] ", nut.config.get("chatColor"), speaker:Name()..": "..text) + chat.AddText(nut.chat.timestamp(false), Color(255, 50, 50), "[LOOC] ", nut.config.get("chatColor"), speaker:Name() .. ": " .. text) + end, + radius = function() + return nut.config.get("chatRange", 280) end, - onCanHear = nut.config.get("chatRange", 280), prefix = {".//", "[[", "/looc"}, noSpaceAfter = true, filter = "ooc" @@ -356,7 +377,7 @@ do color = Color(155, 111, 176), filter = "actions", font = "nutChatFontItalics", - onCanHear = nut.config.get("chatRange", 280), + radius = function() return nut.config.get("chatRange", 280) end, deadCanChat = true }) end) @@ -375,7 +396,6 @@ nut.chat.register("event", { onCanSay = function(speaker, text) return speaker:IsAdmin() end, - onCanHear = 1000000, onChatAdd = function(speaker, text) chat.AddText(nut.chat.timestamp(false), Color(255, 150, 0), text) end, diff --git a/gamemode/core/libs/sh_command.lua b/gamemode/core/libs/sh_command.lua index 4e0126d0..54a5f802 100644 --- a/gamemode/core/libs/sh_command.lua +++ b/gamemode/core/libs/sh_command.lua @@ -56,10 +56,10 @@ function nut.command.add(command, data) data._onRun = data.onRun -- for refactoring purpose. data.onRun = function(client, arguments) - if (!onCheckAccess(client)) then - return "@noPerm" - else + if (hook.Run("CanPlayerUseCommand", client, command) or onCheckAccess(client)) then return onRun(client, arguments) + else + return "@noPerm" end end end diff --git a/gamemode/core/meta/inventory/sv_base_inventory.lua b/gamemode/core/meta/inventory/sv_base_inventory.lua index cff23a0a..412f6e83 100644 --- a/gamemode/core/meta/inventory/sv_base_inventory.lua +++ b/gamemode/core/meta/inventory/sv_base_inventory.lua @@ -285,7 +285,7 @@ function Inventory:sync(recipients) net.WriteType(self.id) net.WriteString(self.typeID) net.WriteTable(self.data) - net.WriteUInt(table.Count(self.items), 32) + net.WriteUInt(table.Count(self.items), 32) local function writeItem(item) net.WriteUInt(item:getID(), 32) net.WriteString(item.uniqueID) diff --git a/gamemode/core/meta/item/sv_item.lua b/gamemode/core/meta/item/sv_item.lua index 5f49778f..950c1074 100644 --- a/gamemode/core/meta/item/sv_item.lua +++ b/gamemode/core/meta/item/sv_item.lua @@ -101,6 +101,21 @@ function ITEM:spawn(position, angles) end end +function ITEM:transfer(newInventory,bBypass) + if (!bBypass and !newInventory:canAccess("transfer")) then + return false + end + + local inventory = nut.inventory.instances[self.invID] + + inventory:removeItem(self.id, true) + :next(function() + newInventory:add(self) + end) + + return true +end + -- Called when an instance of this item has been created. function ITEM:onInstanced(id) end diff --git a/gamemode/core/meta/sh_item.lua b/gamemode/core/meta/sh_item.lua index ffe77d51..ceadc567 100644 --- a/gamemode/core/meta/sh_item.lua +++ b/gamemode/core/meta/sh_item.lua @@ -50,6 +50,14 @@ else end end +function ITEM:getModel() + return self.model +end + +function ITEM:getSkin() + return self.skin +end + function ITEM:getPrice() local price = self.price diff --git a/gamemode/core/sh_commands.lua b/gamemode/core/sh_commands.lua index 43d722b2..b7528379 100644 --- a/gamemode/core/sh_commands.lua +++ b/gamemode/core/sh_commands.lua @@ -66,12 +66,12 @@ nut.command.add("flaggive", { if (IsValid(target) and target:getChar()) then local flags = arguments[2] - if (!flags) then + if (not flags) then local available = "" -- Aesthetics~~ for k in SortedPairs(nut.flag.list) do - if (!target:getChar():hasFlags(k)) then + if (not target:getChar():hasFlags(k)) then available = available..k end end @@ -97,7 +97,7 @@ nut.command.add("flagtake", { if (IsValid(target) and target:getChar()) then local flags = arguments[2] - if (!flags) then + if (not flags) then return client:requestString("@flagTakeTitle", "@flagTakeDesc", function(text) nut.command.run(client, "flagtake", {target:Name(), text}) end, target:getChar():getFlags()) @@ -114,7 +114,7 @@ nut.command.add("charsetmodel", { adminOnly = true, syntax = " ", onRun = function(client, arguments) - if (!arguments[2]) then + if (not arguments[2]) then return L("invalidArg", client, 2) end @@ -179,7 +179,7 @@ nut.command.add("charsetname", { onRun = function(client, arguments) local target = nut.command.findPlayer(client, arguments[1]) - if (IsValid(target) and !arguments[2]) then + if (IsValid(target) and not arguments[2]) then return client:requestString("@chgName", "@chgNameDesc", function(text) nut.command.run(client, "charsetname", {target:Name(), text}) end, target:Name()) @@ -201,7 +201,7 @@ nut.command.add("chargiveitem", { adminOnly = true, syntax = " ", onRun = function(client, arguments) - if (!arguments[2]) then + if (not arguments[2]) then return L("invalidArg", client, 2) end @@ -211,7 +211,7 @@ nut.command.add("chargiveitem", { local uniqueID = arguments[2]:lower() local amount = tonumber(arguments[3]) - if (!nut.item.list[uniqueID]) then + if (not nut.item.list[uniqueID]) then for k, v in SortedPairs(nut.item.list) do if (nut.util.stringMatches(v.name, uniqueID)) then uniqueID = k @@ -221,7 +221,7 @@ nut.command.add("chargiveitem", { end end - if (arguments[3] and arguments[3] ~= "") and (!amount) then + if (arguments[3] and arguments[3] ~= "") and (not amount) then return L("invalidArg", client, 3) end @@ -312,14 +312,14 @@ nut.command.add("charunban", { client.nutNextSearch = 0 - if (!data.banned) then + if (not data.banned) then return client:notifyLocalized("charNotBanned") end data.banned = nil nut.db.updateTable({_data = data}, nil, nil, "_id = "..charID) - nut.util.notifyLocalized("charUnBan", nil, client:Name(), v:getName()) + nut.util.notifyLocalized("charUnBan", nil, client:Name(), nut.char.loaded[charID]:getName()) end end) end @@ -332,7 +332,7 @@ nut.command.add("givemoney", { number = number or 0 local amount = math.floor(number) - if (!amount or !isnumber(amount) or amount <= 0) then + if (not amount or not isnumber(amount) or amount <= 0) then return L("invalidArg", client, 1) end @@ -345,7 +345,7 @@ nut.command.add("givemoney", { if (IsValid(target) and target:IsPlayer() and target:getChar()) then amount = math.Round(amount) - if (!client:getChar():hasMoney(amount)) then + if (not client:getChar():hasMoney(amount)) then return end @@ -366,7 +366,7 @@ nut.command.add("charsetmoney", { onRun = function(client, arguments) local amount = tonumber(arguments[2]) - if (!amount or !isnumber(amount) or amount < 0) then + if (not amount or not isnumber(amount) or amount < 0) then return "@invalidArg", 2 end @@ -374,7 +374,7 @@ nut.command.add("charsetmoney", { if (IsValid(target)) then local char = target:getChar() - + if (char and amount) then amount = math.Round(amount) char:setMoney(amount) @@ -389,13 +389,13 @@ nut.command.add("dropmoney", { onRun = function(client, arguments) local amount = tonumber(arguments[1]) - if (!amount or !isnumber(amount) or amount < 1) then + if (not amount or not isnumber(amount) or amount < 1) then return "@invalidArg", 1 end amount = math.Round(amount) - - if (!client:getChar():hasMoney(amount)) then + + if (not client:getChar():hasMoney(amount)) then return end @@ -403,7 +403,7 @@ nut.command.add("dropmoney", { local money = nut.currency.spawn(client:getItemDropPos(), amount) money.client = client money.charID = client:getChar():getID() - + client:doGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_GMOD_GESTURE_ITEM_PLACE, true) end }) @@ -432,11 +432,11 @@ nut.command.add("chargetup", { onRun = function(client, arguments) local entity = client.nutRagdoll - if (IsValid(entity) and entity.nutGrace and entity.nutGrace < CurTime() and entity:GetVelocity():Length2D() < 8 and !entity.nutWakingUp) then + if (IsValid(entity) and entity.nutGrace and entity.nutGrace < CurTime() and entity:GetVelocity():Length2D() < 8 and not entity.nutWakingUp) then entity.nutWakingUp = true client:setAction("@gettingUp", 5, function() - if (!IsValid(entity)) then + if (not IsValid(entity)) then return end @@ -451,7 +451,7 @@ nut.command.add("plyunwhitelist", { syntax = " ", onRun = function(client, arguments) local target = nut.command.findPlayer(client, arguments[1]) - + if (IsValid(target)) then local faction = nut.command.findFaction(client,table.concat(arguments, " ", 2)) @@ -471,7 +471,7 @@ nut.command.add("fallover", { onRun = function(client, arguments) local time = tonumber(arguments[1]) - if (!isnumber(time)) then + if (not isnumber(time)) then time = 5 end @@ -481,7 +481,7 @@ nut.command.add("fallover", { time = nil end - if (!IsValid(client.nutRagdoll)) then + if (not IsValid(client.nutRagdoll)) then client:setRagdolled(true, time) end end @@ -495,7 +495,7 @@ nut.command.add("beclass", { if (IsValid(client) and char) then local num = isnumber(tonumber(class)) and tonumber(class) or -1 - + if (nut.class.list[num]) then local v = nut.class.list[num] @@ -523,7 +523,7 @@ nut.command.add("beclass", { end end end - + client:notifyLocalized("invalid", L("class", client)) else client:notifyLocalized("illegalAccess") @@ -536,7 +536,7 @@ nut.command.add("chardesc", { onRun = function(client, arguments) arguments = table.concat(arguments, " ") - if (!arguments:find("%S")) then + if (not arguments:find("%S")) then return client:requestString("@chgDesc", "@chgDescDesc", function(text) nut.command.run(client, "chardesc", {text}) end, client:getChar():getDesc()) @@ -584,7 +584,8 @@ nut.command.add("plytransfer", { v, client:Name(), target:Name(), L(faction.name, v) ) end - end + end, + alias = "charsetfaction" }) -- Credit goes to SmithyStanley @@ -593,7 +594,7 @@ nut.command.add("clearinv", { syntax = "", onRun = function (client, arguments) local target = nut.command.findPlayer(client, arguments[1]) - + if (IsValid(target) and target:getChar()) then for k, v in pairs(target:getChar():getInv():getItems()) do v:remove() diff --git a/gamemode/core/sh_config.lua b/gamemode/core/sh_config.lua index 6d725bd2..d0407163 100644 --- a/gamemode/core/sh_config.lua +++ b/gamemode/core/sh_config.lua @@ -2,10 +2,10 @@ nut.config = nut.config or {} nut.config.stored = nut.config.stored or {} function nut.config.add(key, value, desc, callback, data, noNetworking, schemaOnly) - assert(isstring(key), "expected config key to be string, got "..type(key)) + assert(isstring(key), "expected config key to be string, got " .. type(key)) local oldConfig = nut.config.stored[key] - nut.config.stored[key] = {data = data, value = oldConfig and oldConfig.value or value, default = value, desc = desc, noNetworking = noNetworking, global = !schemaOnly, callback = callback} + nut.config.stored[key] = {data = data, value = oldConfig and oldConfig.value or value, default = value, desc = desc, noNetworking = noNetworking, global = not schemaOnly, callback = callback} end function nut.config.setDefault(key, value) @@ -36,7 +36,7 @@ function nut.config.set(key, value) config.value = value if (SERVER) then - if (!config.noNetworking) then + if (not config.noNetworking) then netstream.Start(nil, "cfgSet", key, value) end @@ -132,14 +132,14 @@ if (SERVER) then local count = table.Count(value) local i = 1 - for k, v in SortedPairs(value) do - value2 = value2..v..(i == count and "]" or ", ") + for _, v in SortedPairs(value) do + value2 = value2 .. v .. (i == count and "]" or ", ") i = i + 1 end value = value2 end - nut.util.notifyLocalized("cfgSet", nil, client:Name(), key, tostring(value), v) + nut.util.notifyLocalized("cfgSet", nil, client:Name(), key, tostring(value)) end end) else @@ -182,94 +182,111 @@ end if (CLIENT) then hook.Add("CreateMenuButtons", "nutConfig", function(tabs) - if (LocalPlayer():IsSuperAdmin() and hook.Run("CanPlayerUseConfig", LocalPlayer()) ~= false) then - tabs["config"] = function(panel) - local scroll = panel:Add("DScrollPanel") - scroll:Dock(FILL) + if (not LocalPlayer():IsSuperAdmin() or hook.Run("CanPlayerUseConfig", LocalPlayer()) == false) then + return + end - hook.Run("CreateConfigPanel", panel) + tabs["config"] = function(panel) + local scroll = panel:Add("DScrollPanel") + scroll:Dock(FILL) - local properties = scroll:Add("DProperties") - properties:SetSize(panel:GetSize()) + hook.Run("CreateConfigPanel", panel) - nut.gui.properties = properties + local properties = scroll:Add("DProperties") + properties:SetSize(panel:GetSize()) - -- We're about to store the categories in this buffer. - local buffer = {} + nut.gui.properties = properties - for k, v in pairs(nut.config.stored) do - -- Get the category name. - local index = v.data and v.data.category or "misc" + -- We're about to store the categories in this buffer. + local buffer = {} - -- Insert the config into the category list. - buffer[index] = buffer[index] or {} - buffer[index][k] = v - end + for k, v in pairs(nut.config.stored) do + -- Get the category name. + local index = v.data and v.data.category or "misc" - -- Loop through the categories in alphabetical order. - for category, configs in SortedPairs(buffer) do - category = L(category) - - -- Ditto, except we're looping through configs. - for k, v in SortedPairs(configs) do - -- Determine which type of panel to create. - local form = v.data and v.data.form - local value = nut.config.stored[k].default - - if (!form) then - local formType = type(value) - - if (formType == "number") then - form = "Int" - value = tonumber(nut.config.get(k)) or value - elseif (formType == "boolean") then - form = "Boolean" - value = tobool(nut.config.get(k)) - else - form = "Generic" - value = nut.config.get(k) or value - end - end + -- Insert the config into the category list. + buffer[index] = buffer[index] or {} + buffer[index][k] = v + end - -- VectorColor currently only exists for DProperties. - if (form == "Generic" and type(value) == "table" and value.r and value.g and value.b) then - -- Convert the color to a vector. - value = Vector(value.r / 255, value.g / 255, value.b / 255) - form = "VectorColor" + -- Loop through the categories in alphabetical order. + for category, configs in SortedPairs(buffer) do + category = L(category) + + -- Ditto, except we're looping through configs. + for k, v in SortedPairs(configs) do + -- Determine which type of panel to create. + local form = v.data and v.data.form + local value = nut.config.stored[k].default + + -- Let's see if the parameter has a form to perform some additional operations. + if (form) then + if (form == "Int") then + -- math.Round can create an error without failing silently as expected if the parameter is invalid. + -- So an alternate value is entered directly into the function and not outside of it. + value = math.Round(nut.config.get(k) or value) + elseif (form == "Float") then + value = tonumber(nut.config.get(k)) or value + elseif (form == "Boolean") then + value = tobool(nut.config.get(k)) or value + else + value = nut.config.get(k) or value end + else + local formType = type(value) + + if (formType == "number") then + form = "Int" + value = tonumber(nut.config.get(k)) or value + elseif (formType == "boolean") then + form = "Boolean" + value = tobool(nut.config.get(k)) + else + form = "Generic" + value = nut.config.get(k) or value + end + end - local delay = 1 + -- VectorColor currently only exists for DProperties. + if (form == "Generic" and type(value) == "table" and value.r and value.g and value.b) then + -- Convert the color to a vector. + value = Vector(value.r / 255, value.g / 255, value.b / 255) + form = "VectorColor" + end - if (form == "Boolean") then - delay = 0 - end + local delay = 1 - -- Add a new row for the config to the properties. - local row = properties:CreateRow(category, tostring(k)) - row:Setup(form, v.data and v.data.data or {}) - row:SetValue(value) - row:SetTooltip(v.desc) - row.DataChanged = function(this, value) - timer.Create("nutCfgSend"..k, delay, 1, function() - if (IsValid(row)) then - if (form == "VectorColor") then - local vector = Vector(value) - - value = Color(math.floor(vector.x * 255), math.floor(vector.y * 255), math.floor(vector.z * 255)) - elseif (form == "Int" or form == "Float") then - value = tonumber(value) - - if (form == "Int") then - value = math.Round(value) - end - elseif (form == "Boolean") then - value = tobool(value) - end - - netstream.Start("cfgSet", k, value) + if (form == "Boolean") then + delay = 0 + end + + -- Add a new row for the config to the properties. + local row = properties:CreateRow(category, tostring(k)) + row:Setup(form, v.data and v.data.data or {}) + row:SetValue(value) + row:SetTooltip(v.desc) + row.DataChanged = function(this, newValue) + timer.Create("nutCfgSend" .. k, delay, 1, function() + if (not IsValid(row)) then + return + end + + if (form == "VectorColor") then + local vector = Vector(newValue) + + newValue = Color(math.floor(vector.x * 255), math.floor(vector.y * 255), math.floor(vector.z * 255)) + elseif (form == "Int" or form == "Float") then + newValue = tonumber(newValue) + + if (form == "Int") then + newValue = math.Round(newValue) end - end) - end + elseif (form == "Boolean") then + newValue = tobool(newValue) + end + + netstream.Start("cfgSet", k, newValue) + end) end end end diff --git a/gamemode/core/sh_util.lua b/gamemode/core/sh_util.lua index b0f94112..61201589 100644 --- a/gamemode/core/sh_util.lua +++ b/gamemode/core/sh_util.lua @@ -37,8 +37,8 @@ function nut.util.includeDir(directory, fromLua, recursive) baseDir = SCHEMA.folder.."/schema/" else baseDir = baseDir.."/gamemode/" - end - + end + if recursive then local function AddRecursive(folder) local files, folders = file.Find(folder.."/*", "LUA") diff --git a/gamemode/languages/sh_french.lua b/gamemode/languages/sh_french.lua index 311ed6ce..6e70ad9e 100644 --- a/gamemode/languages/sh_french.lua +++ b/gamemode/languages/sh_french.lua @@ -6,7 +6,7 @@ LANGUAGE = { dbError = "Connexion avec la base de données échouée", unknown = "Inconnu", noDesc = "Aucune description disponible", - create = "Créer", + create = "CrÉer", createTip = "Créer un nouveau personnage pour jouer avec.", load = "Charger", loadTip = "Charger un personnage crée auparavant pour jouer avec.", @@ -21,7 +21,6 @@ LANGUAGE = { charCreateTip = "Remplissez les champs ci-dessous et appuyez sur 'Terminer' pour créer votre personnage.", invalid = "Vous avez fourni un %s invalide", descMinLen = "Votre description doit comporter au moins %d caractère(s).", - model = "Modèle", player = "Joueur", finish = "Terminer", finishTip = "Terminer la création du personnage.", @@ -32,6 +31,7 @@ LANGUAGE = { no = "Non", yes = "Oui", itemInfo = "Nom: %s\nDescription: %s", + itemCreated = "L'objet à été créé avec succès.", cloud_no_repo = "Les référentiels fournies ne sont pas valides.", cloud_no_plugin = "Les plugins fournies ne sont pas valides.", inv = "Inventaire", @@ -39,8 +39,7 @@ LANGUAGE = { author = "Auteur", version = "Version", characters = "Personnages", - business = "Marché", - settings = "Options", + settings = "Paramètres", config = "Configuration", chat = "Chat", appearance = "Apparence", @@ -48,7 +47,6 @@ LANGUAGE = { oocDelay = "Vous devez attendre %s seconde(s) avant de pouvoir utiliser de nouveau le OOC.", loocDelay = "Vous devez attendre %s seconde(s) avant de pouvoir utiliser de nouveau le LOOC.", usingChar = "Vous utilisez déjà ce personnage.", - notAllowed = "Désolé, vous n'êtes pas autorisé à faire ceci.", itemNoExist = "Désolé, l'objet que vous avez demandé n'a pas été trouvé ou n'existe pas.", cmdNoExist = "Désolé, cette commande n'a pas été trouvé ou n'existe pas.", plyNoExist = "Désolé, le joueur n'a pas été trouvé ou n'existe pas.", @@ -84,29 +82,29 @@ LANGUAGE = { dSold = "Vous avez vendu cette porte pour %s.", notOwner = "Vous n'êtes pas le propriétaire de ceci.", invalidArg = "Vous avez fourni une valeur non valide pour l'argument #%s.", - invalidFaction = "La faction que vous avez fourni n'a pu être trouvée.", - flagGive = "%s a donné à %s les flag's '%s'.", - flagGiveTitle = "Donner flag's", - flagGiveDesc = "Donner les flag's suivants à un joueur.", - flagTake = "%s a retiré à %s les flag's '%s'.", - flagTakeTitle = "Retirer flag's", - flagTakeDesc = "Retirer les flag's suivant à un joueur.", - flagNoMatch = "Vous devez avoir le ou les flag's \"%s\" pour réaliser cette action.", + flagGive = "%s a donné à %s les drapeaux \"%s\".", + flagGiveTitle = "Donner drapeaux", + flagGiveDesc = "Donner les drapeaux suivants à un joueur.", + flagTake = "%s a retiré les drapeaux \"%s\" à %s.", + flagTakeTitle = "Retirer drapeaux", + flagTakeDesc = "Retirer les drapeaux suivants à un joueur.", + flagNoMatch = "Vous devez avoir le ou les drapeaux \"%s\" pour réaliser cette action.", textAdded = "Vous avez ajouté un texte.", textRemoved = "Vous avez supprimé %s texte(s).", moneyTaken = "Vous avez trouvé %s.", businessPurchase = "Vous avez acheté %s pour %s.", businessSell = "Vous avez vendu %s pour %s.", - cChangeModel = "%s a modifié le modèle %s's par %s.", - cChangeName = "%s a modifié le nom %s's par %s.", - cChangeSkin = "%s a modifié le skin %s's par %s.", - cChangeGroups = "%s a modifié le groupe %s's \"%s\" par %s.", - cChangeFaction = "%s a modifié la faction %s par %s.", + cChangeModel = "%s a modifié le modèle de %s par \"%s\".", + cChangeName = "%s a modifié le nom roleplay de %s par \"%s\".", + cChangeSkin = "%s a modifié la peau (skin) de %s par \"%s\".", + cChangeGroups = "%s a modifié le bodygroup de %s avec (nom: %s, index: %s).", + cChangeFaction = "%s a modifié la faction de %s par \"%s\".", playerCharBelonging = "Cet objet appartient à un autre de vos personnages.", business = "Marché", - invalidFaction = "Vous avez fourni un nom de faction invalide.", - spawnAdd = "Vous avez ajouté un spawn pour %s.", - spawnDeleted = "Vous avez supprimé %s point(s) de spawn.", + invalidFaction = "La faction que vous avez fourni n'a pu être trouvée.", + limitFaction = "Cette faction est complète. Réessayez plus tard.", + spawnAdd = "Vous avez ajouté un point d'apparition pour %s.", + spawnDeleted = "Vous avez supprimé %s point(s) d'apparition.", someone = "Quelqu'un", rgnLookingAt = "Permettre à la personne que vous regardez de vous reconnaître.", rgnWhisper = "Permettre à ceux qui vous entendent chuchoter de vous reconnaître.", @@ -117,9 +115,9 @@ LANGUAGE = { wFormat = "%s chuchote \"%s\"", yFormat = "%s crie \"%s\"", sbOptions = "Cliquez pour voir les options de %s.", - spawnAdded = "Vous avez ajouté un spawn pour %s.", - whitelist = "%s a whitelist %s pour la faction %s.", - unwhitelist = "%s a unwhitelist %s pour la faction %s.", + spawnAdded = "Vous avez ajouté un point d'apparition pour %s.", + whitelist = "%s a ajouté à la liste blanche %s pour la faction %s.", + unwhitelist = "%s a retiré de la liste blanche %s pour la faction %s.", gettingUp = "Vous êtes maintenant debout...", wakingUp = "Vous avez repris conscience...", Weapons = "Armes", @@ -166,13 +164,13 @@ LANGUAGE = { charBan = "%s a banni le personnage %s.", charBanned = "Ce personnage est banni.", setMoney = "Vous avez défini l'argent de %s à %s.", - itemPriceInfo = "Vous pouvez acheter cet objet pour %s.\nVous pouvez vendre cet objet pour %s", + itemPriceInfo = "Vous pouvez acheter cet objet pour %s.\nVous pouvez vendre cet objet pour %s.", free = "Gratuit", vendorNoSellItems = "Il n'y a pas d'objet à vendre.", vendorNoBuyItems = "Il n'y a pas d'objet à acheter.", vendorSettings = "Modifications", vendorUseMoney = "Le PNJ peut utiliser de l'argent?", - vendorNoBubble = "Cacher la bulle du PNJ?", + vendorNoBubble = "Cacher la bulle du PNJ ?", mode = "Mode", price = "Prix", stock = "Stock", @@ -183,8 +181,8 @@ LANGUAGE = { maxStock = "Max stock", vendorFaction = "Modification faction", buy = "Achat", - vendorWelcome = "Bienvenue dans mon magasin, tout ce que je peux vous obtenir se trouve ici!", - vendorBye = "À bientôt!", + vendorWelcome = "Bienvenue dans mon magasin, tout ce que je peux vous obtenir se trouve ici !", + vendorBye = "À bientôt !", charSearching = "Vous êtes déjà à la recherche d'un autre personnage, veuillez attendre.", charUnBan = "%s a débanni le personnage %s.", charNotBanned = "Ce personnage n'est pas interdit.", @@ -192,21 +190,24 @@ LANGUAGE = { storPassRmv = "Vous avez supprimé le mot de passe de ce stockage.", storPassWrite = "Entrez le mot de passe.", wrongPassword = "Vous avez entré un mauvais mot de passe.", - cheapBlur = "Désactiver le flou? (Gain FPS)", + cheapBlur = "Désactiver le flou ? (Gain FPS)", quickSettings = "Paramètres rapides", vmSet = "Vous avez défini votre messagerie vocale.", vmRem = "Vous avez supprimé votre messagerie vocale.", - altLower = "Cacher les mains quand elles sont abaissées?", - noPerm = "Vous n'êtes pas autorisé à faire ceci.", + altLower = "Cacher les mains quand elles sont baissées ?", + noPerm = "Vous n'êtes pas autorisé à faire ceci.", youreDead = "Vous êtes mort", injMajor = "Il semble grièvement blessé.", injLittle = "Il semble blessé.", - toggleESP = "Act/Des ESP Admin", + toggleObserverTP = "Activer l'observation des téléportations", + toggleESP = "Activer l'ESP admin", + toggleESPAdvanced = "Mode avancé de l'ESP", chgName = "Changer de nom", chgNameDesc = "Entrez le nouveau nom du personnage ci-dessous.", - thirdpersonToggle = "Act/Des Vue 3E Personne", - thirdpersonClassic = "Utilisation classique 3E Personne", - equippedBag = "Le sac que vous avez déplacé contient un ou plusieurs objets.", + thirdpersonToggle = "Activer la troisième personne", + thirdpersonClassic = "Utiliser troisième personne classique", + thirdpersonConfig = "Configuration troisième personne", + equippedBag = "Les objets équipés ne peuvent pas être déplacés entre les inventaires.", useTip = "Utiliser l'objet.", equipTip = "Équiper l'objet.", unequipTip = "Déséquiper l'objet.", @@ -217,16 +218,50 @@ LANGUAGE = { salary = "Vous avez reçu votre salaire, %s.", noRecog = "Vous ne connaissez pas cette personne.", curTime = "L'heure et la date actuelle, %s.", - vendorEditor = "Modifications", + vendorEditor = "Édition du vendeur", edit = "Éditer", disable = "Désactiver", vendorPriceReq = "Entrez le nouveau prix pour cet objet.", vendorEditCurStock = "Modifier le stock actuel", you = "Vous", vendorSellScale = "Échelle de prix de vente", - vendorNoTrade = "Vous n'êtes pas en mesure d'échanger avec ce vendeur.", - vendorNoMoney = "Ce vendeur ne peut vous acheter cet objet, il n'a plus d'argent.", - vendorNoStock = "Ce vendeur n'a pas cet objet en stock.", - contentTitle = "NutScript Contenu manquant", - contentWarning = "Vous ne devez pas avoir le contenu NutScript. Cela peut entraîner certains dysfonctionnements.\nAimeriez-vous ouvrir la page du Workshop, pour avoir le contenu NutScript?" + vendorNoTrade = "Vous ne pouvez pas faire de commerce avec ce vendeur.", + vendorNoMoney = "Ce vendeur ne peut pas se payer cet article.", + vendorNoStock = "Ce vendeur n'a pas cet article en stock.", + contentTitle = "Contenu NutScript manquant", + contentWarning = "Vous n'avez pas monté le contenu NutScript. Cela peut entraîner l'absence de certaines fonctionnalités. L'adresse du contenu NutScript a été remplacée par celle de rebel1324.\nVoulez-vous ouvrir la page de l'atelier pour le contenu NutScript ?", + flags = "Drapeaux", + chooseTip = "Choisissez ce personnage pour jouer avec lui.", + deleteTip = "Supprimez ce personnage.", + moneyLeft = "Votre argent : ", + currentMoney = "Argent restant : ", + + -- 2018 patch + + ammoLoadAll = "Tout charger", + ammoLoadAmount = "Charger %s", + ammoLoadCustom = "Chargement...", + split = "Diviser", + splitHelp = "Saisissez un nombre pour diviser.", + splitHalf = "Diviser 1/2", + splitQuarter = "Diviser 1/4", + recognize = "Permettez à ce personnage de vous reconnaître.", + recognized = "Tu as donné ton identité à ce personnage.", + already_recognized = "Ce personnage vous connaît déjà.", + isTied = "Cette personne a été attachée.", + tying = "Attachement", + untying = "Détachement", + beingUntied = "Tu as été détaché.", + beingTied = "Tu as été attaché.", + sameOutfitCategory = "Vous portez déjà ce type de tenue.", + noBusiness = "Vous n'êtes pas autorisé à acheter quoi que ce soit pour le moment.", + panelRemoved = "Vous avez supprimé %s interfaces 3D.", + panelAdded = "Vous avez ajouté une interface 3D.", + itemOnGround = "Votre article a été placé sur le sol.", + forbiddenActionStorage = "Vous ne pouvez pas faire cette action avec un objet stocké.", + cantDropBagHasEquipped = "Vous ne pouvez pas déposer un sac qui a un objet équipé.", + + -- 2021 patch + lookToUseAt = "Vous devez regarder quelqu'un pour utiliser '@'.", + mustProvideString = "Vous devez fournir une chaîne de caractères pour la variable", } diff --git a/gamemode/languages/sh_portuguese.lua b/gamemode/languages/sh_portuguese.lua new file mode 100644 index 00000000..25c570c5 --- /dev/null +++ b/gamemode/languages/sh_portuguese.lua @@ -0,0 +1,267 @@ +NAME = "Portuguese" ---//Contact Barata#2411 if you have any translation change suggestion\\---- + + +LANGUAGE = { + loading = "A carregar", + dbError = "Erro ao conectar à database", + unknown = "Desconhecido", + noDesc = "Nenhuma descrição disponível", + create = "Criar", + createTip = "Criar um novo personagem para jogar como.", + load = "Carregar", + loadTip = "Escolhe um personagem que já tenhas criado.", + leave = "Sair", + leaveTip = "Sair do servidor atual.", + ["return"] = "Retornar", + returnTip = "Retornar ao menu anterior.", + name = "Nome", + desc = "Descrição", + attribs = "Atributos", + charCreateTip = "Preenche os campos abaixo e pressiona 'Acabar' para criar o teu personagem.", + invalid = "Deste uma %s inválida", + descMinLen = "A tua descrição têm de ter pelo menos %d caracteres.", + model = "Modelo", + player = "Jogador", + finish = "Acabar", + finishTip = "Acabar de criar o teu personagem.", + needModel = "Escolhe um modelo válido", + creating = "O teu personagem está a ser criado...", + unknownError = "Ocorreu um erro desconhecido.", + delConfirm = "Tens a certeza que queres apagar %s PERMANENTEMENTE?", + no = "Não", + yes = "Sim", + itemInfo = "Nome: %s\nDescrição: %s", + itemCreated = "Objecto criado com sucesso.", + cloud_no_repo = "O repositório providenciado não é valido.", + cloud_no_plugin = "O plugin providenciado não é válido.", + inv = "Inventário", + plugins = "Plugins", + author = "Autor", + version = "Versão", + characters = "Personagens", + settings = "Definições", + config = "Configuração", + chat = "Chat", + appearance = "Aparencia", + misc = "Diversos", + oocDelay = "Deves esperar %s mais segundos antes de usares o OOC de novo.", + loocDelay = "Deves esperar %s mais segundos antes de usares o LOOC de novo.", + usingChar = "Já estás a usar este personagem.", + notAllowed = "Desculpa, não podes fazer isto.", + itemNoExist = "Desculpa, o item que pediste não existe.", + cmdNoExist = "Desculpa, o comando não existe.", + plyNoExist = "Desculpa, um jogador que procuras não foi encontrado.", + cfgSet = "%s mudou \"%s\" para %s.", + drop = "Largar", + dropTip = "Solta este objecto do teu inventário.", + take = "Levar", + takeTip = "Leva este item e põe no teu inventário.", + dTitle = "Porta sem dono", + dTitleOwned = "Porta Comprada", + dIsNotOwnable = "Esta porta não pode ser comprada.", + dIsOwnable = "Podes comprar esta porta ao clicar F2.", + dMadeUnownable = "Fizeste esta porta não ser comprável.", + dMadeOwnable = "Fizeste esta porta ser compravel.", + dNotAllowedToOwn = "Não podes comprar esta porta.", + dSetDisabled = "Desativaste esta porta.", + dSetNotDisabled = "Esta porta já não está desativada.", + dSetHidden = "Escondeste a porta.", + dSetNotHidden = "Esta porta já não está escondida.", + dSetParentDoor = "Tornaste esta porta numa porta parente.", + dCanNotSetAsChild = "Não pode tornar esta porta parente numa porta criança.", + dAddChildDoor = "Adicionaste esta porta como porta criança.", + dRemoveChildren = "Removeste todos os filhos de esta porta.", + dRemoveChildDoor = "Removeste esta porta de ser filho.", + dNoParentDoor = "Não tens uma porta parente definida.", + dOwnedBy = "Este porta é propriedade de %s.", + dConfigName = "Portas", + dSetFaction = "Esta porta pertence à facção %s.", + dRemoveFaction = "Esta porta já não pertence a uma facção.", + dNotValid = "Não estás a olhar para uma porta válida.", + canNotAfford = "Não tens dinheiro suficiente para comprar isto.", + dPurchased = "Compraste esta porta por %s.", + dSold = "Vendeste esta porta por %s.", + notOwner = "Não és o dono disto.", + invalidArg = "Deste um valor invalido para o argumento #%s.", + flagGive = "%s deu %s '%s' flags.", + flagGiveTitle = "Dar Flags", + flagGiveDesc = "Dar as flags seguintes ao jogador.", + flagTake = "%s tirou '%s' flags de %s.", + flagTakeTitle = "Tirar Flags", + flagTakeDesc = "Remover Flags do jogador.", + flagNoMatch = "Tu deves ter a Flag \"%s\" para fazeres isto.", + textAdded = "Adicionaste texto.", + textRemoved = "Removeste %s textos.", + moneyTaken = "Encontraste %s.", + businessPurchase = "Compraste %s por %s.", + businessSell = "Vendeste %s por %s.", + cChangeModel = "%s mudou o modelo de %s para %s.", + cChangeName = "%s mudou o nome de %s para %s.", + cChangeSkin = "%s mudou a skin de %s para %s.", + cChangeGroups = "%s mudou o bodygroup de %s \"%s\" para %s.", + cChangeFaction = "%s transferiu %s para a facção %s.", + playerCharBelonging = "Isto pertence a outro personagem.", + business = "Negócios", + invalidFaction = "Deste uma facção inválida.", + limitFaction = "Esta facção está cheia. Tenta mais tarde.", + spawnAdd = "Adicionaste um spawn para a %s.", + spawnDeleted = "Removeste %s spawn point(s).", + someone = "Alguém", + rgnLookingAt = "Permite que a pessoa te reconheça.", + rgnWhisper = "Permite que a(s) pessoa(s) na area de sussuro te reconheçam.", + rgnTalk = "Permite que a(s) pessoa(s) na area de fala te reconheçam.", + rgnYell = "Permite que a(s) pessoa(s) na area de gritar te reconheçam.", + icFormat = "%s diz \"%s\"", + rollFormat = "%s deu roll a %s.", + wFormat = "%s sussurra \"%s\"", + yFormat = "%s grita \"%s\"", + sbOptions = "Clica para veres as opções para %s.", + spawnAdded = "Adicionaste um spawn para %s.", + whitelist = "%s deu uma whitelist a %s para a facção %s.", + unwhitelist = "%s tirou uma whitelist a %s para a facção %s.", + gettingUp = "Estás a levantar-te...", + wakingUp = "Estás a ganhar consciência...", + Weapons = "Armas", + checkout = "Vai para o pagamento (%s)", + purchase = "Comprar", + purchasing = "Comprando...", + success = "Sucesso", + buyFailed = "Compra Falhada.", + buyGood = "Compra bem sucedida!", + shipment = "Remessa", + shipmentDesc = "Esta remessa pertence a %s.", + class = "Class", + classes = "Classes", + illegalAccess = "Acesso Ilegal.", + becomeClassFail = "Falhaste a tornar-te %s.", + becomeClass = "Tornaste-te %s.", + attribSet = "Definiste %s %s para %s.", + attribUpdate = "Adicionaste %s %s para %s.", + noFit = "Este item não cabe no teu inventário.", + help = "Ajuda", + commands = "Comandos", + helpDefault = "Selecionar Categoria", + doorSettings = "Definições da porta", + sell = "Vender", + access = "Acesso", + locking = "Trancando esta entidade...", + unlocking = "Desbloqueando esta entidade...", + modelNoSeq = "O teu modelo não suporta este ato.", + notNow = "Não és permitido a fazer isto agora.", + faceWall = "Deves estar a olhar para uma parede para fazer isto.", + faceWallBack = "Deves estar de costas para uma parede para fazer isto.", + descChanged = "Mudaste a aparência do teu personagem.", + charMoney = "Tens %s.", + charFaction = "És membro da facção %s.", + charClass = "Tu %s da facção.", + noSpace = "Inventário está cheio.", + noOwner = "O dono é invalido.", + invalidIndex = "O índice deste item Index é invalido.", + invalidItem = "O objeto deste item Index é invalido.", + invalidInventory = "O objecto do inventário é invaldio.", + home = "Home", + charKick = "%s deu kick ao personagem %s.", + charBan = "%s baniu o personagem %s.", + charBanned = "Este personagem está banido.", + setMoney = "Definiste o dinheiro de %s para %s.", + itemPriceInfo = "Podes comprar este item por %s.\nPodes vender este item por %s", + free = "De Graça", + vendorNoSellItems = "Não existem items para vender.", + vendorNoBuyItems = "Não existem items para comprar.", + vendorSettings = "Definições do vendedor", + vendorUseMoney = "O vendedor deve usar dinheiro?", + vendorNoBubble = "Esconder a bolha do vendedor?", + mode = "Modo", + price = "Preço", + stock = "Stock", + none = "Nenhum", + vendorBoth = "Comprar e Vender", + vendorBuy = "Apenas Comprar", + vendorSell = "Apenas Vender", + maxStock = "Stock Máximo", + vendorFaction = "Editor de Facções", + buy = "Comprar", + vendorWelcome = "Bem vindo à minha loja, o que é que te posso arranjar hoje?", + vendorBye = "Volta brevemente!", + charSearching = "Já estás a procurar um personagem, espera por favor.", + charUnBan = "%s desbaniu o personagem %s.", + charNotBanned = "Este personagem não está banido.", + storPass = "Definiste a password deste armazém para %s.", + storPassRmv = "Removeste a password deste armazém.", + storPassWrite = "Mete a password.", + wrongPassword = "Meteste a password errada.", + cheapBlur = "Desativar obscurecimento? (Aumenta os FPS)", + quickSettings = "Definições rápidas", + vmSet = "Definiste voicemail.", + vmRem = "Removeste o teu voicemail.", + altLower = "Esconder mãos quando abaixadas?", + noPerm = "Não estás permitido a fazer isto.", + youreDead = "Tu estás morto", + injMajor = "Parece estar criticamente ferido.", + injLittle = "Parece magoado", + toggleObserverTP = "Alternar teleportador do Observer", + toggleESP = "Alternar ESP de Admin", + toggleESPAdvanced = "Modo avançado do ESP", + chgName = "Mudar nome", + chgNameDesc = "Põe o novo nome do personagem abaixo.", + thirdpersonToggle = "Alternar Terceira Pessoa", + thirdpersonClassic = "Usar Terceira Pessoa clássica", + thirdpersonConfig = "Configuração da Terceira Pessoa", + equippedBag = "items equipados não podem ser movidos por inventarios.", + useTip = "Usa o item", + equipTip = "Equipa o item.", + unequipTip = "Desequipa o item.", + consumables = "Consumíveis", + plyNotValid = "Não estás a olhar para um jogador valido.", + restricted = "Foste contido.", + viewProfile = "Ver perfil Steam", + salary = "Recebeste %s do teu salário.", + noRecog = "Não reconheces esta pessoa.", + curTime = "São %s.", + vendorEditor = "Editar Vendedor", + edit = "Editar", + disable = "Desabilitar", + vendorPriceReq = "Põe o novo preço para este item.", + vendorEditCurStock = "Edit Current Stock", + you = "Tu", + vendorSellScale = "Escala do Preço de Venda", + vendorNoTrade = "Tu não podes trocar com este vendedor.", + vendorNoMoney = "Este vendedor não têm dinheiro suficiente para esse item.", + vendorNoStock = "Este vendedor não têm esse item em stock.", + contentTitle = "Conteúdo NutScript não encontrado", + contentWarning = "Não tens o conteúdo do NutScript montado. Isto pode resultar em alguns recursos não funcionarem .\nO conteúdo do Nutscript foi mudado para o do rebel1324.\nQueres abrir a pagina da loja para o conteúdo do NutScript?", + flags = "Flags", + chooseTip = "Escolhe este personagem para jogares.", + deleteTip = "Apagar este personagem.", + moneyLeft = "O teu dinheiro: ", + currentMoney = "Dinheiro Restante: ", + + -- 2018 patch + + ammoLoadAll = "Carregar tudo", + ammoLoadAmount = "Carregar %s", + ammoLoadCustom = "Carregar...", + split = "Dividir", + splitHelp = "Mete um número para dividir.", + splitHalf = "Dividir 1/2", + splitQuarter = "Dividir 1/4", + recognize = "Permite que este personagem te reconheça.", + recognized = "Deste a tua identidade a este personagem.", + already_recognized = "Este personagem já te conhece.", + isTied = "Esta personagem já está atada.", + tying = "Atando", + untying = "Desatando", + beingUntied = "Estás a ser desatado.", + beingTied = "Estás a ser atado.", + sameOutfitCategory = "Já estás a vestir uma roupa deste tipo.", + noBusiness = "Não podes comprar nada.", + panelRemoved = "Removeste %s 3D panels.", + panelAdded = "Adicionaste 1 3D panel.", + itemOnGround = "O teu item foi colocado no chão.", + forbiddenActionStorage = "Não podes fazer isto com itens armazenados.", + cantDropBagHasEquipped = "Não podes largar uma mala equipada.", + + -- 2021 patch + lookToUseAt = "Precisas de estar a olhar para alguém para usar '@'", + mustProvideString = "Deves dar uma string para a variável", +} diff --git a/gamemode/languages/sh_spanish.lua b/gamemode/languages/sh_spanish.lua index e17b0b3d..dec2466e 100644 --- a/gamemode/languages/sh_spanish.lua +++ b/gamemode/languages/sh_spanish.lua @@ -1,5 +1,6 @@ -NAME = "Español" ---//Edited by Barata\\---- - +---//Translation made by Barata#2411 & CVAROG#7222\\---- +---//Contact DasBarata#2411 if you have any translation change suggestion\\---- +NAME = "Español" LANGUAGE = { loading = "Cargando", dbError = "Fallo de conexión con la Base de Datos", @@ -10,7 +11,7 @@ LANGUAGE = { load = "Cargar", loadTip = "Escoge un personaje previamente creado con el que jugar.", leave = "Abandonar", - leaveTip = "Abandona el servidor actual.", + leaveTip = "Abandonar el servidor.", ["return"] = "Volver", returnTip = "Vuelve al menú anterior.", name = "Nombre", @@ -54,24 +55,24 @@ LANGUAGE = { drop = "Tirar", dropTip = "Tira el objeto desde tu inventario.", take = "Coger", - takeTip = "Coge éste objeto y lo coloca en tu inventario.", + takeTip = "Coge éste objeto y colocarlo en tu inventario.", dTitle = "Puerta sin propietario", dTitleOwned = "Puerta comprada", - dIsNotOwnable = "Está puerta no puede se poseer.", + dIsNotOwnable = "Está puerta no se puede poseer.", dIsOwnable = "Puedes comprar ésta puerta pulsando F2.", dMadeUnownable = "Has hecho ésta puerta 'No poseíble'.", dMadeOwnable = "Has hecho ésta puerta 'Poseíble'.", dNotAllowedToOwn = "No tienes permiso a poseer ésta puerta.", - dSetDisabled = "Has hecho ésta puerta 'Dehabilitada'.", - dSetNotDisabled = "Has hecho ésta puerta 'Habilitada'.", + dSetDisabled = "Has hecho que ésta puerta este 'Dehabilitada'.", + dSetNotDisabled = "Has hecho que ésta puerta este 'Habilitada'.", dSetHidden = "Has hecho que ésta puerta esté oculta.", dSetNotHidden = "Has hecho que ésta puerta no esté oculta.", - dSetParentDoor = "Has establecido ésta puerta como tu puerta madre.", - dCanNotSetAsChild = "No puedes establecer la puerta madre como puerta hija.", - dAddChildDoor = "Has añadido ésta puerta como puerta hija.", - dRemoveChildren = "Has eliminado todas las puertas hijas de ésta puerta.", - dRemoveChildDoor = "Has eliminado ésta puerta como puerta hija.", - dNoParentDoor = "No tienes una puerta madre establecida.", + dSetParentDoor = "Has establecido ésta puerta como tu puerta principal.", + dCanNotSetAsChild = "No puedes establecer la puerta principal como puerta secundaria.", + dAddChildDoor = "Has añadido ésta puerta como puerta secundaria.", + dRemoveChildren = "Has eliminado todas las puertas secundarias de ésta puerta.", + dRemoveChildDoor = "Has eliminado ésta puerta como puerta secundaria.", + dNoParentDoor = "No tienes una puerta principal establecida.", dOwnedBy = "Ésta puerta está poseída por %s.", dConfigName = "Puertas", dSetFaction = "Ésta puerta ahora pertenece a la facción %s.", @@ -111,7 +112,7 @@ LANGUAGE = { icFormat = "%s dice \"%s\"", rollFormat = "%s ha tirado los dados y ha sacado un %s.", wFormat = "%s susurra \"%s\"", - yFormat = "%s grita \"%s\"", + yFormat = "%s gritar \"%s\"", sbOptions = "Haz clic para ver las opciones de %s.", spawnAdded = "Has añadido punto de aparición de %s.", whitelist = "%s ha metido a %s en la 'whitelist' de la facción %s.", @@ -180,7 +181,7 @@ LANGUAGE = { buy = "Comprar", vendorWelcome = "Bienvenid@ a mi tienda, ¿qué puedo hacer por usted?", vendorBye = "¡Vuelva pronto!", - charSearching = "You are already searching for another character, please wait.", + charSearching = "Ya está buscando a otro personaje, por favor espere.", charUnBan = "%s ha perdonado la expulsión a %s.", charNotBanned = "Éste personaje no está expulsado.", storPass = "Has establecido la contraseña de éste depósito como %s.", @@ -226,11 +227,11 @@ LANGUAGE = { thirdpersonConfig = "Configuración de cámara en tercera persona", vendorSellScale = "Escala de precios de venta", - vendorNoTrade = "No puede comprar a este vendedor.", - vendorNoMoney = "Este vendedor no puede pagar ese artículo.", - vendorNoStock = "Este vendedor no tiene ese artículo en stock.", + vendorNoTrade = "No puedes comprar a este vendedor.", + vendorNoMoney = "Este vendedor no puede pagar este artículo.", + vendorNoStock = "Este vendedor no tiene este artículo en stock.", contentTitle = "Content del NutScript Ausent", - contentWarning = "No tienes el contenido de NutScript montado. Esto puede resultar en la falta de ciertas funciones.\nUtilice el contenido de Nutscript de Rebel1324.\n¿Le gustaría abrir la página del Workshop para el contenido de NutScript?", + contentWarning = "No tienes el contenido de NutScript montado. Esto puede probocar ciertas fallas en las funciones.\nUtilice el contenido de Nutscript de Rebel1324.\n¿Le gustaría abrir la página del Workshop para el contenido de NutScript?", flags = "Flags", chooseTip = "Elige este personaje para jugar.", deleteTip = "Eliminar este personaje.", diff --git a/plugins/area/sh_plugin.lua b/plugins/area/sh_plugin.lua index 48403922..13b24704 100644 --- a/plugins/area/sh_plugin.lua +++ b/plugins/area/sh_plugin.lua @@ -6,7 +6,7 @@ PLUGIN.areaTable = PLUGIN.areaTable or {} nut.area = nut.area or {} ALWAYS_RAISED["nut_areahelper"] = true -nut.config.add("areaFontSize", 26, "The size of the font of Area Display.", +nut.config.add("areaFontSize", 26, "The size of the font of Area Display.", function(oldValue, newValue) if (CLIENT) then hook.Run( @@ -44,7 +44,7 @@ if (SERVER) then return false, "Area you specified is not valid." end - local char = v:getChar() + local char = self:getChar() if (!char) then return false, "Your character is not valid." @@ -133,7 +133,7 @@ if (SERVER) then table.insert(PLUGIN.areaTable, { name = name, minVector = minVector, - maxVector = maxVector, + maxVector = maxVector, desc = desc or "", }) @@ -174,7 +174,7 @@ if (SERVER) then if (areaData) then local min, max = areaData.maxVector, areaData.minVector - client:SetPos(min + (max - min)/2) + client:SetPos(min + (max - min) / 2) end end) @@ -222,7 +222,7 @@ else panel:SetTall(30) frame:AddItem(panel) end - + function nut.area.openAreaManager() local frame = vgui.Create("DFrame") frame:SetSize(400, 300) @@ -259,7 +259,6 @@ else -- draw matrix string. local function drawMatrixString(str, font, x, y, scale, angle, color) surface.SetFont(font) - local tx, ty = surface.GetTextSize(str) local matrix = Matrix() matrix:Translate(Vector(x, y, 1)) @@ -284,10 +283,8 @@ else -- local scale = 0 local scale = 0 local flipTable = {} - local powTime = RealTime()*speed + local powTime = RealTime() * speed local curChar = 0 - local mathsin = math.sin - local mathcos = math.cos local dieTrigger = false local dieTimer = RealTime() local dieAlpha = 0 @@ -301,7 +298,7 @@ else scale = targetScale * .5 flipTable = {} - powTime = RealTime()*speed + powTime = RealTime() * speed curChar = 0 dieTrigger = false dieTimer = RealTime() @@ -315,9 +312,9 @@ else function PLUGIN:HUDPaint() -- values if ((hook.Run("CanDisplayArea") == false) or (dieTrigger and dieTimer < RealTime() and dieAlpha <= 1)) then - return + return end - + ft = FrameTime() w, h = ScrW(), ScrH() dsx, dsy = 0 @@ -325,18 +322,18 @@ else local rTime = RealTime() surface.SetFont("nutAreaDisplay") - local sx, sy = surface.GetTextSize(dispString) + local sx, sy = surface.GetTextSize(dispString) -- Number of characters to display. - local maxDisplay = math.Round(rTime*speed - powTime) + local maxDisplay = math.Round(rTime * speed - powTime) -- resize if it's too big. - while (sx and sx*targetScale > w*.8) do + while (sx and sx * targetScale > w * .8) do targetScale = targetScale * .9 end -- scale lerp - scale = Lerp(ft*1, scale, targetScale) + scale = Lerp(ft * 1, scale, targetScale) -- change event if (maxDisplay ~= curChar and curChar < strEnd) then @@ -352,24 +349,24 @@ else flipTable[i] = flipTable[i] or {} flipTable[i][1] = flipTable[i][1] or .1 flipTable[i][2] = flipTable[i][2] or 0 - flipTable[i][1] = Lerp(ft*4, flipTable[i][1], scale) - flipTable[i][2] = Lerp(ft*4, flipTable[i][2], 255) + flipTable[i][1] = Lerp(ft * 4, flipTable[i][1], scale) + flipTable[i][2] = Lerp(ft * 4, flipTable[i][2], 255) -- draw character. local char = string.utf8sub(dispString, i, i) - local tx, ty = surface.GetTextSize(char) + local tx = surface.GetTextSize(char) drawMatrixString(char, "nutAreaDisplay", - math.Round(w/2 + dsx - (sx or 0)*scale/2), - math.Round(h/3*1 - (sy or 0)*scale/2), + math.Round(w / 2 + dsx - (sx or 0) * scale / 2), + math.Round(h / 3 - (sy or 0) * scale / 2), Vector(Format("%.2f", flipTable[i][1]), Format("%.2f", scale), 1), nil, Color(255, 255, 255, (dieTrigger and dieTimer < RealTime()) and dieAlpha or flipTable[i][2]) ) - -- next - dsx = dsx + tx*scale + -- next + dsx = dsx + tx * scale end if (maxDisplay >= strEnd) then @@ -378,7 +375,7 @@ else dieTimer = RealTime() + 2 else if (dieTimer < RealTime()) then - dieAlpha = Lerp(ft*4, dieAlpha, 0) + dieAlpha = Lerp(ft * 4, dieAlpha, 0) end end end diff --git a/plugins/attributes/derma/cl_attribute.lua b/plugins/attributes/derma/cl_attribute.lua index 4bcf1fc8..26c338d2 100644 --- a/plugins/attributes/derma/cl_attribute.lua +++ b/plugins/attributes/derma/cl_attribute.lua @@ -88,10 +88,8 @@ local PANEL = {} end function PANEL:Think() - if (self.pressing) then - if ((self.nextPress or 0) < CurTime()) then - self:doChange() - end + if self.pressing and ((self.nextPress or 0) < CurTime()) then + self:doChange() end self.deltaValue = math.Approach(self.deltaValue, self.value, FrameTime() * 15) @@ -101,9 +99,9 @@ local PANEL = {} if ((self.value == 0 and self.pressing == -1) or (self.value == self.max and self.pressing == 1)) then return end - + self.nextPress = CurTime() + 0.2 - + if (self:onChanged(self.pressing) ~= false) then self.value = math.Clamp(self.value + self.pressing, 0, self.max) end @@ -136,7 +134,7 @@ local PANEL = {} self.sub:Remove() self.add:Remove() end - + function PANEL:Paint(w, h) surface.SetDrawColor(0, 0, 0, 200) surface.DrawRect(0, 0, w, h) diff --git a/plugins/attributes/derma/cl_attributes_step.lua b/plugins/attributes/derma/cl_attributes_step.lua index e89a3f00..74a9938b 100644 --- a/plugins/attributes/derma/cl_attributes_step.lua +++ b/plugins/attributes/derma/cl_attributes_step.lua @@ -54,12 +54,14 @@ end function PANEL:onPointChange(key, delta) if (not key) then return 0 end local attribs = self:getContext("attribs", {}) + local startingMax = nut.attribs.list[key].startingMax or nil local quantity = attribs[key] or 0 local newQuantity = quantity + delta local newPointsLeft = self.left - delta if ( newPointsLeft < 0 or newPointsLeft > self.total or - newQuantity < 0 or newQuantity > self.total + newQuantity < 0 or newQuantity > self.total or + (startingMax and startingMax < newQuantity) ) then return quantity end @@ -100,7 +102,7 @@ function PANEL:Init() self.quantity:Dock(FILL) self.quantity:SetText("0") self.quantity:SetContentAlignment(5) - + self.name = self:Add("DLabel") self.name:SetFont("nutCharSubTitleFont") self.name:SetContentAlignment(4) @@ -111,8 +113,9 @@ end function PANEL:setAttribute(key, attribute) self.key = key + local startingMax = nut.attribs.list[key].startingMax or nil self.name:SetText(L(attribute.name)) - self:SetToolTip(L(attribute.desc or "noDesc")) + self:SetTooltip(L(attribute.desc or "noDesc").. (startingMax and " Max: "..startingMax or "")) end function PANEL:delta(delta) diff --git a/plugins/attributes/libs/sh_attribs.lua b/plugins/attributes/libs/sh_attribs.lua index 715664da..c4bfbe80 100644 --- a/plugins/attributes/libs/sh_attribs.lua +++ b/plugins/attributes/libs/sh_attribs.lua @@ -2,7 +2,7 @@ nut.attribs = nut.attribs or {} nut.attribs.list = nut.attribs.list or {} function nut.attribs.loadFromDir(directory) - for k, v in ipairs(file.Find(directory.."/*.lua", "LUA")) do + for _, v in ipairs(file.Find(directory.."/*.lua", "LUA")) do local niceName = v:sub(4, -5) ATTRIBUTE = nut.attribs.list[niceName] or {} @@ -39,10 +39,10 @@ do if (SERVER) then function charMeta:updateAttrib(key, value) local attribute = nut.attribs.list[key] + local client = self:getPlayer() if (attribute) then local attrib = self:getAttribs() - local client = self:getPlayer() attrib[key] = math.min((attrib[key] or 0) + value, attribute.maxValue or nut.config.get("maxAttribs", 30)) @@ -125,10 +125,10 @@ do local boosts = self:getBoosts()[key] if (boosts) then - for k, v in pairs(boosts) do + for _, v in pairs(boosts) do att = att + v end - end + end return att end diff --git a/plugins/attributes/plugins/strength/attributes/sh_str.lua b/plugins/attributes/plugins/strength/attributes/sh_str.lua index e04c2015..56ed8610 100644 --- a/plugins/attributes/plugins/strength/attributes/sh_str.lua +++ b/plugins/attributes/plugins/strength/attributes/sh_str.lua @@ -1,2 +1,4 @@ ATTRIBUTE.name = "Strength" -ATTRIBUTE.desc = "A measure of how strong you are." \ No newline at end of file +ATTRIBUTE.desc = "A measure of how strong you are." +--ATTRIBUTE.startingMax = 10 +--ATTRIBUTE.noStartBonus = false \ No newline at end of file diff --git a/plugins/attributes/sh_plugin.lua b/plugins/attributes/sh_plugin.lua index 8d4781e1..bc47c684 100644 --- a/plugins/attributes/sh_plugin.lua +++ b/plugins/attributes/sh_plugin.lua @@ -26,9 +26,10 @@ nut.char.registerVar("attribs", { local count = 0 for k, v in pairs(value) do + local max = nut.attribs.list[k] and nut.attribs.list[k].startingMax or nil + if max and max < v then return false, nut.attribs.list[k].name .. " too high" end count = count + v end - local points = hook.Run("GetStartAttribPoints", client, count) or nut.config.get("maxAttribs", 30) if (count > points) then diff --git a/plugins/doors/cl_plugin.lua b/plugins/doors/cl_plugin.lua index 0476e846..24b95d3e 100644 --- a/plugins/doors/cl_plugin.lua +++ b/plugins/doors/cl_plugin.lua @@ -17,7 +17,7 @@ local configGet = nut.config.get local teamGetColor = team.GetColor function PLUGIN:DrawEntityInfo(entity, alpha) - if (entity.isDoor(entity) and !entity:getNetVar("hidden") and hook.Run("CanDrawDoorInfo", entity)) then + if (entity.isDoor(entity) and !entity:getNetVar("hidden") and hook.Run("CanDrawDoorInfo", entity) ~= false) then local position = toScreen(entity.LocalToWorld(entity, entity.OBBCenter(entity))) local x, y = position.x, position.y local owner = entity.GetDTEntity(entity, 0) diff --git a/plugins/doors/sh_commands.lua b/plugins/doors/sh_commands.lua index c08ad6a2..565e9a77 100644 --- a/plugins/doors/sh_commands.lua +++ b/plugins/doors/sh_commands.lua @@ -36,7 +36,7 @@ nut.command.add("doorsell", { else -- Tell the player the door isn't valid. client:notifyLocalized("dNotValid") - end + end end }) @@ -70,7 +70,7 @@ nut.command.add("doorbuy", { entity.nutAccess = { [client] = DOOR_OWNER } - + PLUGIN:callOnDoorChildren(entity, function(child) child:SetDTEntity(0, client) end) @@ -356,7 +356,7 @@ nut.command.add("doorsetchild", { else -- Tell the player the door isn't valid. client:notifyLocalized("dNotValid") - end + end end }) @@ -393,7 +393,7 @@ nut.command.add("doorremovechild", { else -- Tell the player the door isn't valid. client:notifyLocalized("dNotValid") - end + end end }) diff --git a/plugins/gridinv/plugins/gridinvui/sh_plugin.lua b/plugins/gridinv/plugins/gridinvui/sh_plugin.lua index 8d8cbc2e..5082602b 100644 --- a/plugins/gridinv/plugins/gridinvui/sh_plugin.lua +++ b/plugins/gridinv/plugins/gridinvui/sh_plugin.lua @@ -13,7 +13,7 @@ if (CLIENT) then local panel = vgui.Create("nutGridInventory", parent) panel:setInventory(inventory) panel:Center() - + return panel end diff --git a/plugins/gridinv/sv_access_rules.lua b/plugins/gridinv/sv_access_rules.lua index 6e49bae4..050b974a 100644 --- a/plugins/gridinv/sv_access_rules.lua +++ b/plugins/gridinv/sv_access_rules.lua @@ -44,7 +44,7 @@ local function CanNotTransferBagIfNestedItemCanNotBe(inventory, action, context) for _, item in pairs(bagInventory:getItems()) do local canTransferItem, reason = - hook.Run("CanItemBeTransfered", item, bagInventory, bagInventory) + hook.Run("CanItemBeTransfered", item, bagInventory, bagInventory, context.client) if (canTransferItem == false) then return false, reason or "An item in the bag cannot be transfered" end diff --git a/plugins/gridinv/sv_transfer.lua b/plugins/gridinv/sv_transfer.lua index bb7989ff..c8b589f8 100644 --- a/plugins/gridinv/sv_transfer.lua +++ b/plugins/gridinv/sv_transfer.lua @@ -12,11 +12,9 @@ function PLUGIN:HandleItemTransferRequest(client, itemID, x, y, invID) return end -- Make sure the item is permitted to move between the two inventories. - if ( - hook.Run("CanItemBeTransfered", item, oldInventory, inventory) == false - ) then - return - end + local status,reason = hook.Run("CanItemBeTransfered", item, oldInventory, inventory, client) + + if (status == false) then client:notify(reason or "You can't do that right now.") return end local context = { client = client, @@ -98,7 +96,7 @@ function PLUGIN:HandleItemTransferRequest(client, itemID, x, y, invID) end) :next(function(res) client.invTransferTransaction = nil - + if (res and res.error) then fail() else diff --git a/plugins/newvoice.lua b/plugins/newvoice.lua index 253b6b36..50dbbe81 100644 --- a/plugins/newvoice.lua +++ b/plugins/newvoice.lua @@ -11,7 +11,7 @@ if (CLIENT) then hi:SetFont("nutIconsMedium") hi:Dock(LEFT) hi:DockMargin(8, 0, 8, 0) - hi:SetTextColor(Color(255, 255, 255, 255)) + hi:SetTextColor(color_white) hi:SetText("i") hi:SetWide(30) @@ -19,7 +19,7 @@ if (CLIENT) then self.LabelName:SetFont("nutMediumFont") self.LabelName:Dock(FILL) self.LabelName:DockMargin(0, 0, 0, 0) - self.LabelName:SetTextColor(Color(255, 255, 255, 255)) + self.LabelName:SetTextColor(color_white) self.Color = color_transparent @@ -30,7 +30,7 @@ if (CLIENT) then end function PANEL:Setup(client) - self.client= client + self.client = client self.name = hook.Run("ShouldAllowScoreboardOverride", client, "name") and hook.Run("GetDisplayedName", client) or client:Nick() self.LabelName:SetText(self.name) self:InvalidateLayout() @@ -73,7 +73,7 @@ if (CLIENT) then vgui.Register("VoicePanel", PANEL, "DPanel") function PLUGIN:PlayerStartVoice(client) - if (!IsValid(g_VoicePanelList)) then return end + if (!IsValid(g_VoicePanelList) or !nut.config.get("allowVoice", false)) then return end hook.Run("PlayerEndVoice", client) @@ -121,7 +121,7 @@ if (CLIENT) then if (IsValid(g_VoicePanelList)) then g_VoicePanelList:Remove() end - + g_VoicePanelList = vgui.Create("DPanel") g_VoicePanelList:ParentToHUD() diff --git a/plugins/nshud/sh_plugin.lua b/plugins/nshud/sh_plugin.lua index 8548a2ca..a8a54a79 100644 --- a/plugins/nshud/sh_plugin.lua +++ b/plugins/nshud/sh_plugin.lua @@ -116,7 +116,7 @@ function PLUGIN:DrawEntityInfo(entity, alpha, position) teamGetColor(entity.Team(entity)) } - local description = character.getDesc(character) + local description = hookRun("GetDisplayedDescription", entity) or character.getDesc(character) if (description ~= entity.nutDescCache) then entity.nutDescCache = description diff --git a/plugins/playerinjuries/sv_hooks.lua b/plugins/playerinjuries/sv_hooks.lua index 4b9bf722..01e6bb66 100644 --- a/plugins/playerinjuries/sv_hooks.lua +++ b/plugins/playerinjuries/sv_hooks.lua @@ -38,7 +38,7 @@ end function PLUGIN:PlayerDeath(client) local deathSound = hook.Run("GetPlayerDeathSound", client) - or table.Random(DEATH_SOUNDS) + or DEATH_SOUNDS[math.random(#DEATH_SOUNDS)] if (client:isFemale() and !deathSound:find("female")) then deathSound = deathSound:gsub("male", "female") end @@ -48,14 +48,14 @@ end function PLUGIN:GetPlayerPainSound(client) if (client:WaterLevel() >= 3) then - return table.Random(DROWN_SOUNDS) + return DROWN_SOUNDS[math.random(#DROWN_SOUNDS)] end end function PLUGIN:PlayerHurt(client, attacker, health, damage) if ((client.nutNextPain or 0) < CurTime() and health > 0) then local painSound = hook.Run("GetPlayerPainSound", client) - or table.Random(PAIN_SOUNDS) + or PAIN_SOUNDS[math.random(#PAIN_SOUNDS)] if (client:isFemale() and !painSound:find("female")) then painSound = painSound:gsub("male", "female") end diff --git a/plugins/scoreboard/derma/cl_scoreboard.lua b/plugins/scoreboard/derma/cl_scoreboard.lua index fd8a0e36..938b56ff 100644 --- a/plugins/scoreboard/derma/cl_scoreboard.lua +++ b/plugins/scoreboard/derma/cl_scoreboard.lua @@ -52,7 +52,7 @@ local PANEL = {} list:SetTall(28) list.Think = function(this) for k2, v2 in ipairs(team.GetPlayers(k)) do - if (!IsValid(v2.nutScoreSlot) or v2.nutScoreSlot:GetParent() ~= this) then + if (not IsValid(v2.nutScoreSlot) or v2.nutScoreSlot:GetParent() ~= this) then if (IsValid(v2.nutPlayerSlot)) then v2.nutPlayerSlot:SetParent(this) else @@ -85,24 +85,22 @@ local PANEL = {} local visible, amount - for k, v in ipairs(self.teams) do - visible, amount = v:IsVisible(), team.NumPlayers(k) + for faction, v in ipairs(self.teams) do + visible, amount = v:IsVisible(), team.NumPlayers(faction) if (visible and amount == 0) then v:SetVisible(false) self.layout:InvalidateLayout() - elseif (!visible and amount > 0) then + elseif (not visible and amount > 0) then v:SetVisible(true) end - - local faction = nut.faction.indices[k] - - if (amount != 0) then + + if (amount ~= 0) then v:SetVisible(hook.Run("ShowFactionInScoreboard", faction) ~= false or LocalPlayer():IsAdmin()) end end - for k, v in pairs(self.slots) do + for _, v in pairs(self.slots) do if (IsValid(v)) then v:update() end @@ -113,7 +111,7 @@ local PANEL = {} end function PANEL:addPlayer(client, parent) - if (!client:getChar() or !IsValid(parent)) then + if (not client:getChar() or not IsValid(parent)) then return end @@ -146,7 +144,7 @@ local PANEL = {} slot.model:SetTooltip(L("sbOptions", client:steamName())) timer.Simple(0, function() - if (!IsValid(slot)) then + if (not IsValid(slot)) then return end @@ -198,7 +196,7 @@ local PANEL = {} local oldTeam = client:Team() function slot:update() - if (!IsValid(client) or !client:getChar() or !self.character or self.character ~= client:getChar() or oldTeam ~= client:Team()) then + if (not IsValid(client) or not client:getChar() or not self.character or self.character ~= client:getChar() or oldTeam ~= client:Team()) then self:Remove() local i = 0 @@ -236,20 +234,20 @@ local PANEL = {} self.lastDesc = desc end - if (!IsValid(entity)) then + if (not IsValid(entity)) then return end if (self.lastModel ~= model or self.lastSkin ~= skin) then self.model:SetModel(client:GetModel(), client:GetSkin()) self.model:SetTooltip(L("sbOptions", client:steamName())) - + self.lastModel = model self.lastSkin = skin end timer.Simple(0, function() - if (!IsValid(entity) or !IsValid(client)) then + if (not IsValid(entity) or not IsValid(client)) then return end diff --git a/plugins/stamina/sh_plugin.lua b/plugins/stamina/sh_plugin.lua index ec89b7cc..c927fd32 100644 --- a/plugins/stamina/sh_plugin.lua +++ b/plugins/stamina/sh_plugin.lua @@ -1,10 +1,21 @@ PLUGIN.name = "Stamina" PLUGIN.author = "Chessnut" PLUGIN.desc = "Adds a stamina system to limit running." +local PLUGIN = PLUGIN + +nut.config.add("defaultStamina", 100, "A higher number means that characters can run longer without tiring.", nil, +{ data = {min = 50, max = 500}, + category = "stamina" +}) + +nut.config.add("staminaRegenMultiplier", 1, "A higher number means that characters can run regenerate stamina faster.",nil, +{ data = {min = 0.1, max = 20}, + category = "stamina" +}) if (SERVER) then function PLUGIN:PostPlayerLoadout(client) - client:setLocalVar("stm", 100) + client:setLocalVar("stm", nut.config.get("defaultStamina", 100)) local uniqueID = "nutStam"..client:SteamID() local offset = 0 @@ -20,7 +31,7 @@ if (SERVER) then return end - local bonus = character.getAttrib + local bonus = character.getAttrib and character:getAttrib("stm", 0) or 0 runSpeed = nut.config.get("runSpeed") + bonus @@ -30,27 +41,26 @@ if (SERVER) then end if (client:isRunning()) then - local bonus = character.getAttrib + bonus = character.getAttrib and character:getAttrib("end", 0) or 0 offset = -2 + (bonus / 60) elseif (offset > 0.5) then - offset = 1 + offset = 1 * nut.config.get("staminaRegenMultiplier", 1) else - offset = 1.75 + offset = 1.75 * nut.config.get("staminaRegenMultiplier", 1) end - if (client:Crouching()) then offset = offset + 1 end local current = client:getLocalVar("stm", 0) - local value = math.Clamp(current + offset, 0, 100) + local value = math.Clamp(current + offset, 0, nut.config.get("defaultStamina", 100)) if (current ~= value) then client:setLocalVar("stm", value) - if (value == 0 and !client:getNetVar("brth", false)) then + if (value == 0 and not client:getNetVar("brth", false)) then client:SetRunSpeed(nut.config.get("walkSpeed")) client:setNetVar("brth", true) @@ -67,12 +77,12 @@ if (SERVER) then function playerMeta:restoreStamina(amount) local current = self:getLocalVar("stm", 0) - local value = math.Clamp(current + amount, 0, 100) + local value = math.Clamp(current + amount, 0, nut.config.get("defaultStamina", 100)) self:setLocalVar("stm", value) end elseif (nut.bar) then nut.bar.add(function() - return LocalPlayer():getLocalVar("stm", 0) / 100 + return LocalPlayer():getLocalVar("stm", 0) / nut.config.get("defaultStamina", 100) end, Color(200, 200, 40), nil, "stm") end diff --git a/plugins/typing.lua b/plugins/typing.lua index ee2a66b8..4bc845ff 100644 --- a/plugins/typing.lua +++ b/plugins/typing.lua @@ -30,14 +30,16 @@ if (CLIENT) then data.start = localPlayer:EyePos() data.filter = localPlayer - for k, v in ipairs(player.GetAll()) do + for _, v in ipairs(player.GetAll()) do + local specialState = v:InVehicle() or v:getNetVar("actAng") + if ( v ~= localPlayer and v:getNetVar("typing") and - v:GetMoveType() == MOVETYPE_WALK + (v:GetMoveType() == MOVETYPE_WALK or specialState) ) then data.endpos = v:EyePos() - if (util.TraceLine(data).Entity ~= v) then continue end + if (util.TraceLine(data).Entity ~= v and not specialState) then continue end local position = v:GetPos() alpha = (1 - (ourPos:DistToSqr(position) / 65536)) * 255 if (alpha <= 0) then continue end diff --git a/plugins/vendor/sv_hooks.lua b/plugins/vendor/sv_hooks.lua index 75803475..873397b3 100644 --- a/plugins/vendor/sv_hooks.lua +++ b/plugins/vendor/sv_hooks.lua @@ -118,7 +118,7 @@ function PLUGIN:VendorTradeAttempt( return end - local canTransferItem, reason = hook.Run("CanItemBeTransfered", item, inventory, VENDOR_INVENTORY_MEASURE) + local canTransferItem, reason = hook.Run("CanItemBeTransfered", item, inventory, VENDOR_INVENTORY_MEASURE, client) if (canTransferItem == false) then client:notifyLocalized(reason or "vendorError") @@ -147,7 +147,8 @@ function PLUGIN:VendorTradeAttempt( local position = client:getItemDropPos() local result = character:getInv():add(itemType) - :next(function() + :next(function(item) + hook.Run("OnCharTradeVendor", client, vendor, item, isSellingToVendor) client.vendorTransaction = nil end) :catch(function(err) @@ -161,8 +162,6 @@ function PLUGIN:VendorTradeAttempt( client:notifyLocalized(err) client.vendorTransaction = nil end) - - hook.Run("OnCharTradeVendor", client, vendor, result.value, isSellingToVendor) nut.log.add(client, "vendorBuy", itemType, vendor:getNetVar("name")) end