Jump to content

Senicon030

Member
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Senicon030

  1. Senicon030

    Sputnik

    Bug: Console command givespacecard silently fails Plugin: Sputnik v1.5.7 Symptom: Running givespacecard from the server/F1 console produces no output at all — no item, no "Player not found", no error. The chat command /givespacecard works fine. Cause: In the [ConsoleCommand("givespacecard")] handler (GiveCustomItemCommand), the code reads arg.Args.Length directly: if (arg.Args.Length >= 1) { ulong userId = Convert.ToUInt64(arg.Args[0]); target = BasePlayer.FindByID(userId); } When the command is run without an argument, arg.Args is null, so arg.Args.Length throws a NullReferenceException. The exception is swallowed before any output is produced, which is why the console stays completely silent. Additionally, Convert.ToUInt64 throws on any non-numeric input instead of failing gracefully. Fix applied: Null-check arg.Args, switch to ulong.TryParse for safe parsing, and fall back to the calling player when no ID is supplied: BasePlayer player = arg.Player(); BasePlayer target = null; if (arg.Args != null && arg.Args.Length >= 1) { if (ulong.TryParse(arg.Args[0], out ulong userId)) target = BasePlayer.FindByID(userId); } else { target = player; } if (target == null) { PrintToConsole(player, "Player not found"); return; } Result: givespacecard (no arg) now gives the card to the calling player, givespacecard <SteamID64> gives it to the target, and the command no longer crashes on missing or invalid input.

About Us

Codefling is the largest marketplace for plugins, maps, tools, and more, making it easy for customers to discover new content and for creators to monetize their work.

Downloads
2.6m
Total downloads
Customers
11.4k
Customers served
Files Sold
163.2k
Total sales
Payments
3.5m
Processed total
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.