From 693f23f13e1b4d171a2afa563b7d9ba0bb772743 Mon Sep 17 00:00:00 2001 From: Histalek <16392835+Histalek@users.noreply.github.com> Date: Tue, 31 Dec 2024 15:45:33 +0100 Subject: [PATCH] fix(shop): Error messages tried to print player userdata Fixes #1701 --- CHANGELOG.md | 1 + gamemodes/terrortown/gamemode/server/sv_shop.lua | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d6cc7058..dbfdfdee3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel - Fixed an error when trying to pickup a placed equipment (e.g. beacon) (by @Histalek) - Fixed corpse searching sound playing when searched by a spectator, searched covertly, or searched long range (by @TW1STaL1CKY) - Fixed the mute button in the scoreboard not working (by @TW1STaL1CKY) +- Fixed a few errors in shop error messages (by @Histalek) ### Changed diff --git a/gamemodes/terrortown/gamemode/server/sv_shop.lua b/gamemodes/terrortown/gamemode/server/sv_shop.lua index 0e02959b4..207c84b3d 100644 --- a/gamemodes/terrortown/gamemode/server/sv_shop.lua +++ b/gamemodes/terrortown/gamemode/server/sv_shop.lua @@ -61,11 +61,11 @@ local function HandleErrorMessage(ply, equipmentName, statusCode) elseif statusCode == shop.statusCode.PENDINGORDER then LANG.Msg(ply, "buy_pending", nil, MSG_MSTACK_ROLE) elseif statusCode == shop.statusCode.NOTEXISTING then - Dev(1, ply .. " tried to buy equip that doesn't exist: " .. equipmentName) + Dev(1, ply:Nick() .. " tried to buy equip that doesn't exist: " .. equipmentName) elseif statusCode == shop.statusCode.NOTENOUGHCREDITS then - Dev(1, ply .. " tried to buy item/weapon, but didn't have enough credits.") + Dev(1, ply:Nick() .. " tried to buy item/weapon, but didn't have enough credits.") elseif statusCode == shop.statusCode.INVALIDID then - ErrorNoHaltWithStack("[TTT2][ERROR] No ID was requested by:", ply) + ErrorNoHaltWithStack("[TTT2][ERROR] Equipment without ID was requested by:", ply:Nick()) elseif statusCode == shop.statusCode.NOTBUYABLE then LANG.Msg(ply, "This equipment cannot be bought.", nil, MSG_MSTACK_ROLE) elseif statusCode == shop.statusCode.NOTENOUGHPLAYERS then @@ -160,7 +160,7 @@ local function ConCommandOrderEquipment(ply, cmd, args) local isSuccess, statusCode = shop.BuyEquipment(ply, args[1]) if not isSuccess then - HandleErrorMessage(ply, statusCode) + HandleErrorMessage(ply, args[1], statusCode) end end concommand.Add("ttt_order_equipment", ConCommandOrderEquipment)