Whatever the hell it is, please, release it.. otherwise Dygear here, is going to have some sort of melt down...!
$MSO = new MSO();
$MSO->UCID = $UCID
$MSO->PLID = $PLID
$MSO->UserType = MSO_USER;
$MSO->Msg = "Welcome to the Race, {$PName}^9 ({$UName})!";
// Setup Option 2 - Array, Fast, and Short, but Ugly.
$MSO = new MSO(array(
'UCID' => $UCID,
'PLID' => $PLID,
'UserType' => MSO_USER;
'Msg' => "Welcome to the Race, {$PName}^9 ({$UName})!"
);
<?php
$mso = new MSO($uclid, $plid, MSO_USER, $msg);
$mso->send($conn);
?>
<?php
class MSO {
var $uclid;
var $plid;
var $usertype;
var $msg
function __construct($uclid, $plid, $usertype, $msg) {
foreach(get_object_vars($this) as $i => $v) {
$this->$i = $$i;
}
}
function send($conn) {
// to do
}
}
?>
$MSO = new MSO(etc etc)
MSO.blah(etc etc)
<?php
php
class myPluginName {
public function register_plugin() {
$this->name = 'Simple Example Plugin';
$this->author = 'Mark \'Dygear\' Tomlin';
$this->version = '0.Example1.1';
$this->functions = array(
'client_connect' => array('ISP_NCN'),
);
}
public function client_connect($packet) {
extract($packet); # Extracts packet data into symbol table.
$MSO = new MSO();
$MSO->UCID = $UCID
$MSO->PLID = $PLID
$MSO->UserType = MSO_USER;
$MSO->Msg = "Welcome to the Race, {$PName}^9 ({$UName})!";
$MSO->send();
}
}
?>
<?php
php
class myPluginName {
public function register_plugin() {
$this->name = 'Simple Example Plugin';
$this->author = 'Mark \'Dygear\' Tomlin';
$this->version = '0.Example1.2';
$this->functions = array(
'client_connect' => array('ISP_NCN'),
);
}
public function client_connect($packet) {
extract($packet); # Extracts packet data into symbol table.
$MSO = new MSO(array(
'UCID' => $UCID,
'PLID' => $PLID,
'UserType' => MSO_USER;
'Msg' => "Welcome to the Race, {$PName}^9 ({$UName})!"
);
$InSim->send($MSO);
}
}
?>
<?php
php
class myPluginName {
public function register_plugin() {
$this->name = 'Simple Example Plugin';
$this->author = 'Mark \'Dygear\' Tomlin';
$this->version = '0.Example1.3';
$this->functions = array(
'client_connect' => array('ISP_NCN'),
);
}
public function client_connect($packet) {
extract($packet); # Extracts packet data into symbol table.
MSO::send(
array(
'UCID' => $UCID,
'PLID' => $PLID,
'UserType' => MSO_USER,
'Msg' => "Welcome to the Race, {$PName}^9 ({$UName})!"
)
);
}
}
?>
<?php
MSO::send(
array(
'UCID' => $UCID,
'PLID' => $PLID,
'UserType' => MSO_USER,
'Msg' => "Welcome to the Race, {$PName}^9 ({$UName})!"
)
);
?>
<?php
MSO::send($UCID, $PLID, MSO_USER, "Welcome to the Race, {$PName}^9 ({$UName})!");
?>
function sensibleMethod(MSO $msopacket) {
// programmer thinks "i'm interfacing with a packet object that corresponds to the insim spec"
echo $msopacket->UName;
// programmer wants to send a packet
$mypacket = new MST();
// programmer thinks "i'm interfacing with a packet object that corresponds to the insim spec"
$mypacket->Msg = 'Hello, ' . $msopacket->UName;
// programmer wants to send another packet
$myotherpacket = new MTC();
// programmer thinks "i'm interfacing with a packet object that corresponds to the insim spec"
$myotherpacket->UCID = $msopacket->UCID;
// etc ..
}
function confusingMethod(MSO $packet) {
// programmer thinks "i'm interfacing with a packet object that corresponds to the insim spec"
echo $packet->UName;
// programmer wants to send a packet
// programmer thinks "ok so now i'm supposed to interface with send_mst()"
send_mst( ... );
// programmer wants to send another packet
// programmer thinks "ok so now i'm supposed to interface with send_mtc()"
etc..
}
function sensibleProxyPacketDispatch(InSimPacket $packet) {
foreach ($this->clients as $client) {
$packet->sendTo($client);
}
}
function horribleProxyPacketDispatch(InSimPacket $packet) {
if ($packet instanceof MSO) {
send_mso( ... );
}
elseif ($packet instanceof NPL) {
send_npl( ... );
}
... and on and on
}