View Single Post
  #6  
Old 05-03-2010, 12:42 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by sssssssssss View Post
So i just make that ="somevalue" the value of the var correct?

And I would probably grab maybe 3-4 things seperately, so this should work I think.
(sorry if I misunderstood your request and I come off as condescending)

If, for example, you wanted a live feed of the number of players on your server, you could create a DB NPC like this:

PHP Code:
function onCreated() {
  
this.onTimeOut();
}

function 
onInitialized() {
  
this.onTimeOut(); // restart the timeout in case NPC-server restarts
}

function 
onTimeOut() {
  
requestURL("http://example.com/update_players.php?players=" allplayers.size() @ "&pass=as!4dKSxm231");
  
this.setTimer(30); // update every 30 seconds

...then in the PHP script...

PHP Code:
// update_players.php

$password 'as!4dKSxm231'// password used to make sure the request came from the server
$ip '127.0.0.1'// IP of the server (find this on http://statistics.graal.us), for extra security

// is it from the server?
if ($ip != $_SERVER['REMOTE_ADDR'] || $password != $_GET['pass']) {
  die(
"request from unauthorized server"); // either the IP or password was wrong
}

$playerCount $_GET['players'];
// now you can store this in a file, MySQL, whatever 
__________________
Reply With Quote