• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Library] samp-server-info-obtainer
#1
https://github.com/kyro95/samp-server-info-obtainer
??? samp-server-obtainer ? A simple library made in typescript for obtaining your samp server info

Example:
Code:
import sampServer from "./path";

async function doTest() {
    const test = await sampServer.retriveInfo({
        ip: "",
        port: 7777
    }, "i");
    
    console.log(test);
}

doTest();

// Prints out an object which contains the samp server info submitted.
  Reply
#2
That's a nice idea. However, why are you passing an async callback, which isn't used in an async context, and passed to `then`? Why not just return the Promise directly and make `connect` `async`?

Edit: In fact the whole code is a strange mix of async, promises, and callbacks. Just stick with one model.
  Reply
#3
I made this library in just one day, thanks for the suggestions they will be fixed on the next update.

EDIT: sampServer.getInfo has to be await because sometimes?
Code:
this.socket.on('message')
response gets called before the query reaches the samp server, since sockets events aren't async i had to make a promise,
regarding sampServer.connect you're totally right?
  Reply
#4
https://github.com/kyro95/samp-server-in...btainer.ts



connection -> instance update has been released
  Reply


Forum Jump: