Currently the developers are putting their own money into JC2-MP to keep the servers online.

Please take a few seconds of your time and disable your AdBlock plugin for our website.

Ad revenue is not going to developers, it is used purely for covering our hosting costs.


You are also free to donate, which removes all ads from our website!

Patch 0.3 was just released! Full changelog here:

3 years ago

May 31, 2020, 02:36:45 am

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - DaAlpha

Pages: [1] 2 3 4
Releases / Re: [Release] Players Markers
« on: April 11, 2020, 12:17:42 pm »
Very creative, good work! If only I could code something like that ...

It would have helped if you would have given the exact error message and specified to which line in your snippet it corresponds.

That being said, I am pretty sure the issue starts in line 29 where you are trying to bind argu.position. Bind() only takes a number or a string as second argument, argu.position is userdata though (an instance of Vector3 to be exact, assigned in line 20). If you want to store it, you have to store its x, y and z values in separate columns (and of course put them back together when you retrieve them in your other module). The same applies to argu.angle, argu.tone1 and argu.tone2.

I am also pretty sure you can not bind nil values but that is exactly what's going to happen in lines 40 and 42 if item:GetDecal() or item:GetTemplate() returns nil. If you want to store an empty value, don't bind that placeholder.

Suggestions / Re: A few ideas.
« on: March 19, 2018, 02:04:58 am »
I am fairly sure the reason why DLCs are not shown to everyone is simply because they do not have the model and texture files for those, contained in the DLC directory in the base game dir. Giving those to every player would probably be piracy, as those are paid content.

I agree that the DLC situation is not great but I see no easy solution to that.

The hook visualization is just a mediocre workaround and not too pretty. I don't think that it is good enough to be put in as a core feature of the mod.

Releases / Re: [RELEASE] Clear Inventory
« on: April 07, 2017, 08:00:13 pm »
Nice clean code actually, good job!

One mistake in it: the command gets printed to the chat. You need to do a "return false" between lines 9 and 10 to tell the chat not to send the actual command as a message.

If you want to satisfy the perfectionist in me: the first if clause from line 3 to 10 is indented one too far. The if and end should be on the same level as the local variable declaration in line 2.

Also, it s a best practice not to declare and assign variables before you need them in the code. In the code right now, you assign the inventory variable every time the player writes ANY chat message. You would want to put it behind the args.text == "/clear" check so it only assigns it when it is actually needed.

Alternatively, you can even remove the declaration in line 2 entirely and call the clear inventory function inside the table.count on line 4 like this: table.count(args.player:GetInventory())

Just some basic suggestions :)

Bug reports / Re: Serving crashing bug in SQL bind error.
« on: December 07, 2016, 12:33:59 am »
I ran it in the sqlite3 shell (it available as a Debian package) since I did not want to start a JC2 server just to execute it, but running it via SQL:Execute() should work just as fine.

Bug reports / Re: Serving crashing bug in SQL bind error.
« on: December 06, 2016, 08:26:58 pm »
Thanks for that advice. I guess this is something I should have done ages ago already, had I known this is a thing.

Looking good for me though.

Code: [Select]
sqlite> pragma integrity_check;

Bug reports / Re: Serving crashing bug in SQL bind error.
« on: December 05, 2016, 08:05:16 pm »
Can confirm this. I also experienced LOTS of full server crashes because of apparently uncaught exceptions when committing something to the DB.

Releases / Re: Projectiles/Missiles
« on: November 07, 2016, 12:49:03 am »
*digs out dead thread*

Just found a bug that does not seem to have been reported yet.

In the entities/missile.lua file, line 127, it calculates the slerped angle and stores it in new_angle but in line 129, it passes the final target angle dir_to_target on. This obviously results in missiles instantly rotating to the final direction and ignoring the max_turn_angle setting.

Thought you might want to know. Jason actually seems to have found this as well, the bug is fixed in his SAM missiles.

Releases / Re: [Release] AdvancedBoost (Outdated)
« on: November 06, 2016, 12:23:29 am »
I finally got around to updating this last piece of ancient code I released for JC2MP. Basically I rewrote half of the code so it is more efficient, easier to understand and edit and matches my current coding conventions.

On the user side, there are barely any changes. The GUI window looks slightly different and I changed the air boost key to Q, which is apparently more convenient due to the Shift + Tab Steam overlay combination.

On the technical side, several big things have changed. For one, the database is now fully cached similar to my passive module (I actually borrowed some code from it). Settings are now stored in a proper database table with a primary key ... so amazing.

The settings are also not sent to the server as a bulk when closing the window anymore and instead they are sent as soon as they are changed. Since it does not write those to the DB directly, there are no issues with murdering server performance by spamming the checkboxes. And even better, it only stores a setting if it is different to the default one now.

The code is now, as mentioned, a little more structured and less redundant. I am not too much of a fan of the fact that the setting storage system takes about 50% of the code and that the settings are still hardcoded in mostly the same way as before but I did not really want to over-engineer this entire thing.

Releases / Re: [Release] ProperPassive
« on: October 23, 2016, 02:53:45 pm »
Just pushed another random update with those three changes:

  • I modified the caching/DB part yet again. I found that the old way of caching was a bit strange and generally not too great. With the new method it still loads the entire DB into the cache but it now also has a separate table where it keeps the difference between cache and DB. Periodically (by default every 6 hours), on module unload or via a console command, the changes are written to the DB. Simple.
  • I changed the way the cooldown timer works clientside slightly. Before it was a Timer object which was restarted when the passive mode was changed. The issue was, this prevented the change of the passive state for the length of the cooldown after the module has been loaded (so basically x seconds after server join). I circumvented it by instead using timestamps based on the elapsed client seconds instead of a timer.
  • I changed the indentations to 2 char soft tabs. It is my new convention for Lua and it makes it far more readable on different machines.

Now back to bed, thread.

Releases / Re: [Release] ProperPassive
« on: March 11, 2016, 08:59:40 pm »
I just tossed out an update again:

  • It does not write it to the DB right away anymore when a player changes his passive state. Instead, it is written into a table with a timestamp.
  • When a player joins, instead of running an SQL query, the script just checks the table for an entry for the joining player, sets the passive state accordingly and updates the timestamp.
  • In a set interval (that is set to 1 hour by default), the server iterates over the table, removes the entries that are older than an adjustable amount of days (7 by default) and writes the entire table to the database table. The latter is done when the module gets unloaded as well.
  • When the module is loaded, it loads the contents of the SQL database to the table in the script.

The purpose of this is to avoid the slow database access times as good as possible, as well as avoiding a lot of essentially dead data in the database. Both is accomplished by this update. The only downside is that 1) if the module crashes without running the module unload event, all changes in the current interval are lost, which will not really matter since at the default value, this can be a maximum of 59 minutes, and 2) when players return to the server after a longer absence and expect their passive to be enabled on join, of course this will not be the case. I guess you can imagine that 99% of the players will not care about this anyways so in total, this update is a good trade in my opinion.

Scripting / Re: Analog clock script
« on: February 20, 2016, 02:28:27 pm »
Good job there, I like it! Might actually toss it on Nolo with a toggle for analog/digital if I have time.

Troubleshooting / Re: Unhandled Packet 131 from <IP Address>
« on: February 14, 2016, 03:44:59 pm »
Yes, I did run an IP which sent those unhandled packets through an IP tracker and got something in Cairo, Egypt.

Troubleshooting / Re: Unhandled Packet 131 from <IP Address>
« on: February 14, 2016, 02:42:44 pm »
I would like to add that, if one does not block the IP, it stops spamming after some time, usually 1-5 minutes. It already occured for a straight 20 minutes though. Also, at least when I checked this once, there was no player on the server whose IP address matches the one in the message.

So far I have assumed it is just someone whose internet/client is broken and who sends loads of bad requests when he tries to join that the server can not handle.

Releases / Re: [Release] ProperPassive
« on: January 11, 2016, 07:36:39 pm »
Good stuff, changed. Thanks!

Pages: [1] 2 3 4