Check if player in game in php file
#5

Quote:
Originally Posted by oMa37
Посмотреть сообщение
He asked about a SPECIFIC player if online, not ALL the players.
whoa whoa c'mon don't be so hostile
i was merely giving an example, i mean it's easy enough to pick and choose what you need...

i put this together just now
PHP код:
<?php
echo '<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />';
$sIP "127.0.0.1";//server IP
$sPORT 7777;//server Port
require "SampQueryAPIxx.php";
$query = new SampQueryAPI($sIP$sPORT);
if(!
$query->isOnline()) { echo "Server Offline"; exit; }
$aPlayers $query->getDetailedPlayers();
$idx array_search($_GET['target'],array_column($aPlayers,'nickname'));
if(
$idx !== false)
    echo 
$aPlayers[$idx]['nickname']." is online.";
else 
    echo 
$_GET['target']." is offline!";
?>
<!--
East_Crips 2016
!-->
simply provide the name per GET variable 'target' and thats it.
calling it like: localhost/ison.php?target=East_Crips
you'll receive a simple string saying either:

East_crips is online.
or
East_Crips is offline!

@op could even call this from a pawn script using HTTP()
but then again, that wouldn't make sense i mean if he's already on, he could check ingame anyways
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)