Vestorn Posted February 6, 2022 Share Posted February 6, 2022 hello, there was a problem with getting (monitoring) server data to the site. I tried GameQ, it doesn't work (script works but doesn't receive data). Are there any working options? Link to comment
Moderators IIYAMA Posted February 6, 2022 Moderators Share Posted February 6, 2022 @Vestorn There is a build in method as far as I can remember. But never used it myself. (Maybe somebody else knows) But this is the custom(isable) resource method you can use: https://wiki.multitheftauto.com/wiki/Resource_Web_Access https://wiki.multitheftauto.com/wiki/HttpWrite Link to comment
Vestorn Posted February 6, 2022 Author Share Posted February 6, 2022 6 hours ago, IIYAMA said: @Весторн Насколько я помню, существует встроенный метод. Но сам никогда им не пользовался. (Может быть, кто-то еще знает) Но это пользовательский(доступный) метод ресурсов, который вы можете использовать: https://wiki.multitheftauto.com/wiki/Resource_Web_Access https://wiki.multitheftauto.com/wiki/HttpWrite Oh, I don't think that's it. I specifically need to get monitoring of my server on my Web site. I searched the forum, everyone was talking about Gameq, but now it does not work and now I'm looking for an alternative. Tried https://mtasa.com/api/ but unfortunately couldn't reparse process Link to comment
Moderators IIYAMA Posted February 6, 2022 Moderators Share Posted February 6, 2022 5 hours ago, Vestorn said: Oh, I don't think that's it. I specifically need to get monitoring of my server on my Web site. It can full fill that part if you want, since MTA has a build in webserver, but you might want to add some serverside stuff for your website as middleware for anti-abuse performance reasons. Anyway I leave an example below for those that are interested. Resource name: webserver Filename: meta.xml <meta> <info version="1.0.0" name="webserver" type="script" description="Web server info" /> <html src="playerCount.html" /> <script src="main_s.lua" type="server" /> <export function="getPlayerCount" http="true" /> </meta> Method: 1 Filename: playerCount.html <* httpWrite( #getElementsByType ( "player" ) ) *> URL: http://127.0.0.1:22005/webserver/playerCount.html Returns: <what ever you want> Method: 2 Filename: main_s.lua function getPlayerCount() return #getElementsByType( "player" ) end URL: http://127.0.0.1:22005/webserver/call/getPlayerCount Returns: JSON Skip login? (it is not recommended to skip for production, use middleware instead for the credentials) Add: <right name="resource.webserver.http" access="true"></right> Under default: <acl name="Default"> <right name="resource.webserver.http" access="true"></right> 1 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