how can i get player from samp server in html? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: how can i get player from samp server in html? (
/showthread.php?tid=663229)
how can i get player from samp server in html? -
rockys - 25.01.2019
i want to get number of players in html and create a graph for my site like this
nephrite.ro
Re: how can i get player from samp server in html? -
Eoussama - 25.01.2019
One way you could do it is:
- Write a PHP script that fetches metadata about your SA:MP server, using something like SampQueryAPI.
- Associate your HTML page with some javascript code that gets your server's metadata through the PHP script you've written in step 1.
- Create a graph out of that data using a library like Chart.js or Plotly.js. If you want something even more robust, you can go with D3. However, given the simplicity of that graph, D3 might be too overkill.
- Now update the graph every *Insert-some-reasonable-time-here*.
If you just want a dependable graph and don't care about its customization or interactivity, you can go the lame way of manually fetching the link of the graph image on your server's page on
http://monitor.sacnr.com. And then load it on your HTML page using an
img tag.
PHP Code:
<img src="http://monitor.sacnr.com/image_link" alt="Lame and lazy graph." />