Check if player in game in php file
#3

Quote:
Originally Posted by MerryDeer
Посмотреть сообщение
Hi,

How in php file, check if speficic player is joined to my server?
i can give you an example,
note: i did this in 2011 (dont judge! pls ppls)
PHP код:
<?php
$sIP 
"localhost";//server IP
$sPORT 7777;//server Port
require "SampQueryAPIxx.php";
$query = new SampQueryAPI($sIP$sPORT);
$sInfo $query->getInfo();
if(!
$query->isOnline()) { echo "Server Offline"; exit; }
echo 
'<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />';
$aPlayers $query->getDetailedPlayers();
if(!
is_array($aPlayers) || count($aPlayers) == 0)
{
echo 
"<br /><i>well, either something went wrong or there are no players</i>";
}
else
{
?>
<style type="text/css">
thead
{
    background-image: url("head.jpg");
}
table
{
    margin:35;
    border:1px solid #CCC;
    border-collapse:collapse;
}
tr.bottom
{
    background-image: url("head.jpg");
}
font
{
    opacity: 0.0;
    font-family:Roman;
    color:#cccccc;
}
font.exception
{
    opacity: 100.0;
}
p
{
    font-family:Arial;
}
td
{
    font-family:Verdana;
}
.highlight
{
background-image: url("row.png");
}
.normal
{
background-image: none;
}
.unselectable
{
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: -moz-none;
  -ms-user-select: none;
  user-select: none;
}
</style>
<center>
<p><?= $sInfo['hostname']; ?></p>
<table width="300" name="board" class="unselectable">
<thead class="head">
<td><b>ID</b></td>
<td align=middle><b>Name</b></td>
<td><b>Score</b></td>
<td><b>Ping</b></td>
</thead>
<?php
foreach($aPlayers as $sValue)
{
?>
<tr OnMouseOver="this.className='highlight'" OnMouseOut="this.className='normal'">
<td><?= $sValue['playerid'?></td>
<td><?= htmlentities($sValue['nickname']) ?></td>
<td><?= $sValue['score'?></td>
<td align=right><?= $sValue['ping'?></td>
</tr>
<?php
}
echo 
'<tr class="bottom"><td><font>.</font></td><td align=right><font class="exception">Autor: East_Crips</font></td><td><font>.</font></td><td><font>.</font></td></tr>';
echo 
'</table></center>';
}
?>
<!--
East_Crips 2011
!-->
looks like this: http://pasteboard.co/cwr4IPFQ6.png
(i jsut put in some random server to demonstrate)
on top is server name and below a table with player ifos

//EDIT: oh and most importantly, get the query API from https://sampforum.blast.hk/showthread.php?tid=104299
Reply


Messages In This Thread
Check if player in game in php file - by MerryDeer - 21.12.2016, 14:26
Re: Check if player in game in php file - by BiosMarcel - 21.12.2016, 14:54
Re: Check if player in game in php file - by CutX - 21.12.2016, 14:54
Re: Check if player in game in php file - by oMa37 - 21.12.2016, 16:20
Re: Check if player in game in php file - by CutX - 21.12.2016, 17:03
Re: Check if player in game in php file - by MerryDeer - 21.12.2016, 18:14
Re: Check if player in game in php file - by CutX - 21.12.2016, 19:11
Re: Check if player in game in php file - by MerryDeer - 22.12.2016, 07:36
Re: Check if player in game in php file - by Luis- - 22.12.2016, 08:09

Forum Jump:


Users browsing this thread: 1 Guest(s)