_Marco_ Posted November 25, 2022 Share Posted November 25, 2022 Hello friends, is it possible to see the names of other players' servers with api? Link to comment
Addlibs Posted November 25, 2022 Share Posted November 25, 2022 (edited) Edit: I've misread the question; the following is an answer to how to create an API that lists the players on your server. There are a number of ways to do this: Query the ASE port (123 above the server port, e.g. 22126 for a server running on 22003) for the information (I'm not sure how the ASE protocol works, you'd have to research it), or Query the server via its HTTP port (here you would need to create a HTTP web access resource which responds with the list of players in an encoding the API client expects, e.g. JSON) (can trigger anti-flood/anti-spam countermeasures on MTA server side if IP is not whitelisted in mtaserver.conf, as it would try to request a fresh list every time anyone loads a page; ideas for cached storage of fetched data below) this requires allowing guest HTTP access to the server (can expose admin functionality to everyone if not careful, so limit admin/webadmin resource access to authenticated users only), or setting up a dedicated user and logging in with it (password is sent via HTTP authenticate headers in plaintext, unencrypted; can expose admin functionality to eavesdropper on network between API client and MTA server; so limit this users ACL/RPC to read only access) or Have the server regularly send updates to a web server and the web server keep a copy of the latest list of players, or Have the server track players on it and update a MySQL database that the webserver connects to. The answer to your question is generally no, unless you plan to run surveillance on the MTA global server masterlist, query every server's player list and create a comprehensive database of who plays on what servers, and then query such a database. Edited November 25, 2022 by Addlibs Link to comment
Cadu12 Posted November 25, 2022 Share Posted November 25, 2022 Just for your servers, yes. It is not possible to do it if it is not your servers. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now