Vraag & Antwoord

Webprogrammeren & scripting

zelfde script 2 keer op een pagina

3 antwoorden
  • Ik heb een script voor de life status van een server. Ik heb nu echter een 2e server. Is het mogelijk om het script 2x te gebruiken??? Of gaan dan de variablelen door de war??? http://dccclan.50free.org/server.html [code:1:f83e56996f] <? $sof2=new SoldierOfFortune2; $serveradr="82.161.99.115"; //Enter your server IP here <------- Change this $serverport=20100; //Enter your server port here <------- $mapsdir='./maps/'; // Change this to represent your map directory <------- Usually not needed // Don't change anything below unless you know what you're doing, or you still have the source files :P $status=$sof2->getServerStatus($serveradr,$serverport,10000); if ($status) { ?> <CENTER> <FONT color=white><?=removefunchars($sof2->m_servervars["sv_hostname"])?></FONT><BR> <FONT color=white><?echo $serveradr . ":" . $serverport; ?></FONT><BR> <FONT color=white><?=$sof2->m_servervars["sv_currentclients"]?>/<?=$sof2->m_servervars["sv_maxclients"]?></FONT><BR> <FONT color=white>Map name : <?=$sof2->m_servervars["mapname"]?><BR><BR> <? if (file_exists($mapsdir . $sof2->m_servervars["mapname"] . '.jpg')) { echo "<IMG SRC=\"maps/{$sof2->m_servervars["mapname"]}.jpg\">";} else { echo "<IMG SRC=\"maps/rnd.jpg\">"; };?> </CENTER> <? if (strtolower($sof2->m_servervars["g_gametype"]) != dm) { ?> <div align="center"> <table width="629" border="0" align="center" bgcolor="#000000"> <tr> <td width="623" align="center"><p><font color="#FFFFFF" size="5"><strong> <? if ($sof2->blue < $sof2->red) { echo "Red leads Blue by "; echo $sof2->red - $sof2->blue; }; if ($sof2->blue > $sof2->red) { echo "Blue leads Red by "; echo $sof2->blue - $sof2->red; }; if ($sof2->blue == $sof2->red) { echo "Game tied at {$sof2->blue}"; }; echo "<br><font size=\"2\">Scorelimit : {$sof2->m_servervars["scorelimit"]}"; echo "<br><font size=\"2\">Timelimit : {$sof2->m_servervars["timelimit"]}"; echo "<br><font size=\"2\">Friendly fire : "; if ($sof2->m_servervars["g_friendlyfire"] == 1) { echo "ON"; } else { echo "OFF"; } echo "<br><font size=\"2\">Game version : {$sof2->m_servervars["gameversion"]}"; echo "<br><font size=\"2\">Download enabled : "; if ($sof2->m_servervars["sv_allowDownload"] == 1) { echo "Yes"; } else { echo "No"; } ?> </strong></font></p> <p> </p> </td> </tr> <tr> <td align="left" valign="middle"> <blockquote> <? switch (strtolower($sof2->m_servervars["g_gametype"])) { case inf : echo "<font color=\"#CCCCCC\">Infiltration</font>"; break; case ctf : echo "<font color=\"#CCCCCC\">Capture the Flag</font>"; break; case dem : echo "<font color=\"#CCCCCC\">Demolition</font>"; break; case elim : echo "<font color=\"#CCCCCC\">Elimination</font>"; break; case tdm : echo "<font color=\"#CCCCCC\">Team Deadmatch</font>"; break; } ?> </blockquote> <table width="623" height="0%" border="0" align="center" cellspacing="10"> <tr bgcolor="#666666"> <td width="294" height="100%"> <div align="center"> <table width="100%" border="0"> <tr> <td width="84%" background="blue.jpg"><font color="#FFFFFF"><strong>BLUE <? echo "TEAM</strong></font><br><font color=\"#FFFFFF\" size=\"1\">players {$sof2->totalblue}</font></td>"; ?> <td width="16%" valign="top" background="blue.jpg"> <div align="right"><strong><font color="#FFFFFF"><?=$sof2->blue?></font></strong></div></td> </tr> <tr> <? $i=1; while($sof2->bluearray[$i][3] <> "") { echo "<td bgcolor=\"#000000\"><font color=\"#FFFFFF\"><strong>{$sof2->bluearray[$i][3]}</strong></font><br> <font color=\"#CCCCCC\" size=\"1\">ping "; echo ": {$sof2->bluearray[$i][2]}</font><br> </td>"; echo " <td valign=\"top\" bgcolor=\"#000000\"> "; echo "<div align=\"right\"><font color=\"#FFFFFF\"><strong>{$sof2->bluearray[$i][1]}</strong></font></div></td>"; echo " </tr>"; $i++; } while($sof2->totalred > $sof2->totalblue) { echo "<tr><td colspan=\"2\" bgcolor=\"#000000\"> <BR><font color=\"#CCCCCC\" size=\"1\"> </font></td></tr>"; $sof2->totalblue++; } if ($sof2->totalred > $sof2->totalblue) { echo "<tr><td colspan=\"2\" bgcolor=\"#000000\"> <BR><font color=\"#CCCCCC\" size=\"1\"> </font></td></tr>"; } ?> </table></div></td> <td width="295" height="100%"> <div align="center"> <table width="100%" border="0"> <tr> <td width="84%" background="red.jpg"><font color="#FFFFFF"><strong>RED <? echo "TEAM</strong></font><br> <font color=\"#FFFFFF\" size=\"1\">players {$sof2->totalred}</font></td>" ?> <td width="16%" valign="top" background="red.jpg"> <div align="right"><strong><font color="#FFFFFF"><?=$sof2->red?></font></strong></div></td> </tr> <tr> <? $j=1; while($sof2->redarray[$j][3] <> "") { echo " <td bgcolor=\"#000000\"><font color=\"#FFFFFF\"><strong>{$sof2->redarray[$j][3]}</strong></font><br>"; echo " <font color=\"#CCCCCC\" size=\"1\">ping : {$sof2->redarray[$j][2]}</font><br> </td>"; echo " <td valign=\"top\" bgcolor=\"#000000\"> "; echo "<div align=\"right\"><font color=\"#FFFFFF\"><strong>{$sof2->redarray[$j][1]}</strong></font></div></td>"; echo "</tr>"; $j++; } while ($sof2->totalred < $sof2->totalblue) { echo "<tr><td colspan=\"2\" bgcolor=\"#000000\"> <BR><font color=\"#CCCCCC\" size=\"1\"> </font></td></tr>"; $sof2->totalred++; } ?> </table></div></td> </tr> </table></td> </tr> <tr> <td><font color="#CCCCCC" size="2">SPECTATORS : <? $i=1; while($sof2->specarray[$i][2] <> "") { echo $sof2->specarray[$i][2] . " [" . $sof2->specarray[$i][1] . "], "; $i++; } ?> </font></td> </tr> </table> </div> <? } else { echo "<center>"; echo "<br><font size=\"2\">Scorelimit : {$sof2->m_servervars["scorelimit"]}"; echo "<br><font size=\"2\">Timelimit : {$sof2->m_servervars["timelimit"]}"; echo "<br><font size=\"2\">Game version : {$sof2->m_servervars["gameversion"]}"; echo "<br><font size=\"2\">Download enabled : "; if ($sof2->m_servervars["sv_allowDownload"] == 1) { echo "Yes"; } else { echo "No"; } echo "<table>"; echo "<tr>"; echo "<td bgcolor=\"#778051\">"; echo "<table>"; echo "<tr>"; echo "<td width=\"400\" colspan=\"2\" background=\"green.jpg\"><font color=\"#FFFFFF\"><B>PLAYERS</B><BR>"; echo "<font color=\"#FFFFFF\" size=\"1\">players {$sof2->totaldm}</font></font></td>"; echo "</tr>"; $i=1; while($sof2->dmarray[$i][3] <> "") { echo "<tr>"; echo "<td bgcolor=\"#000000\"><font color=\"#FFFFFF\"><strong>{$sof2->dmarray[$i][3]}</strong></font><br> <font color=\"#CCCCCC\" size=\"1\">ping "; echo ": {$sof2->dmarray[$i][2]}</font><br> </td>"; echo " <td valign=\"top\" bgcolor=\"#000000\"> "; echo "<div align=\"right\"><font color=\"#FFFFFF\"><strong>{$sof2->dmarray[$i][1]}</strong></font></div></td>"; echo " </tr>"; $i++; } echo "</font></td></tr></table></table>"; echo "<table>"; echo "<tr><td width=\"500\" bgcolor=\"#000000\"><font color=\"#CCCCCC\" size=\"2\">SPECTATORS : "; $i=1; while($sof2->specarray[$i][2] <> "") { echo $sof2->specarray[$i][2] . " [" . $sof2->specarray[$i][1] . "], "; $i++; } echo "</table>"; echo "</center>"; } ?> <DIV ALIGN="CENTER"></DIV> <? } else { ?> <DIV ALIGN="CENTER"><FONT color=white>Error communicating with server<BR> - SOF2 Server might be changing map (Wait for the refresh if you have javascript enabled).<BR> - SOF2 Server might be lagged and this request timed out. <BR> <font size="5">If you don't get the status after 20 seconds, the SOF2 server is offline,<Br> come back later to check if the server is online. </FONT></DIV> <BR> <? } ?> <BR>[/code:1:f83e56996f]
  • Dat kan je toch _echt_ wel zelf gewoon proberen...
  • [quote:23251a7c47="Bill Gates"]Dat kan je toch _echt_ wel zelf gewoon proberen...[/quote:23251a7c47] was een beetje retorische vraag, je kan maar 1 keer een variabele instelle, lijkt me sterk dat als je verderop de variabele weer veranderd dat iehet dan doet. Hmm misschien toch maar probere, maar d8 misschien had iemand ander id (frames ofzo).

Beantwoord deze vraag

Weet jij het antwoord op deze vraag? Registreer of meld je aan met je account

Dit is een gearchiveerde pagina. Antwoorden is niet meer mogelijk.