I suspect if you show lines 1-20 or so of exa.php (within the forum's [noparse]

...

[/noparse] tags) we may have a good idea of at least where to start debugging.

    in my opinion u have not created proper object to call the function function _send_packet()

    have u??
    if so here then follow follwing step

    1. include the actual class file where this function is located like include('mydir/my_class.php');

    2. create an instance (object) of that class like
      $my_object= new myclass_name();

    3. then call the function like
      $my_object->function _send_packet()

      <?php
      require("library.php");
      require("common.php");
      $p = new Pickle();
      $uname = "";//USername goes here
      $upass = "";//PAss goes here
      $result = $p->connect("$uname", "$upass", 'Blizzard');
      echo "Result: $result\n";
      if ($result > 0)
          die("Pickle Error: $result");
      $p->attach_event('join_room', 'on_join');
      $p->attach_event('unknown_packet', 'unknown');
      $p->attach_event('tick', 'tick');
      $p->start();
      	function chat($phrase) {
      	$p->_send_packet(array('s', 'm#sm', $room, $p->player['id'], $phrase, ''));
      	}
      function on_join($p, $room, $players)
      {
          echo "I have just joined $room\n";
          print_r($players);
      }
      
      function unknown($p, $packet)
      {
          echo "Unknown Packet: ".implode('%', $packet)."\n";
      }
      
      function tick($p)
      {
          global $x;
          $x++;
          echo "Tick $x\n";
      	if($x >5){
      	chat("hello world");
      	sleep("2");}
      } 
      

        $p->_send_packet(array('s', 'm#sm', $room, $p->player['id'], $phrase, ''));

        i am bit confused with this statement which is on line number 16 but cant produce the error u have mentioned

          Instead of this:

          function chat($phrase) {
          	$p->_send_packet(array('s', 'm#sm', $room, $p->player['id'], $phrase, ''));
          	}
          

          Try this:

          function chat($phrase, $p) {
          	$p->_send_packet(array('s', 'm#sm', $room, $p->player['id'], $phrase, ''));
          	}
          

          Then wherever you call the "chat()" function, add the $p as the second parameter:

          chat('some phrase', $p);
          
            katsurace;10894424 wrote:

            $p->_send_packet(array('s', 'm#sm', $room, $p->player['id'], $phrase, ''));

            i am bit confused with this statement which is on line number 16 but cant produce the error u have mentioned

            Download the other files and you will see what its supposed to do

              rallan wrote:

              Please lock. resolved

              Well, that ruins the thread for everyone else.

                Write a Reply...