if (someone is in the area)
{
if (stopspamming == 0)
{
InSim.Send_MST_Message("/msg ^7Hello World!");
stopspamming = 1;
}
}
elseif (noone is in the area)
{
stopspamming = 0;
}
<?php
php
$ext = new ReflectionExtension('json');
echo phpversion(), ' / ', $ext->getName(), '-', $ext->getVersion(), PHP_EOL; // 5.2.6 / json-1.2.1
echo json_encode('Jörg Baumgarth'), PHP_EOL; // "J"
echo $json = json_encode(mb_convert_encoding('Jörg Baumgarth', 'UTF-8', 'ISO-8859-1')), PHP_EOL; // "J\u00f6rg Baumgarth"
echo mb_convert_encoding(json_decode($json), 'ISO-8859-1', 'UTF-8'), PHP_EOL; // Jörg Baumgarth
?>
if mso["UCID"] != 0 and msgt == "eTS.NadeoSvK : ^L!test":
<?php
function MsgToConnection($message, $ucid=0, $plid=0)
{
var_dump($ucid, $plid);
}
MsgToConnection('Hello, World!', $plid=12);
function test($var1, $var2, $var3)
{
echo $var1, $var2, $var3, PHP_EOL;
}
test($var3='baz', $var2='bar', $var1='foo');
var_dump($var='value');
?>
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
}