Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-03-2010, 12:06 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
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.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #2  
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
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:27 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.