Jump to content

Share functions between resources and scripts


Recommended Posts

The way to share functions between resources is /export tag in meta and call function.

Questions:

1. Since export's goal is to share functions between different resources, is there any way to share functions between scripts in the same resource?

Does same export tag and call do this work?

2. Is there any page with information about how many MTA servers exists in the world? Or average? Information about count of MTA players online in the world? Any statistics information?

Link to comment
1. Since export's goal is to share functions between different resources, is there any way to share functions between scripts in the same resource?

Does same export tag and call do this work?

If you have more then one server side script (or more then one client side) You simply make the function global (all function ale global by default, you need to use local keyword to make them local) and that function will be accessible in any file of the specific side.

In order to call a server side function from client you can use triggerServerevent and add the event server side, In order to call a client side function from server you can use triggerClientevent and add the event client side.

The alternative to the event system is to use the "shared" keyword in meta.xml, though I never do that...

So in theory you can create a file called utility.lua write some global functions there and add this line to meta.xml:

2. Is there any page with information about how many MTA servers exists in the world? Or average? Information about count of MTA players online in the world? Any statistics information?

The mta server browser displays that information, you can also look for sites like this:

http://www.game-state.com/index.php?spp=50&game=mta

Link to comment

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