Jump to content

Console Command Issues

Fixed 1.5.0 1.5.1

dustyhansen
dustyhansen

Posted

Continuation of the conversation from this ticket: https://codefling.com/files/support/18497-quarry-limit/

When I enter the console command "gq [steamID]" in the F1 console, the command works and a quarry is delivered.

When I enter the same command in the RCON console or when a player purchases an quarry from my shop, the command throws the following error message in console and does not give a quarry:

Failed executing console command 'gq' in 'Quarry Computer v1.4.1 by Marte6' [callback] (Object reference not set to an instance of an object)
at void Oxide.Plugins.QuarryComputer.GiveQuarryCommandCmd(Arg arg) in /home/container/carbon/plugins/QuarryComputer.cs:line 1277
at object System.Reflection.RuntimeMethodInfo.Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)

After discussing this with the ShoppyStock developer, he has recommended a change to your code. You are checking for a null player, which doesn't work when the command is sent through the shop or RCON.

For example, In 1277 of your code, you are searching for Player() and in a console command the player is null and that is what is throwing the error.

        [ConsoleCommand("gq")]
        private void GiveQuarryCommandCmd(ConsoleSystem.Arg arg) => GiveQuarryCommand(arg.Player().IPlayer, "gq", arg.Args);

He suggests changing it to the following method instead:

[ConsoleCommand("gq")]
private void GiveQuarryCommandCmd(ConsoleSystem.Arg arg) => GiveQuarryCommand(arg.Player()?.IPlayer ?? null, "gq", arg.Args);

There are several areas in your code where this would need to be updated. I do not want to share the code with anyone to get it updated and I am not a developer myself. .Would you please review and make the corrections so that this can be used with different shop plugins and consoles?

Marte6

Posted

Changed Status from Pending to Fixed

Changed Fixed In to 1.5.1

Marte6

Posted

Sorry for the issues, fixed.

  • Like 1
dustyhansen

Posted

16 hours ago, Marte6 said:

Sorry for the issues, fixed.

I am still getting the same error message when someone buys a quarry through the shop or I use the command via RCON.

Marte6

Posted

Did you update to the latest version?
I'm testing it here, and it's working without any errors.

image.png.dbe5ebf9c2917f08d65177d1b82596e9.png

dustyhansen

Posted

5 hours ago, Marte6 said:

Did you update to the latest version?
I'm testing it here, and it's working without any errors.

image.png.dbe5ebf9c2917f08d65177d1b82596e9.png

yes, i did update
just tested again and same error when entering the command in Rust Admin or in my host's console or bought from the shop

Marte6

Posted

You use Carbon, right? I'm going to install Carbon on a server here to test it.

dustyhansen

Posted

10 minutes ago, Marte6 said:

You use Carbon, right? I'm going to install Carbon on a server here to test it.

yes, i do

Marte6

Posted

Hello, I installed the server with Carbon and managed to adjust it. I am uploading an update.

  • Like 1
1.6m

Downloads

Total number of downloads.

7.7k

Customers

Total customers served.

115.3k

Files Sold

Total number of files sold.

2.3m

Payments Processed

Total payments processed.

×
×
  • 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.