View Single Post
  #4 (permalink)  
Old 09-07-2007, 04:01 PM
Nuker Nuker is offline
Registered User
 
Join Date: Sep 2007
Posts: 6
Hello, i have another problem

In a game, i send a warrior to attack other player, this warrior travell to the enemy city and he have in the data base the time in "hours" "seconds" minuts date month and years to travell

I put a button to abort the travell, in that link i calculate.. the time in the data base of the warrior to finish the travell, minus the current time, the result i add to the current time, and know i have the new time to he must wait to travell from the current position to his "city"


The problem its... the result of all operations.. equal to the first time to he travell to the enemys point :S...

if anything cant understand me pls say.. i post better, sorry my bad english

i post the code, if any can show the error ... :/

PHP Code:
$sql=mysql_query("SELECT userid, victoria, dia, mes, anio, horas, minutos, segundos FROM kw_users WHERE userid = $userid",$con);
while(
$row mysql_fetch_array($sql))
  {
    if (
$row["victoria"] == "llendo"){
    
    
$date $row["dia"];
    
$month $row["mes"];
    
$year $row["anio"];
    
$hours $row["horas"];
    
$minuts $row["minutos"];
    
$seconds $row["segundos"];

$futuro mktime($hours$minuts$seconds$month$date$year) - time();

$futuro time() + $futuro;

$date date("d",$futuro);
$month date("m",$futuro);
$year date("y",$futuro);
$hours date("H",$futuro);
$minuts =  date("i",$futuro);
$seconds date("s",$futuro);

mysql_query("UPDATE kw_users SET dia = $date WHERE userid = $userid");
mysql_query("UPDATE kw_users SET mes = $month WHERE userid = $userid");
mysql_query("UPDATE kw_users SET anio = $year WHERE userid = $userid");
mysql_query("UPDATE kw_users SET horas = $hours WHERE userid = $userid");
mysql_query("UPDATE kw_users SET minutos = $minuts WHERE userid = $userid");
mysql_query("UPDATE kw_users SET segundos = $seconds WHERE userid = $userid");
  } 

Last edited by Nuker; 09-07-2007 at 04:03 PM.
Reply With Quote