#Just confusing code

1 messages · Page 1 of 1 (latest)

tropic quartz
#
  • It looks like you have a module system called “curry” that just runs a function given without storing it in the modules table you’re checking from? Why even have this?

  • The “ConCluster_Fuck” message does no validation on the data provided, allowing clients to modify their inventory data on the server arbitrarily.

  • Whenever the inventory is modified, the entire table is sent back to the client with WriteTable. This is not good. Each item has a shared and known set of keys so there is no need to send them in its entire structure (write just each item’s values and put it back into a structure with the known keys on the client).

Also, there is often no need to resend the entire table. Instead you should only send the difference/changes back to the client where possible.

#

And just in general, I’d recommend you cache values more often. For example in the ConCluster receiver you access ply.Weapons_Inv a max of 5 times

#

Since you’re doing it on a player, each of these calls the player __index function which isn’t horrendous but you wanna try reduce it as much as possible

#

So just cache the players inv at the start of the function and reuse that to do your checks