PHP - Kick user with Rcon API -
undeR. - 28.05.2013
How can i kick some player from this code:
https://sampforum.blast.hk/showthread.php?tid=104299
I want under kick to write "Kick" and when someone click to kick him..
Re: PHP - Kick user with Rcon API -
Vince - 28.05.2013
Use the sockets plugin. Best method, in my opinion.
Re: PHP - Kick user with Rcon API -
undeR. - 28.05.2013
Yeah, but i dont know how, lol.
Re: PHP - Kick user with Rcon API -
Kirollos - 29.05.2013
with westie's RCON API, write like the following:
PHP код:
<?php
$rcon = new SampRconAPI('server_ip', server_port, 'server_rcon_pass');
$rcon->Call('kickdatguy ' . $playerid_here);
?>
then somewhere in your gm
pawn Код:
public OnRconCommand(cmd[])
{
if(strfind(cmd, "kickdatguy") != -1)
{
//your msgs & Kick() goes here
return 1;
}
return 0;
}
EDIT: you can still use:
PHP код:
<?php
$rcon = new SampRconAPI('server_ip', server_port, 'server_rcon_pass');
$rcon->playerKick($playerid_here);
?>
Re: PHP - Kick user with Rcon API -
undeR. - 29.05.2013
And how to kick a player? I must have a hyper link, dont I? If u can write example..
Код:
require "SampQueryAPI.php";
require "SampRconAPI.php";
$query = new SampQueryAPI('193.192.59.30', '7784');
$rcon = new SampRconAPI('193.192.59.30', 7784, '123');
if($query->isOnline())
{
$aInformation = $query->getInfo();
$aServerRules = $query->getRules();
?><center>
<b>General Information</b>
<table width="400">
<tr>
<td>Hostname</td>
<td><?= htmlentities($aInformation['hostname']) ?></td>
</tr>
<tr>
<td>Gamemode</td>
<td><?= htmlentities($aInformation['gamemode']) ?></td>
</tr>
<tr>
<td>Igraca</td>
<td><?= $aInformation['players'] ?> / <?= $aInformation['maxplayers'] ?></td>
</tr>
<tr>
<td>Map</td>
<td><?= htmlentities($aInformation['mapname']) ?></td>
</tr>
<tr>
<td>Vreme</td>
<td><?= $aServerRules['weather'] ?></td>
</tr>
<tr>
<td>World Time</td>
<td><?= $aServerRules['worldtime'] ?></td>
</tr>
<tr>
<td>Verzija</td>
<td><?= $aServerRules['version'] ?></td>
</tr>
<tr>
<td>Sifra</td>
<td><?= $aInformation['password'] ? 'Da' : 'Ne' ?></td>
</tr>
</table>
<br />
<b>Online Igraci</b>
<?php
$aPlayers = $query->getDetailedPlayers();
if(!is_array($aPlayers) || count($aPlayers) == 0)
{
echo '<br /><i>None</i>';
}
else
{
?>
<table width="400">
<tr>
<td><b>Player ID</b></td>
<td><b>Ime_Prezime</b></td>
<td><b>Level</b></td>
<td><b>Ping</b></td>
<td><b>Kick</b></td>
</tr>
<?php
foreach($aPlayers as $sValue)
{
?>
<tr>
<td><?= $sValue['playerid'] ?></td>
<td><?= htmlentities($sValue['nickname']) ?></td>
<td><?= $sValue['score'] ?></td>
<td><?= $sValue['ping'] ?></td>
<td><?= $rcon->playerKick($playerid_here); ?></td>
</tr></center>
<?php
}
echo '</table>';
}
}
}
Re: PHP - Kick user with Rcon API -
Kirollos - 29.05.2013
make a button or hyperlink that uses onclick event in it which uses "$rcon->playerKick($playerid_here)"
Re: PHP - Kick user with Rcon API -
undeR. - 29.05.2013
What to write on $playerid_here?
Re: PHP - Kick user with Rcon API -
IstuntmanI - 29.05.2013
The in-game ID of the clicked player.
Re: PHP - Kick user with Rcon API -
undeR. - 29.05.2013
Код:
<td><a href="<?$rcon->playerKick['playerid']?>">Kick</a></td>
This is it ^^
Re: PHP - Kick user with Rcon API -
Michalec - 29.05.2013
Код:
<td><a href="#" onclick="<? $rcon->playerKick($sValue['playerid']); ?>">Click to kick</a></td>
I think it will be ok.
@up you can't redirect to function :P