This is a test, that i manually changed in the DB
377 is the current wPosXQuote:
Time Now: 09:29:57
STOP
337-216-09:29:58
337-216-09:29:59
337-216-09:30:00
337-216-09:30:01
337-216-09:30:02
337-216-09:30:03
337-216-09:30:04
337-216-09:30:05
337-216-09:30:06
337-216-09:30:07
337-216-09:30:08
337-216-09:30:09
337-216-09:30:10
216 is the current wPowY
09:30:10 is the time
-> 09 = hour
-> 30 = min
-> 10 = sec
so we know that i takes 1sec to update, right ?
Player did not move - 2010-12-18 09:11:01
Player moved! - 2010-12-18 09:11:02
thats 1 sec
ok here is the very buggy script, but it works
call this "dbtime.php"
PHP Code:
<?php
$mssql = array(
'host' => "localhost",
'user' => "sa",
'pass' => "pass"
);
switch($_POST['task']){
case "getxy":
$mslink = mssql_connect($mssql['host'],$mssql['user'],$mssql['pass']);
$name = "Knork";
$time = date("H:i:s");
$result1 = mssql_query("SELECT * FROM character.dbo.user_character WHERE character_name = '".$name."' ",$mslink);
$array = mssql_fetch_array($result1);
echo $array['wPosX'] . "-" . $array['wPosY'] . "-" . $time . "<br>";
break;
default:
break;
}
?>
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Live Users</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>
$(document).ready(function()
{
//dbtime.php is called every second to get X and Y from db
var refreshId = setInterval(function()
{
$('#timeval').load('dbtime.php');
$.post("dbtime.php",{task:"getxy"},function(data) {
$("#status").append("<div>"+data+"<\/div>");
});
}, 1000);
//stop the script when this button is pressed
$("#stop").click(function()
{
clearInterval(refreshId);
});
});
</script>
</head>
<body>
<div>Time Now: <?php echo date("H:i:s"); ?></div>
<button id="stop">STOP</button>
<div id="timeval">--:--:--</div>
<div id="status"></div>
</body>
</html>
Ok so change you mssql info
now in ths dbtime.php
$name = "Knork";
Set you name your gonna play with in the dbtime.php
now run the index.php in your browser, start the game and move around with the character that you just wrote in dbtime.php
after a while you can minimize your game and press the STOP button
Now post the info here
PS: this run 1 query each second, so turn the script OFF when your dont






