|
|
Since keep selling this stuff, figured I would release my old server's one from months ago.
First:
Go into your Server class and under:
addCode:public class Server {
then under main add:Code:public static boolean forceWebUpdate = false; public static Thread WebCommThread = new Thread ( new Runnable(){ long lastUpdate = 0; @Override public void run(){ while(true){ try{ if(System.currentTimeMillis() - lastUpdate > 1000 * 60 * 5 || Server.forceWebUpdate){ lastUpdate = System.currentTimeMillis(); new URL("http://website.com/vps/reset.php?pass=jilixpie").openStream().close(); for(Player p1: PlayerHandler.players){ if(p1 != null){ Client p = (Client)p1; if(!p.properLogout) new URL("http://website.com/vps/add.php?pass=jilixpie&u=" + p.playerName.replaceAll(" ","%20")).openStream().close(); } } if(Server.forceWebUpdate) Server.forceWebUpdate = false; System.gc(); } }catch(Exception e){} } } } );
Then make sure to import:Code:WebCommThread.start();
Second:Code:import java.net.*;
In your Client class somewhere under logout add:
then declare this somewhere:Code:Server.forceWebUpdate = true;
then under process add:Code:public boolean runOnce = true;
Third:Code:if(runOnce){ Server.forceWebUpdate = true; runOnce = false; }
Download these files and add them to your webhost:
Players Online Files
You have to call it somehow to count players, like this:
Credits:Code:<?php $fileName = FOLDNAME/players.txt"; $countOnline = count(file($fileName)); echo "$countOnline players online."; ?>
Matt123337
Me

I'm more of an in-game person.
Great job, thank you!

Nice
Fix:
In server.java
add this import
import java.net.*;
Very Nice Chris![]()
May use bro
Wait, I'm confused how do we call it to the website??
| « [PI] Cracking Wall Safes | [Hyperion] Object Deleting » |
| Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |