Guad / GTACoop

An online co-op modification for GTA5
GNU General Public License v3.0
81 stars 71 forks source link

Clear tick natives after being disconnected #7

Closed DorCoMaNdO closed 8 years ago

DorCoMaNdO commented 8 years ago

Clear tick natives after being disconnected (I noticed that the code doesn't reach it only after the fact, but it doesn't harm to have it) Added locks to Opponents, Npcs, _vehMods, _pedClothes, _threadJumping and _tickNatives. Fixed CheckPlayerProps() returning _vehMods. Fixed pressing the menu key opening the main menu, even when in a submenu.

DorCoMaNdO commented 8 years ago

Ahh forgot one undo for the menu thing, I was going to make it so it's placed at the bottom, and the native ticks would then run from within the statement, but I reverted that, should have probably paid more attention.

And yes it will throw an exception, my bad, fix that by initializing the dictionaries from their definition, that part has to have locks, it executes whenever a player connects, and if any of the values are being used for whatever reason elsewhere in the code, it will fail.

Guad commented 8 years ago

Yeah I ended up doing that.

DorCoMaNdO commented 8 years ago

By the way, clearing arrays that are found inside arrays (eg List in a Dictionary) shouldn't be required, the garbage collector handles that. Once a variable cannot be referenced to anymore, the garbage collector will clear it.