how can i get player from samp server in html?
#1

i want to get number of players in html and create a graph for my site like this nephrite.ro
Reply
#2

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." /> 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)