Mobilni platby automatický script, jak na to ?

Technická podpora k herním serverům Minecraft a Tekkit
Message
Autor
dadam
Příspěvky: 148
Registrován: 14 pro 2011, 22:14
Reputation: 0

Re: Mobilni platby automatický script, jak na to ?

#11 Příspěvekod dadam » 01 říj 2012, 21:53

Všechno vypadalo dobře, ale někde mám chybu, když si teď hráč na zkoušku koupil money tak mu je to nepřičetlo dávám tu server properties, rcon, a php script podotýkám, že rcon a ten druhej script mám na FTP u webu a změnu na mobilnich platbach sem taky udelal.

server properties

Spoiler: zobrazit

Kód: Vybrat vše

#Minecraft server properties
#Mon Oct 01 06:33:37 CEST 2012
allow-nether=true
level-name=world
enable-query=false
allow-flight=false
rcon.password=xxxxxxxxxx
server-port=27666
level-type=DEFAULT
enable-rcon=true
hellworld=false
level-seed=
port=27666
server-ip=93.91.250.103
max-build-height=256
spawn-npcs=true
white-list=false
debug=false
spawn-animals=true
texture-pack=
snooper-enabled=true
hardcore=false
online-mode=false
pvp=true
difficulty=1
server-name=World of Craft Classic / www.woc-games.cz
gamemode=0
max-players=40
rcon.port=27676
spawn-monsters=true
generate-structures=true
view-distance=7
motd=World of Craft Classic / www.woc-games.cz


rcon - nic sem v nem neupravoval

Spoiler: zobrazit

Kód: Vybrat vše

<?php
/*
RCON remote console class, modified for minecraft compability by Tehbeard.

!!!YOU MUST CONFIGURE RCON ON YOUR MINECRAFT SERVER FOR THIS TO WORK
AT TIME OF WRITING ONLY 1.9pr4+ HAVE BUILTIN RCON SUPPORT!!!

Example Code:
============
include_once("rcon.class.php"); //Include this file
$r = new rcon("127.0.0.1",25575,"foobar"); //create rcon object for server on the rcon port with a specific password
if($r->Auth()){ //Connect and attempt to authenticate
{
  $r->rconCommand("say Saving in 10 seconds!"); //send a command
  sleep(10);
  $r->rconCommand("save-all"); //send a command
  $r->rconCommand("say Save complete!");//send a command
  echo $r->rconCommand("list");//send a command, echo returned value
}
============



Based upon the following work:
[<<<
   Basic CS:S Rcon class by Freman.  (V1.00)
   ----------------------------------------------
   Ok, it's a completely working class now with with multi-packet responses

   Contact: printf("%s%s%s%s%s%s%s%s%s%d%s%s%s","rc","on",chr(46),"cl","ass",chr(64),"pri","ya",chr(46),2,"y",chr(46),"net")

   Behaviour I've noticed:
      rcon is not returning the packet id.
>>>]
*/

define("SERVERDATA_EXECCOMMAND",2);
define("SERVERDATA_AUTH",3);

class RCon {
   var $Password;
   var $Host;
   var $Port = 27015;
   var $_Sock = null;
   var $_Id = 0;

   function RCon ($Host,$Port,$Password) {
      $this->Password = $Password;
      $this->Host = $Host;
      $this->Port = $Port;
      $this->_Sock = @fsockopen($this->Host,$this->Port, $errno, $errstr, 30) or
             die("Unable to open socket: $errstr ($errno)\n");
      $this->_Set_Timeout($this->_Sock,2,500);
       }

   function Auth () {
      $PackID = $this->_Write(SERVERDATA_AUTH,$this->Password);

      // Real response (id: -1 = failure)
      $ret = $this->_PacketRead();
      //var_dump($ret);
      if ($ret[0]['ID'] == -1) {
         return false;
      }
      return true;
   }

   function _Set_Timeout(&$res,$s,$m=0) {
      if (version_compare(phpversion(),'4.3.0','<')) {
         return socket_set_timeout($res,$s,$m);
      }
      return stream_set_timeout($res,$s,$m);
   }

   function _Write($cmd, $s1='', $s2='') {
      // Get and increment the packet id
      $id = ++$this->_Id;

      // Put our packet together
      $data = pack("VV",$id,$cmd).$s1.chr(0).$s2.chr(0);

      // Prefix the packet size
      $data = pack("V",strlen($data)).$data;

      // Send packet
      fwrite($this->_Sock,$data,strlen($data));

      // In case we want it later we'll return the packet id
      return $id;
   }

   function _PacketRead() {
      //Declare the return array
      $retarray = array();
      //Fetch the packet size
      while ($size = @fread($this->_Sock,4)) {
         $size = unpack('V1Size',$size);
         //Work around valve breaking the protocol
         if ($size["Size"] > 4096) {
            //pad with 8 nulls
            $packet = "\x00\x00\x00\x00\x00\x00\x00\x00".fread($this->_Sock,4096);
         } else {
            //Read the packet back
            $packet = fread($this->_Sock,$size["Size"]);
         }
         array_push($retarray,unpack("V1ID/V1Response/a*S1/a*S2",$packet));
      }
      return $retarray;
   }

   function Read() {
      $Packets = $this->_PacketRead();

      foreach($Packets as $pack) {
         if (isset($ret[$pack['ID']])) {
            $ret[$pack['ID']]['S1'] .= $pack['S1'];
            $ret[$pack['ID']]['S2'] .= $pack['S1'];
         } else {
            $ret[$pack['ID']] = array(
               'Response' => $pack['Response'],
               'S1' => $pack['S1'],
               'S2' =>   $pack['S2'],
            );
         }
      }
      return $ret;
   }

   function sendCommand($Command) {
      //$Command = '"'.trim(str_replace(' ','" "', $Command)).'"';
      //$Command="stop";
      $this->_Write(SERVERDATA_EXECCOMMAND,$Command,'');
   }

   function rconCommand($Command) {
      $this->sendcommand($Command);

      $ret = $this->Read();

      //ATM: Source servers don't return the request id, but if they fix this the code below should read as
      // return $ret[$this->_Id]['S1'];
      return $ret[$this->_Id]['S1'];
   }
}
?>


php script

Spoiler: zobrazit

Kód: Vybrat vše

<?php
$server = "93.91.250.103";
$port = "27666";
$heslo = "*******";

$credit = $_GET['price'];
$player = $_GET['text'];

if(empty($credit)) { die('Error'); }

$jenTak = explode(" ", $player);
$typ     = $jenTak[0];
$hrac    = $jenTak[1];
$switch   = "".$credit." ".$typ."";

$commands = array();
 
switch($switch) {

  //vip za 99kč //
  case "99.00 wvip": 
    $commands[] = "money give ".$player." 300";
    $commands[] = "pex user ".$player." group add wvip world 1296000";
    $commands[] = "pex user ".$player." group add wvip world_nether 1296000";
    $commands[] = "pex user ".$player." group add wvip world_ender 1296000";
    $commands[] = "broadcast Hrac ".$player." si aktivoval WVIP! Aktivuj si ho take na www.woc-games.cz";
  break;
 
  //vip za 79kč //
  case "79.00 vip": 
    $commands[] = "money give ".$player." 500";
    $commands[] = "pex user ".$player." group add vip world 2592000";
    $commands[] = "pex user ".$player." group add vip world_nether 2592000";
    $commands[] = "pex user ".$player." group add vip world_ender 2592000";
    $commands[] = "broadcast Hrac ".$player." si aktivoval VIP! Aktivuj si ho take na www.woc-games.cz";
  break;
 
  case "99.00 money": 
    $commands[] = "money give ".$player." 1000";
  break;
 
  case "79.00 money": 
    $commands[] = "money give ".$player." 750";
  break;
 
  case "50.00 money": 
    $commands[] = "money give ".$player." 400";
  break;
 
  case "30.00 money": 
    $commands[] = "money give ".$player." 250";
  break;
 
}



include_once("rcon.php");
$r = new rcon($server,$port,$heslo);
if($r->Auth())
{
   foreach($commands as $command) 
    $r->rconCommand($command);           
}

?>
<img src="http://www.minecraft-hosting.cz/obrazkovy-server-status/27666&type=3" alt="World of Craft" />

dadam
Příspěvky: 148
Registrován: 14 pro 2011, 22:14
Reputation: 0

Re: Mobilni platby automatický script, jak na to ?

#12 Příspěvekod dadam » 02 říj 2012, 21:41

Refresh, prosím :( Potřebuji to.
<img src="http://www.minecraft-hosting.cz/obrazkovy-server-status/27666&type=3" alt="World of Craft" />

dadam
Příspěvky: 148
Registrován: 14 pro 2011, 22:14
Reputation: 0

Re: Mobilni platby automatický script, jak na to ?

#13 Příspěvekod dadam » 03 říj 2012, 15:59

Refresh, prosím Potřebuji to.
<img src="http://www.minecraft-hosting.cz/obrazkovy-server-status/27666&type=3" alt="World of Craft" />

Uživatelský avatar
Sejsel
Příspěvky: 4131
Registrován: 19 čer 2011, 09:43
Reputation: 0
Bydliště: /home/sejsel/
Kontaktovat uživatele:

Re: Mobilni platby automatický script, jak na to ?

#14 Příspěvekod Sejsel » 03 říj 2012, 16:57

My to vše čteme, nespamuj, díky. Rozhodně si tak pomoc neurychlíš, vše čteme odspodu. Já bohužel nevím, co s tím, možná ti pomůže někdo jiný.
01101110011101010110001001110111

Uživatelský avatar
zdenda204
Příspěvky: 3617
Věk: 36
Registrován: 23 kvě 2012, 21:38
Reputation: 0

Re: Mobilni platby automatický script, jak na to ?

#15 Příspěvekod zdenda204 » 03 říj 2012, 17:20

Máš špatný porty.
V server.properties musíš mít RCON port stejný jako port serveru, ale s tím rozdílem že + 1000
Port serveru je třeba 27366, takže RCON port bude třeba 28366 (pokuď na tom portu už není něco jiného)
Nejde aby server jel na 27366 a RCON na 27679 (třeba)
Přijímám zakázky na skripty/pluginy v PHP/Javě za malý poplatky! A kup mi sušenku :) Obrázek Obrázek
⇨Projekt Market⇦

dadam
Příspěvky: 148
Registrován: 14 pro 2011, 22:14
Reputation: 0

Re: Mobilni platby automatický script, jak na to ?

#16 Příspěvekod dadam » 05 říj 2012, 22:39

ani s portama to nefunguje :(
<img src="http://www.minecraft-hosting.cz/obrazkovy-server-status/27666&type=3" alt="World of Craft" />

Uživatelský avatar
zdenda204
Příspěvky: 3617
Věk: 36
Registrován: 23 kvě 2012, 21:38
Reputation: 0

Re: Mobilni platby automatický script, jak na to ?

#17 Příspěvekod zdenda204 » 06 říj 2012, 12:28

Tak to mas smulu.
Ale pokud ti denne neprikde 50 VIP sms tak to muzes delat rucne,ne?
Přijímám zakázky na skripty/pluginy v PHP/Javě za malý poplatky! A kup mi sušenku :) Obrázek Obrázek
⇨Projekt Market⇦

dadam
Příspěvky: 148
Registrován: 14 pro 2011, 22:14
Reputation: 0

Re: Mobilni platby automatický script, jak na to ?

#18 Příspěvekod dadam » 07 říj 2012, 16:06

Vypadá to, že ten script komunikuje s mobilními platbami, ale někde je chyba odpovědní sms pro hráče je takováto:

Unable to open socket: Connection refused (111)

Nepomůžete mi stím ? Díky
<img src="http://www.minecraft-hosting.cz/obrazkovy-server-status/27666&type=3" alt="World of Craft" />

eakethet
Příspěvky: 314
Registrován: 19 led 2012, 10:33
Reputation: 0

Re: Mobilni platby automatický script, jak na to ?

#19 Příspěvekod eakethet » 07 říj 2012, 19:18

To bych viděl na chybu v rconu

dadam
Příspěvky: 148
Registrován: 14 pro 2011, 22:14
Reputation: 0

Re: Mobilni platby automatický script, jak na to ?

#20 Příspěvekod dadam » 07 říj 2012, 20:40

v logu se mi napíše toto

2012-10-07 20:30:47 [INFO] Rcon connection from: /46.28.105.11

a to je vše.
<img src="http://www.minecraft-hosting.cz/obrazkovy-server-status/27666&type=3" alt="World of Craft" />


Zpět na „Minecraft, Tekkit“

Kdo je online

Uživatelé prohlížející si toto fórum: Žádní registrovaní uživatelé a 18 hostů