CrazyDriver

CrazyDriver

Joined
Nov 04, 2014

Threads

CrazyDriver   -  Aug 07, 2017

I need a little help please with a 'script'

on $*:TEXT:/^\s*\Wplayers?/Si:#: { 
  set -e %Players $chan

  sockclose hits
  sockopen hits cortanairc.epizy.com 80

  <?php
  require("SampQuery.class.php");
  $query = new SampQuery("167.114.42.236", 7777);
  if ($query->connect()) {
    $aInformation = $query->getInfo();
    $aServerRules = $query->getRules();
    ?>
    [ Server 1 (<?= htmlentities($aServerRules['mapname']) ?>, <?= $aServerRules['worldtime'] ?>) Players: <?= $aInformation['players'] ?>/<?= $aInformation['maxplayers'] ?> ]
    <?php
    $query->close(); // Close the connection
    } else {
    echo "Server 1 did not respond!";
  }
  ?>
}

I am trying to get this to work with !players to show information from a SA-MP server as I have both the files linked to my server (website) but I don't think I have done this right,s o any help will be appreciated!

Update

on $*:TEXT:/^\s*\Wplayers?/Si:#: { 
  set -e %Players $chan

  sockclose hits
  sockopen hits http://cortanairc.epizy.com/ 80
}
on *:sockopen:hits: {
  sockwrite -n $sockname GET players.php HTTP/1.1
  sockwrite -n $sockname Host: http://cortanairc.epizy.com/
  sockwrite -n $sockname $crlf
}
on *:sockread:hits: {
  msg %Players 
}

I think this is something but i don't know if it's right? but keeps coming up with 'An Error Has Occured' so must be getting somewhere.

Thanks very much,

Jay.

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.