Skip to content

Conversation

@motta-git
Copy link

@motta-git motta-git commented Dec 24, 2025

Description of Changes

As requested by the open issue 1290 (nzp-team/nzportable#1290)

i have fixed the addmoney cheat and added a new cheat called 'infammo'

the addmoney cheat had the issue that in order to be runned the user could type 'cmd addmoney 100' into the console and then because of the 'cmd' the command would work properly because it got forwarded to the server

With my code changes now when the user types 'addmoney 100' into the console that command will get forwarded to the server without the need of using 'cmd'

Also improved the addmoney command so it validates the inputed number better.

Also i created a new cheat called 'infammo' wich is a toggle that makes all weapons (including dual wield ones) to have infinite ammo.

Edit 2025-12-24 14:46:00:
the command 'spawn_pu' also had the same issue as addmoney so i just made a new commit adding it to the array of commands that get forwarded to the server


Visual Sample


image image Screenshot from 2025-12-24 14-18-36 image image image image

Checklist


  • I have thoroughly tested my changes to the best of my ability
  • I confirm I have not contributed anything that would impact Nazi Zombies: Portable's licensing and usage
  • This Pull Request fixes a critical issue that should be reviewed and merged as soon as possible

Copilot AI review requested due to automatic review settings December 24, 2025 17:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes the addmoney cheat command to work without requiring the cmd prefix and adds a new infammo cheat that provides infinite ammunition for all weapons. The changes implement automatic command forwarding from the client to the server for specified cheat commands, improving the user experience by eliminating the need to manually prefix commands with cmd.

  • Client-side command forwarding mechanism for server commands
  • Improved addmoney command with better input validation
  • New infammo toggle cheat that maintains maximum ammo for all weapons and grenades

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
source/client/main.qc Adds automatic forwarding of addmoney and infammo commands from client console to server
source/server/utilities/command_parser.qc Enhances addmoney validation and implements the new infammo toggle command
source/server/weapons/weapon_core.qc Integrates infinite ammo cheat into weapon firing logic to prevent ammo consumption and maintain full magazines
source/server/defs/custom.qc Declares the cheat_infiniteammo field for tracking infinite ammo state per player

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

// No parameter provided -> print a helpful message and fail.
if (argv(0) == "") {
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is executed before tokenize(params) is called on line 82, so argv(0) at this point contains the command name from the previous tokenization in the caller, not the first parameter. This check should be moved after the tokenize(params) call, or the params string itself should be checked for emptiness.

Suggested change
if (argv(0) == "") {
if (params == "") {

Copilot uses AI. Check for mistakes.
Comment on lines +86 to +87
if (point_value <= 0 && argv(0) != "0" && argv(0) != "0.0") {
sprint(self, 1, "Command_addmoney: <point_value> is either zero or lower or blank string. Failing.\n");
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation logic has issues: 1) It allows negative point values to be added (point_value <= 0 means negative values pass when argv(0) is "0" or "0.0"), and 2) The condition is confusing - it tries to allow exactly "0" and "0.0" but still rejects them because of the <= 0 check. If the intent is to allow zero, the condition should be point_value < 0 or if zero should be rejected, remove the special cases for "0" and "0.0".

Suggested change
if (point_value <= 0 && argv(0) != "0" && argv(0) != "0.0") {
sprint(self, 1, "Command_addmoney: <point_value> is either zero or lower or blank string. Failing.\n");
if (point_value < 0) {
sprint(self, 1, "Command_addmoney: <point_value> must not be negative. Failing.\n");

Copilot uses AI. Check for mistakes.
sprint(self, 1, "Command_addmoney: <point_value> is either zero or blank string. Failing.\n");
return COMMAND_FAILURE;
if (point_value <= 0 && argv(0) != "0" && argv(0) != "0.0") {
sprint(self, 1, "Command_addmoney: <point_value> is either zero or lower or blank string. Failing.\n");
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message says "is either zero or lower or blank string" but the condition actually allows zero when argv(0) is exactly "0" or "0.0". The message should accurately reflect what values are rejected.

Suggested change
sprint(self, 1, "Command_addmoney: <point_value> is either zero or lower or blank string. Failing.\n");
sprint(self, 1, "Command_addmoney: <point_value> is invalid (must be a positive number, or exactly '0' or '0.0'). Failing.\n");

Copilot uses AI. Check for mistakes.
return TRUE;
}
}
return FALSE;
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation of the return statement is inconsistent with the surrounding code. It should be aligned with the for loop above it to make the code structure clearer.

Suggested change
return FALSE;
return FALSE;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant