Beiträge von Meister Rog

    jop hab die 32 version von 7 und vorher ging es ja eigentlich auch blos jetzt auf mal nicht mehr selbst bei gta und hab letzten versucht hamchi zu zocken und findet auch kein erstelten server

    hi ich hab ein problem und zwar immer wenn ich mich bei games for windows live einloggen wil bei was für ein game auch steht da immer einloggen fehlgeschlagen und bei dirt 3 funkt es nach 10 anleufen aber denn schlägt es bein update fehl... bin an verzweifeln wie kann ich das beheben

    alex neben bei mafia 2 und just ist viel komplexer aufgebaut als x so und jetzt zur x serie bei tc wirds schwer wegen der sinca funktion mann hat viele verschiedene schife die mann fliegen kann da durch wirds schwere mit tc als rebith weil da hat ja eh jeder ein spieler schif nur zuverfügung die sinca fält eh weg weil die nicht mehr vorhanden ist aber dafür hat mann da schon eine higway wo mann mit viel schneller voran kommt und bei tc lohnt es sich eh nicht mehr zuentwickeln weil ja jetzt eh nextes ja eh schon re kommt
    und wegen denn 3 leute noch mal wir sind eh noch suche auf welche die das project unterstüzen werden und wir kriegen ja noch unterstüzung von entwickler team was die anderen halt nicht haben

    ich habs zwar noch nicht aber holt euch die superbox da ist es denn gratis mit bei
    und redline oder jemand anderes hab schon kleines team von 3 mann und suchen noch weiterer wir bastelen ein multiplayer für x rebithe mit den gleichen prinzip von samp mit variabelen also speicheraddressen auszulesen richtig verpacken und versenden unser vorhaben wird gut zurealisieren sein weil wir jemanden erfahrenden haben und dirket unterstüzung von egosoft erhalten werden

    hi doofe frage hat jemand von euch call of duty black ops moon auf der xbox mich nerven da die lobbys momentan sowas von ab entweder keiner kommt rein oder die 10 jährigen kommen beleidigen ein und gehen kurz vorn start raus -.- also wer hat bock auf ne runde ? ^^

    kann mir jemand sagen wie ich es jetzt umschreiben sol das der client von mein mysql erstelten datenbank/server auslist


    [expander]while(true)
    {
    $m++;
    $log="";
    $n=0;
    $logfile=@file_get_contents($logpath);

    if(strpos($logfile, "send ")!==false)
    {
    $logfile=fopen($logpath,"r+");
    while(!feof($logfile))
    {
    if($n!=0) $log.="&";
    $log.=$n."=".urlencode(fgets($logfile));
    $n++;
    }
    rewind($logfile);
    ftruncate($logfile,0);
    fclose($logfile);
    //$tserver=file("http://".$serverpath."/main.php?l=$lang_ID&".$log, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    $fp = fsockopen("jgue.homelinux.net", 80);
    if ($fp)
    {
    fputs($fp, "POST /tcmp/main.php HTTP/1.1\r\n");
    fputs($fp, "Host: jgue.homelinux.net\r\n");

    fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
    fputs($fp, "Content-length: ". strlen($log) ."\r\n");
    fputs($fp, "Connection: close\r\n\r\n");
    fputs($fp, $log);

    $tdata="";
    $i=0;
    while(!feof($fp))
    {
    $tline=trim(fgets($fp, 2048));
    if($i>9 AND $tline!="" AND strlen($tline)>=7)
    $tdata.=$tline."\n";
    $i++;
    }
    fclose($fp);
    echo $tdata."\n\n";
    $tfile=fopen("t/7441-L0".$lang_ID.".xml", "w+");
    fwrite($tfile, $tdata);
    fclose($tfile);
    }
    $m=0;
    $del=false;
    }
    elseif($m>(15*$t) AND !$del)
    {
    $tfile=fopen("t/7441-L0".$lang_ID.".xml", "w+");
    rewind($tfile);
    ftruncate($tfile,0);
    fclose($tfile);
    $m=0;
    $del=true;
    }

    usleep(1000000/$t);//0.25 sec
    } //ende while



    ?>[/expander] client datei zum starten


    [expander]<?php
    $time=microtime(true);
    include("config.php");
    $n=0;
    $tb=15;
    $loggedin=false;
    $firstlogin=false;
    $bigupdate=false;
    $lang_ID=49;


    $rettime=substr(str_replace(".","",$time), -9,-1);
    if(isset($_REQUEST['l']))
    $lang_ID=trim(mysql_real_escape_string($_REQUEST['l']));
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
    echo "<language id=\"$lang_ID\">\n";
    echo "<page id=\"7441\">\n";


    foreach($_REQUEST as $msg_line)
    {
    $msg_line=trim($msg_line);
    $msg=explode(" ", $msg_line);
    $player_ship=false;
    switch($msg[0])
    {
    case "fl":
    $firstlogin=true;
    case "l":
    if($loggedin==true) break;
    $sql="SELECT * FROM player WHERE player_name='".mysql_real_escape_string($msg[1])."' AND player_pass='".md5(mysql_real_escape_string($msg[2]))."' LIMIT 1 ;";
    $result=mysql_query($sql) OR die(mysql_error());
    if(mysql_num_rows($result)==1)
    {
    $loggedin=true;
    $player=mysql_fetch_assoc($result);
    if($time>=($player['player_last_b']+$tb))
    {
    $sql="UPDATE player SET player_last_b = '$time', player_last_s = '$time' WHERE player_ID='".$player['player_ID']."' ;";
    $bigupdate=true;
    if($firstlogin)
    echo "<t id=\"$n\">f_loggedin</t>\n";
    else
    echo "<t id=\"$n\">loggedin</t>\n";
    $n++;
    }
    else
    {
    $sql="UPDATE player SET player_last_s = '$time' WHERE player_ID='".$player['player_ID']."' ;";
    echo "<t id=\"$n\">loggedin</t>\n"; $n++;
    }
    echo "<t id=\"$n\">$rettime</t>\n"; $n++;
    mysql_query($sql) OR die(mysql_error());

    $sql="SELECT * FROM ship WHERE ship_player_NR = '".$player['player_ID']."' AND ship_is_playership LIMIT 1 ;";
    $result=mysql_query($sql) OR die(mysql_error());
    if(mysql_num_rows($result)==1)
    $ship=mysql_fetch_assoc($result);
    }
    else
    {
    echo "<t id=\"$n\">retry</t>\n"; $n++;
    echo "<t id=\"$n\">$rettime</t>\n"; $n++;
    echo "<t id=\"$n\">end</t>\n"; $n++;
    echo "</page>\n";
    echo "</language>\n";
    exit;
    }
    break;
    case "csi": //"change_ship_id" id new
    if(!$loggedin) break;
    $sql="UPDATE ship SET ship_oID = '".substr(mysql_real_escape_string($msg[2]),1)."'
    WHERE ship_ID = '".mysql_real_escape_string($msg[1])."' AND ship_player_NR='".$player['player_ID']."' ;";
    mysql_query($sql) OR die(mysql_error());
    break;
    case "cti": //"change_station_id" id new
    if(!$loggedin) break;
    $sql="UPDATE station SET station_oID = '".substr(mysql_real_escape_string($msg[2]),1)."'
    WHERE station_ID = '".mysql_real_escape_string($msg[1])."' AND station_player_NR='".$player['player_ID']."' ;";
    mysql_query($sql) OR die(mysql_error());
    break;
    case "bps":
    $player_ship=true;
    case "bs":
    echo "ok...\n";
    if(!$loggedin) break;
    $i=1;
    $id= $msg[$i++]; //id of player's object
    $id=substr($id, 1);
    $sname= $msg[$i++]; //ship name
    $pname= $msg[$i++]; //pilot name
    $pfs= $msg[$i++]; //pilot skill (fight)
    $pts= $msg[$i++]; //pilot skill (trade)
    $homebase= $msg[$i++]; //homebase
    $command= $msg[$i++]; //command
    $command_tgt= $msg[$i++]; //command target
    $command_tgt2= $msg[$i++]; //command target2
    $command_tgt3= $msg[$i++]; //command target3

    $sql="UPDATE ship SET ship_name='".mysql_real_escape_string($sname)."', ship_pilot='".mysql_real_escape_string($pname)."',
    ship_pilot_f='".mysql_real_escape_string($pfs)."', ship_pilot_t='".mysql_real_escape_string($pts)."',
    ship_is_playership='$player_ship', ship_last_b='$time',
    ship_homebase_NR='".mysql_real_escape_string($homebase)."', ship_command='".mysql_real_escape_string($command)."',
    ship_command_target='".mysql_real_escape_string($command_tgt)."', ship_command_target2='".mysql_real_escape_string($command_tgt2)."', ship_command_target3='".mysql_real_escape_string($command_tgt3)."'
    WHERE ship_oID='".mysql_real_escape_string($id)."' AND ship_player_NR='".$player['player_ID']."' ;";
    mysql_query($sql) OR die(mysql_error());
    $player_ship=false;
    break;

    case "rs":
    if(!$loggedin) break;
    $status="";
    $i=1;
    $id= $msg[$i++]; //id of object
    $sectorx= $msg[$i++]; //sector_x
    $sectory= $msg[$i++]; //sector_y
    $hull= $msg[$i++]; //hull
    $shield= $msg[$i++]; //shield
    //variable properties:
    if($msg[$i]=="is")
    {
    $status =$msg[$i++]; //"ship_in_sector"
    $status.=" ".$msg[$i++]; //x //coords
    $status.=" ".$msg[$i++]; //y
    $status.=" ".$msg[$i++]; //z
    $status.=" ".$msg[$i++]; //rx //rotation
    $status.=" ".$msg[$i++]; //ry
    $status.=" ".$msg[$i++]; //rz
    $status.=" ".$msg[$i++]; //speed
    // //command
    }
    elseif($msg[$i]=="do")
    {
    $status =$msg[$i++]; //"docked"
    $status.=" ".$msg[$i++]; //ID (dock)
    }//, ship_command_target3='".mysql_real_escape_string($command_tgt3)."',
    $sql="UPDATE ship SET ship_sector_x='".mysql_real_escape_string($sectorx)."', ship_sector_y='".mysql_real_escape_string($sectory)."',
    ship_status='".mysql_real_escape_string($status)."',
    ship_hull='".mysql_real_escape_string($hull)."', ship_shield='".mysql_real_escape_string($shield)."',
    ship_last_s='$time'
    WHERE ship_ID='".mysql_real_escape_string($id)."' AND ship_remote='".$player['player_ID']."' ;";
    mysql_query($sql) OR die(mysql_error());
    break;

    case "t": // "t" objectID sector_x sector_y x y z rx ry rz station_name hull shield
    if(!$loggedin) break;
    $i=1;
    $id= $msg[$i++]; //id of player's object
    $id=substr($id, 1);
    $maintype= $msg[$i++]; //maintype
    $subtype= $msg[$i++]; //subtype
    $sectorx= $msg[$i++]; //sector_x
    $sectory= $msg[$i++]; //sector_y
    $x= $msg[$i++]; //
    $y= $msg[$i++]; //
    $z= $msg[$i++]; //
    $rx= $msg[$i++]; //
    $ry= $msg[$i++]; //
    $rz= $msg[$i++]; //
    $hull= $msg[$i++]; //hull
    $shield= $msg[$i++]; //shield
    $name= $msg[$i++]; //station name



    $sql1="INSERT INTO station (station_oID, station_player_NR, station_maintype, station_subtype, station_sector_x, station_sector_y)
    VALUES ('".mysql_real_escape_string($id)."', '".$player['player_ID']."', '".mysql_real_escape_string($maintype)."', '".mysql_real_escape_string($subtype)."',
    '".mysql_real_escape_string($sectorx)."', '".mysql_real_escape_string($sectory)."') ;";
    $sql2="UPDATE station SET station_x='".mysql_real_escape_string($x)."', station_y='".mysql_real_escape_string($y)."', station_z='".mysql_real_escape_string($z)."',
    station_rx='".mysql_real_escape_string($rx)."', station_ry='".mysql_real_escape_string($ry)."', station_rz='".mysql_real_escape_string($rz)."',
    station_name='".mysql_real_escape_string($name)."', station_last_s='$time', station_hull='".mysql_real_escape_string($hull)."',
    station_shield='".mysql_real_escape_string($shield)."'
    WHERE station_oID='".mysql_real_escape_string($id)."' AND station_player_NR='".$player['player_ID']."' ;";
    //mysql_query($sql1);
    mysql_query($sql2) OR die(mysql_error());
    break;

    case "sgn" :
    if(!$loggedin) break;
    $m2= @mysql_real_escape_string($msg[2]);
    $m3= @mysql_real_escape_string($msg[3]);
    $m4= @mysql_real_escape_string($msg[4]);
    $m5= @mysql_real_escape_string($msg[5]);
    $m6= @mysql_real_escape_string($msg[6]);
    $req="error?";
    //if($station==-1)
    //break;
    switch($msg[1])
    {

    case "b":
    $req=buy_ware(substr($m2, 1), $player['player_ID'], $m3, $m4, $m5, $m6);
    break;
    case "s":
    $req=sell_ware(substr($m2, 1), $player['player_ID'], $m3, $m4, $m5, $m6);
    break;
    case "u":
    $req=unload_ware(substr($m2, 1), $player['player_ID'], $m3, $m4, $m5, $m6);
    break;
    case "l":
    $req=load_ware(substr($m2, 1), $player['player_ID'], $m3, $m4, $m5, $m6);
    break;
    case "bs":
    $req=buy_ship($m2, $player['player_ID'], $m3, $m4, $ship['ship_sector_x'], $ship['ship_sector_y']);
    }
    $sql="INSERT INTO server_request (`request`, `time`) VALUES ('".mysql_real_escape_string($msg[1])." $m2 ".$player['player_ID']." $m3 $m4 $m5 $m6 $req', '$time');";
    mysql_query($sql) OR die(mysql_error());

    break;

    case "msg" :
    echo "OK!!!";
    if(!$loggedin) break;
    echo "OK!!!";
    $sql="INSERT INTO `message` (`message_from`, `message_to`, `message_text`, `message_time`)
    VALUES ('".$player['player_name']."', 0, '".mysql_real_escape_string($msg[1])."', '$time') ;";
    mysql_query($sql) OR die(mysql_error());

    default:
    //echo "unbekannt: ".$msg_line."\n";
    }
    //print_r($msg);
    }
    //send changes: `lastupdate` > '$lastcheck' & `player_ID` != $player['player_ID']
    if(!$loggedin)
    {
    echo "<t id=\"$n\">retry</t>\n"; $n++;
    echo "<t id=\"$n\">$rettime</t>\n"; $n++;
    echo "<t id=\"$n\">end</t>\n"; $n++;
    echo "</page>\n";
    echo "</language>\n";
    exit;
    }
    //echo "<t id=\"$n\">end</t>\n";$n++;echo "</page>\n";echo "</language>\n";die();
    if($bigupdate OR $firstlogin)
    {
    //infos
    playerinfo($player['player_ID']);
    all_station($player['player_ID']);
    if($firstlogin)
    {
    own_ships($player['player_ID']);
    }
    else
    {
    own_ships($player['player_ID']);
    }
    big_ship($player['player_ID']);
    remote_ship($player['player_ID']);
    }
    else
    {
    if(isset($ship))
    {
    short_ship($player['player_ID'], $player['player_last_s'], $ship['ship_sector_x'], $ship['ship_sector_y']);
    }
    else
    {
    short_ship($player['player_ID'], $player['player_last_s']);
    }
    short_station($player['player_ID'], $player['player_last_s']);
    }
    commands($player['player_ID'], $player['player_last_s']);
    show_msgs($player['player_ID'], $player['player_name'], $player['player_last_s']);


    echo "<t id=\"$n\">end</t>\n"; $n++;
    echo "</page>\n";
    echo "</language>\n";


    $dtime=microtime(true)-$time;
    $sql1="INSERT INTO server (date) VALUES ('".date("dmy")."');";
    $sql2="UPDATE server SET time_average_ms=(time_sec+'$dtime')/(num_requests+1)*1000 , num_requests=num_requests+1, time_sec=time_sec+'$dtime' WHERE date='".date("dmy")."' ;";
    mysql_query($sql1);
    mysql_query($sql2) OR die(mysql_error());
    ?>
    [/expander] main.php


    [expander]<?php
    // please enter your mysql data
    $sqlpwd ="...";
    $sqluser ="root";
    $adminpwd ="...";


    mysql_connect("localhost",$sqluser,$sqlpwd) OR die(mysql_error());
    mysql_select_db("tcmp") OR die(mysql_error());


    function show_msgs($pID, $pName, $last)
    {
    global $n;
    $sql="SELECT * FROM message WHERE ( message_to = '0' OR message_to = '$pID' ) AND message_time > '$last'-10 AND message_from != '$pName' ORDER BY message_time ASC;";
    $result=mysql_query($sql) OR die(mysql_error());
    while($row=mysql_fetch_assoc($result))
    {
    echo "<t id=\"$n\">msg;".$row['message_from'].";".$row['message_to'].";".
    str_replace(";", "", $row['message_text']).";".substr(str_replace(".","",$row['message_time']), -9,-1)."</t>\n"; $n++;
    }
    }


    function playerinfo($pID)
    {
    global $n;
    $sql="SELECT * FROM player WHERE player_ID='$pID' ;";
    $result=mysql_query($sql) OR die(mysql_error());
    $row=mysql_fetch_assoc($result);
    echo "<t id=\"$n\">pi;".$row['player_money'].";".$row['player_f_skill'].";".$row['player_t_skill'].
    "</t>\n"; $n++;
    //t.b.c.
    }


    function own_ships($pID)
    {
    global $n;
    $sql="SELECT * FROM ship, player WHERE ship_player_NR = player_ID AND player_ID = '$pID' ;";
    $result=mysql_query($sql) OR die(mysql_error());
    while($row=mysql_fetch_assoc($result))
    {
    echo "<t id=\"$n\">ps;".$row['ship_ID'].";".$row['ship_subtype'].";".$row['ship_sector_x'].";".
    $row['ship_sector_y'].";".$row['ship_name'].";".$row['ship_hull'].";".$row['ship_shield'].";".
    $row['ship_is_playership'].";".$row['ship_homebase_NR'].";".$row['ship_command'].";".
    $row['ship_command_target'].";".$row['ship_command_target2'].";".$row['ship_command_target3'].";".
    str_replace(" ",";",trim($row['ship_status'])).";".$row['ship_wares']."</t>\n"; $n++;
    }
    }


    function short_ship($pID, $last, $pX=-1, $pY=-1)
    {
    global $n;
    if($pX==-1)
    $sql="SELECT * FROM ship, player WHERE ship_player_NR=player_ID AND ship_player_NR!='$pID' AND ( ship_last_b > '$last' OR ( ship_last_s > '$last' ) ) AND ship_remote != '$pID' ;";
    else
    $sql="SELECT * FROM ship, player WHERE ship_player_NR=player_ID AND ship_player_NR!='$pID' AND ( ship_last_b > '$last' OR ( ship_last_s > '$last' AND ship_sector_x='$pX' AND ship_sector_y='$pY' ) ) AND ship_remote != '$pID' ;";
    $result=mysql_query($sql) OR die(mysql_error());
    while($row=mysql_fetch_assoc($result))
    {
    echo "<t id=\"$n\">s;".$row['ship_ID'].";".$row['ship_sector_x'].";".$row['ship_sector_y'].";".
    str_replace(" ",";",$row['ship_status'])."</t>\n"; $n++;
    }
    }


    function big_ship($pID)
    {
    global $n;
    $sql="SELECT * FROM ship, player WHERE ship_player_NR=player_ID AND ship_player_NR!='$pID' ;";
    $result=mysql_query($sql) OR die(mysql_error());
    while($row=mysql_fetch_assoc($result))
    {
    echo "<t id=\"$n\">bs;".$row['ship_ID'].";".$row['ship_subtype'].";".$row['ship_sector_x'].";".
    $row['ship_sector_y'].";".$row['ship_name'].";".$row['player_name'].";".$row['player_race'].";".$row['ship_hull'].";".
    $row['ship_shield'].";".$row['ship_pilot'].";".$row['ship_pilot_f'].";".$row['ship_pilot_t'].";".
    str_replace(" ",";",$row['ship_status']).";".$row['ship_wares']."</t>\n"; $n++;
    }
    }


    function remote_ship($pID)
    {
    global $n;
    $sql="SELECT * FROM ship WHERE ship_remote = '$pID' ;";
    $result=mysql_query($sql) OR die(mysql_error());
    while($row=mysql_fetch_assoc($result))
    {
    echo "<t id=\"$n\">rs;".$row['ship_ID'].";".$row['ship_homebase_NR'].";".
    (($row['ship_command']=="COMMAND_DOCKAT") ? $row['ship_command_target'] : $row['ship_command_target3'])."</t>\n"; $n++;
    }
    }


    function short_station($pID, $last)
    {
    global $n;
    $sql="SELECT * FROM station, player WHERE station_player_NR = player_ID AND station_last_s > '$last' ;";
    $result=mysql_query($sql) OR die(mysql_error());
    while($row=mysql_fetch_assoc($result))
    {
    echo "<t id=\"$n\">st;".$row['station_ID'].";".$row['station_hull'].";".$row['station_shield'].";".
    $row['station_money'].";".$row['station_wares']."".(($row['station_ext_wares']!="")?(";".$row['station_ext_wares']):"")."</t>\n"; $n++;
    }
    }



    function all_station($pID)
    {
    global $n;
    $sql="SELECT * FROM station, player WHERE station_player_NR = player_ID ;";
    $result=mysql_query($sql) OR die(mysql_error());
    while($row=mysql_fetch_assoc($result))
    {
    if($pID==$row['station_player_NR'])
    $type="pt";
    else
    $type="t";
    echo "<t id=\"$n\">$type;".$row['station_ID'].";".$row['station_maintype'].";".$row['station_subtype'].";".
    $row['station_sector_x'].";".$row['station_sector_y'].";".$row['station_x'].";".$row['station_y'].";".
    $row['station_z'].";".$row['station_rx'].";".$row['station_ry'].";".$row['station_rz'].";".
    $row['player_name'].";".$row['station_name'].";".$row['player_race'].";".$row['station_hull'].";".
    $row['station_shield'].";".$row['station_money'].";".$row['station_wares']."".(($row['station_ext_wares']!="")?(";".$row['station_ext_wares']):"")."</t>\n"; $n++;
    }
    }


    function commands($pID, $last)
    {
    global $n;
    $sql="SELECT * FROM command WHERE ( command_player_NR='$pID' OR command_player_NR='0' ) AND command_time>='$last'-15*60 ;";
    $result=mysql_query($sql) OR die(mysql_error());
    while($row=mysql_fetch_assoc($result))
    {
    echo "<t id=\"$n\">c;".$row['command']."</t>\n"; $n++;
    }

    }


    // trade functions
    function buy_ship($station, $pID, $st, $amount, $x, $y)
    {
    global $time;
    $sql="SELECT * FROM player WHERE player_ID=$pID ;";
    $result=mysql_query($sql) OR die(mysql_error());
    if(mysql_num_rows($result)!=1)
    return "didn't find player";
    $row1=mysql_fetch_assoc($result);

    $sql="SELECT * FROM station WHERE station_ID = '$station' AND station_maintype <= 5 AND station_sector_x = '$x' AND station_sector_y = '$y' ;";
    $result=mysql_query($sql) OR die(mysql_error());
    if(mysql_num_rows($result)!=1)
    return "didn't find station";
    $row2=mysql_fetch_assoc($result);

    $wares=explode(":",$row2['station_ext_wares']);
    $check=false;
    $ware="";
    $n=0;
    foreach($wares as $w)
    {
    $w=explode(",", $w);
    if(isset($w[3]))
    {
    if($w[0]==7 AND $w[1]==$st AND !$check)
    {
    $sql="SELECT * FROM ship_type, ware_type WHERE ware_maintype = ship_type_maintype AND ware_subtype = ship_type_subtype AND ship_type_maintype = 7 AND ship_type_subtype = $st ;";
    $result=mysql_query($sql) OR die(mysql_error());
    if(mysql_num_rows($result)!=1)
    return "didn't find ship_type/ware_type";
    $row3=mysql_fetch_assoc($result);

    $equipment="16,55,1,0:9,2,6,0";

    $amount=min(floor($row1['player_money']/$w[3]),$amount, $w[2]);
    if($amount<1)
    return "not enough money/ware";
    $price=$w[3] * $amount;
    $money=$row1['player_money'] - $price;
    $name=$row3['ship_type_name'];
    for($i=0;$i<$amount;$i++)
    {
    $sql="INSERT INTO ship (ship_oID, ship_player_NR, ship_subtype, ship_sector_x, ship_sector_y, ship_name, ship_hull, ship_shield, ship_status, ship_wares)
    VALUES ('".substr((md5(rand().time())), 6)."', $pID, $st, $x, $y, '$name', 999999999, 999999999, 'do $station', 'w:$equipment') ;";
    mysql_query($sql) OR die(mysql_error());
    }
    $w[2]=$w[2]-$amount;
    $check=true;
    }
    if($n==0) $ware.= $w[0].",".$w[1].",".$w[2].",".$w[3];
    else $ware.=":". $w[0].",".$w[1].",".$w[2].",".$w[3];
    $n++;
    }
    }
    if(!$check)
    return "ship/ware not found";
    $sql="UPDATE station SET station_money = station_money + $price , station_ext_wares = '$ware' WHERE station_ID = '$station' ;";
    mysql_query($sql) OR die(mysql_error());
    $sql="UPDATE player SET player_money = $money WHERE player_ID = $pID ;";
    mysql_query($sql) OR die(mysql_error());
    return "OK";
    }


    function buy_ware($oID, $pID, $station, $mt, $st, $amount)
    {
    global $time;
    //find ship and homebase
    $sql1="SELECT * FROM ship, station WHERE ship_homebase_NR=station_ID AND ship_oID='".mysql_real_escape_string($oID)."' AND ship_player_NR='$pID' AND station_player_NR='$pID' ;";
    $result1=mysql_query($sql1) OR die(mysql_error());
    if(mysql_num_rows($result1)!=1)
    {
    //if not, find ship and player
    $sql1="SELECT * FROM ship, player WHERE ship_oID='".mysql_real_escape_string($oID)."' AND ship_player_NR='$pID' AND player_ID = ship_player_NR ;";
    $result1=mysql_query($sql1) OR die(mysql_error());
    if(mysql_num_rows($result1)!=1)
    return "did not find ship, player or station";
    $row1=mysql_fetch_assoc($result1);
    $money=$row1['player_money'];
    $money_from="player";
    }
    else
    {
    $row1=mysql_fetch_assoc($result1);
    $money=$row1['station_money'];
    $money_from="homebase";
    }
    //find trading partner (station) and check ware
    $sql2="SELECT * FROM station WHERE station_ID = '$station' ;";
    $result2=mysql_query($sql2) OR die(mysql_error());
    if(mysql_num_rows($result2)!=1)
    return "did not find trading partner station";
    $row2=mysql_fetch_assoc($result2);

    $wares=substr($row2['station_wares'], 2);
    $ware=explode(":", $wares);
    $wares="w";
    $check=false;
    foreach ($ware AS $w)
    {
    $w=explode(",", $w);
    if($mt==$w[0] AND $st==$w[1])
    {
    $price=$w[3];
    $amount=min($w[2], $amount, floor($money/$price));
    $price=$price*$amount;

    //check if player / station money >= price
    if($money<$price)
    return "not enought money";
    if( ( $w[0]==16 AND ( ( $w[1]>=11 AND $w[1]<=25 ) OR ( $w[1]>=32 AND $w[1]<=41 ) OR $w[1]==71 OR ( $w[1]>=81 AND $w[1]<=84 ) OR ( $w[1]>=102 AND $w[1]<=105 ) OR $w[1]==108 ) ) )
    $w[2]=8192;
    else
    $w[2]=$w[2]-$amount;
    $check=true;
    }
    $wares.=":".$w[0].",".$w[1].",".$w[2].",".$w[3];
    }

    $sql="";
    if($money_from=="homebase")
    $sql="UPDATE station SET station_money = station_money - $price , station_last_s='$time', station_last_b='$time' WHERE station_ID = '".$row1['station_ID']."' ;";
    elseif($money_from=="player")
    $sql="UPDATE player SET player_money = player_money - $price WHERE player_ID = '$pID' ;";
    mysql_query($sql) OR die(mysql_error());

    $sql="UPDATE station SET station_money = station_money + $price , station_wares='$wares' , station_last_s='$time', station_last_b='$time' WHERE station_ID= '".$row2["station_ID"]."' ;";
    mysql_query($sql) OR die(mysql_error());

    // update ship...
    $wares=substr($row1['ship_wares'], 2);
    $ware=explode(":", $wares);
    $wares="w";
    $check=false;
    foreach ($ware AS $w)
    {
    if(isset($w[0],$w[1],$w[2],$w[3]))
    {
    $w=explode(",", $w);
    if($mt==$w[0] AND $st==$w[1] and !$check)
    {
    $w[2]=$w[2]+$amount;
    $check=true;
    }
    $wares.=":".$w[0].",".$w[1].",".$w[2].",".$w[3];
    }
    }
    if(!$check)
    $wares.=":$mt,$st,$amount,0";
    $sql="UPDATE ship SET ship_wares='$wares' , ship_last_s='$time', ship_last_b='$time' WHERE ship_ID = '".$row1['ship_ID']."' ;";
    mysql_query($sql) OR die(mysql_error());
    return "OK";
    }


    function sell_ware($oID, $pID, $station, $mt, $st, $amount)
    {
    global $time;
    $sql1="SELECT * FROM ship, station WHERE ship_homebase_NR=station_ID AND ship_oID='$oID' AND ship_player_NR='$pID' AND station_player_NR='$pID' ;";
    $result1=mysql_query($sql1) OR die(mysql_error());
    if(mysql_num_rows($result1)!=1)
    {
    //if not, find ship and player
    $sql1="SELECT * FROM ship, player WHERE ship_oID='$oID' AND ship_player_NR='$pID' AND player_ID = ship_player_NR ;";
    $result1=mysql_query($sql1) OR die(mysql_error());
    if(mysql_num_rows($result1)!=1)
    return "did not find ship, player or station";
    $row1=mysql_fetch_assoc($result1);
    $money=$row1['player_money'];
    $money_from="player";
    }
    else
    {
    $row1=mysql_fetch_assoc($result1);
    $money=$row1['station_money'];
    $money_from="homebase";
    }
    //check ship
    $wares=substr($row1['ship_wares'], 2);
    $ware=explode(":", $wares);
    $wares="w";
    $check=false;
    foreach ($ware AS $w)
    {
    $w=explode(",", $w);
    if($mt==$w[0] AND $st==$w[1])
    {
    $amount=min($w[2],$amount);
    $check=true;
    }
    }
    if(!$check)
    return "ware not existing";

    //find trading partner (station) and check ware
    $sql2="SELECT * FROM station WHERE station_ID = '$station' ;";
    $result2=mysql_query($sql2) OR die(mysql_error());
    if(mysql_num_rows($result2)!=1)
    return "did not find trading partner station";
    $row2=mysql_fetch_assoc($result2);

    $wares=substr($row2['station_wares'], 2);
    $ware=explode(":", $wares);
    $wares="w";
    $check=false;
    foreach ($ware AS $w)
    {
    $w=explode(",", $w);
    if($mt==$w[0] AND $st==$w[1])
    {
    //maxamount...
    $price=$w[3];
    $amount=min($amount, floor($row2['station_money']/$price));
    $price=$price*$amount;

    //check if player / station money >= price
    if($row2['station_money']<$price)
    return "trading partner has not enought money";
    $check=true;
    $w[2]=$w[2]+$amount;
    }
    $wares.=":".$w[0].",".$w[1].",".$w[2].",".$w[3];

    }
    if(!$check)
    $wares2.=":$mt,$st,$amount,0"; //$w[3] !!!!
    $sql="";
    if($money_from=="homebase")
    $sql="UPDATE station SET station_money = station_money + $price , station_last_s='$time', station_last_b='$time' WHERE station_ID = '".$row1['station_ID']."' ;";
    elseif($money_from=="player")
    $sql="UPDATE player SET player_money = player_money + $price WHERE player_ID = '$pID' ;";
    mysql_query($sql) OR die(mysql_error());

    $sql="UPDATE station SET station_money = station_money - $price , station_wares='$wares' , station_last_s='$time', station_last_b='$time' WHERE station_ID= '".$row2["station_ID"]."' ;";
    mysql_query($sql) OR die(mysql_error());

    // update ship...
    $wares=substr($row1['ship_wares'], 2);
    $ware=explode(":", $wares);
    $wares="w";
    foreach ($ware AS $w)
    {
    $w=explode(",", $w);
    if($mt==$w[0] AND $st==$w[1])
    {
    $w[2]=$w[2]-$amount;
    }
    if($w[2]>0)
    $wares.=":".$w[0].",".$w[1].",".$w[2].",".$w[3];

    }
    $sql="UPDATE ship SET ship_wares='$wares' , ship_last_s='$time', ship_last_b='$time' WHERE ship_ID = '".$row1['ship_ID']."' ;";
    mysql_query($sql) OR die(mysql_error());
    return "OK";
    }


    function unload_ware($oID, $pID, $station, $mt, $st, $amount)
    {
    global $time;
    $sql1="SELECT * FROM station WHERE station_ID = '$station' AND station_player_NR = '$pID' ;";
    $result1=mysql_query($sql1) OR die(mysql_error());
    if(mysql_num_rows($result1)!=1)
    return "did not find station";
    $row1=mysql_fetch_assoc($result1);

    $sql2="SELECT * FROM ship WHERE ship_oID = '$oID' AND ship_player_NR = '$pID' ;";
    $result2=mysql_query($sql2) OR die(mysql_error());
    if(mysql_num_rows($result2)!=1)
    return "did not find ship";
    $row2=mysql_fetch_assoc($result2);

    $wares=substr($row2['ship_wares'], 2);
    $ware=explode(":", $wares);
    $check=false;
    //find wares on ship
    foreach ($ware AS $w)
    {
    $w=explode(",", $w);
    if($mt==$w[0] AND $st==$w[1])
    {
    $amount=min($amount,$w[2]);
    $check=true;
    }
    }
    //if not, break;
    if(!$check)
    return "ware not existing on ship";

    $wares2=substr($row1['station_wares'], 2);
    $ware2=explode(":", $wares2);
    $wares2="w";
    $check=false;
    //find wares on station
    foreach ($ware2 AS $w)
    {
    $w=explode(",", $w);
    if($mt==$w[0] AND $st==$w[1])
    {
    $max_amount=99999; // TODO find out max_amount -> sql: search in station_types - current amount
    $amount=min($amount, $max_amount);

    $w[2]=$w[2]+$amount;

    $check=true;
    }
    $wares2.=":".$w[0].",".$w[1].",".$w[2].",".$w[3];
    }
    if(!$check)
    $wares2.=":$mt,$st,$amount,0"; //$w[3] !!!!
    $wares=substr($row2['ship_wares'], 2);
    $ware=explode(":", $wares);
    $wares="w";
    $check=false;
    //find wares on ship !and update
    foreach ($ware AS $w)
    {
    $w=explode(",", $w);
    if($mt==$w[0] AND $st==$w[1])
    {
    $w[2]=$w[2]-$amount;
    $check=true;
    }
    if($w[2]>0)
    $wares.=":".$w[0].",".$w[1].",".$w[2].",".$w[3];
    }

    $sql="UPDATE ship SET ship_wares='$wares' , ship_last_s='$time', ship_last_b='$time' WHERE ship_oID = '$oID' ;";
    mysql_query($sql) OR die($sql.mysql_error());
    $sql="UPDATE station SET station_wares='$wares2', station_last_s='$time', station_last_b='$time' WHERE station_ID = '$station' ;";
    mysql_query($sql) OR die($sql.mysql_error());
    return "OK";
    }


    function load_ware($oID, $pID, $station, $mt, $st, $amount)
    {
    global $time;
    $sql1="SELECT * FROM station WHERE station_ID = '$station' AND station_player_NR = '$pID' ;";
    $result1=mysql_query($sql1) OR die(mysql_error());
    ////////////////echo "$station OK!!!";
    if(mysql_num_rows($result1)!=1)
    return "did not find station";
    $row1=mysql_fetch_assoc($result1);

    $sql2="SELECT * FROM ship WHERE ship_oID = '$oID' AND ship_player_NR = '$pID' ;";
    $result2=mysql_query($sql2) OR die(mysql_error());
    if(mysql_num_rows($result2)!=1)
    return "did not find ship";
    $row2=mysql_fetch_assoc($result2);

    $wares=substr($row1['station_wares'], 2);
    $ware=explode(":", $wares);
    $check=false;
    //find wares on station
    foreach ($ware AS $w)
    {
    $w=explode(",", $w);
    if($mt==$w[0] AND $st==$w[1])
    {
    $amount=min($amount,$w[2]);
    $check=true;
    }
    }
    //if not, break;
    if(!$check)
    return "ware not existing on station";

    $wares2=substr($row2['ship_wares'], 2);
    $ware2=explode(":", $wares2);
    $wares2="w";
    $check=false;
    //find wares on ship and update
    foreach ($ware2 AS $w)
    {
    $w=explode(",", $w);
    if(isset($w[0],$w[1],$w[2],$w[3]))
    {
    if($mt==$w[0] AND $st==$w[1])
    {
    $w[2]=$w[2]+$amount;
    $check=true;
    }
    $wares2.=":".$w[0].",".$w[1].",".$w[2].",".$w[3];
    }
    }
    if(!$check)
    $wares2.=":$mt,$st,$amount,0"; //$w[3] !!!!

    $wares=substr($row1['station_wares'], 2);
    $ware=explode(":", $wares);
    $wares="w";
    $check=false;
    //find wares on station and update
    foreach ($ware AS $w)
    {
    $w=explode(",", $w);
    if($mt==$w[0] AND $st==$w[1])
    {
    $w[2]=$w[2]-$amount;
    $check=true;
    }
    $wares.=":".$w[0].",".$w[1].",".$w[2].",".$w[3];
    }


    $sql="UPDATE ship SET ship_wares='$wares2' , ship_last_s='$time', ship_last_b='$time' WHERE ship_oID = '$oID' ;";
    mysql_query($sql) OR die($sql.mysql_error());
    $sql="UPDATE station SET station_wares='$wares', station_last_s='$time', station_last_b='$time' WHERE station_ID = '$station' ;";
    mysql_query($sql) OR die($sql.mysql_error());
    return "OK";
    }
    ?>
    [/expander] config.php

    haben meine lehrer auch immer gemeint x]


    nunja mein problem liegt einfach dadrin ein server dafür wieder auf zubauen und es so ein zustellen das der client es von server bezieht ^^


    und ich dachte weil wir ja hier viele modder haben und auch paar eingeflischte x fans das jemand helfen könnte