Burgershot
[Library] samp-server-info-obtainer - Printable Version

+- Burgershot (https://www.burgershot.gg)
+-- Forum: SA-MP (https://www.burgershot.gg/forumdisplay.php?fid=3)
+--- Forum: Releases (https://www.burgershot.gg/forumdisplay.php?fid=13)
+---- Forum: Libraries (https://www.burgershot.gg/forumdisplay.php?fid=31)
+---- Thread: [Library] samp-server-info-obtainer (/showthread.php?tid=1740)



samp-server-info-obtainer - KyroKun - 2021-03-07

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.



RE: samp-server-info-obtainer - Y_Less - 2021-03-14

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.


RE: samp-server-info-obtainer - KyroKun - 2021-03-27

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 



RE: samp-server-info-obtainer - KyroKun - 2021-05-05

https://github.com/kyro95/samp-server-info-obtainer/blob/1.1.0/src/samp-server-info-obtainer.ts

connection -> instance update has been released