Jump to content

onPlayerJoin - callRemote


'LinKin

Recommended Posts

Posted

Hello,

I readed that using callRemote inside the implementation of the onPlayerJoin event causes lag..

Is this true?

How about a MySQL connection? For example if I want that when a player joins it takes some value from an EXTERNAL* MySQL database.

*External: Because the MySQL database is hosted in another VPS.

If someone can clear out the doubt.

Thanks.

Posted

I've been scripting for a server that has an external database, it did cause some lag. For example, I wrote a turf system which loaded all of the turfs ( positions to capture ) out of an mysql, it had over 40 spots and did cause the well known 'network trouble'. I would strongly advise you to move your database to the same vps.

If you want to keep it this way, you can just create your mysql connection with onResourceStart. When a play joins, use mysql_ping to see if the database is still connected, if not. Connect it again. :) This will cause lag. Because the database is not hosted at the same location, it first has to connect, retrieve data, send data back and receive the data. Which, in some cases, might take a while.

Posted

The MySQL db is in Brazil.

I'd be accepting connections from Latin America as well as from Europe. Perhaps, the best thing would get a MySQL db somewhere in central europe.

Regarding MySQL module's function (mysql_ping), is it nessesary? I've always tried to avoid using that module, instead of it I use dbConnect etc.. https://wiki.multitheftauto.com/wiki/DbConnect

Posted

The integrated db functions are a much better option for being future-proof, though I'm still in the process of converting my gamemode to that (not long ago did I start the project, and I regret starting with the module now).

The point I was trying to make with the distance is where the actual game server is hosted, and where the DB is hosted. You need to allow for lag between the two servers, especially if they're in remote locations.

You'd be much better off getting one good server to run it all through instead, or at least move the servers closer together, both VPS' through one company for example.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...