<?php
$name = $this->player[$PLID]["SName"];
$uname = $this->connection[$UCID]["UName"];
?>
<?php
$connUsername = $this->livedbPlayer[$PLID]["Connection"]["UName"];
?>
<?php
$Laps = get_client_lap($PLID);
// I'd define an array to avoid copying many if's. Just more compact code.
$WorkString = array(PITLANE_EXIT => 'left pit lane',
PITLANE_ENTER =>'entered pit lane',
PITLANE_NO_PURPOSE => 'entered for no purpose',
PITLANE_DT => 'entered for drive-through',
PITLANE_SG => 'entered for stop-go');
ISP_MST("{$PName} {$WorkString[$Work]} on lap ${Laps}.");
}
}
?>
LIGHTSCHEME BLOCK :
16 char 0 lightscheme name : name
16 char 16 sky texture name : texture
16 char 32 environment texture : texture
1 col 48 sky colour : rgb0 - average sky colour
1 col 52 sun colour : rgb0 - artist defined
1 float 56 sun intensity : sun colour multiplier
1 float 60 sky boost : sky colour multiplier
1 float 64 sun heading : radians, CCW from forward(Y)
1 float 68 sun pitch : radians, up from ground
struct IS_ISI // InSim Init - packet to initialise the InSim system
{
byte Size; // 44
byte Type; // ISP_ISI
byte ReqI; // If non-zero LFS will send an IS_VER packet
byte Zero; // 0
word UDPPort; // Port for UDP replies from LFS (0 to 65535)
word Flags; // Bit flags for options (see below)
byte Sp0; // 0
byte Prefix; // Special host message prefix character
word Interval; // Time in ms between NLP or MCI (0 = none)
char Admin[16]; // Admin password (if set in LFS)
char IName[16]; // A short name for your program
};
<?php
define("ISP_ISI", 1);
...
userfunc[ISP_ISI] = function($param1, $param2) {
// code
};
?>
> php.exe -q php_insim_base.php
<?php
include("insim_constants.inc.php");
set_time_limit (0);
$address = '192.168.0.2';
$speakPort = 29999;
$listenPort = 30000;
$maxClients = 1;
$sockIn = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP) or die("Couldn't create listen socket");
socket_bind($sockIn, $address, $listenPort) or die('Could not bind to address');
$sockOut = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP) or die("Couldn't create send socket");
socket_connect($sockOut, $address, $speakPort) or die('Could not connect to address');
$pack = pack("CCCxSSxCSa16a16", 44, ISP_ISI, 1, $listenPort, ISF_NLP, 36, 1000, "detail", "detail");
socket_write($sockOut, $pack, strlen($pack));
print(bin2hex(socket_read($sockIn, 20, PHP_BINARY_READ)));
exit;
?>
InSim - UDP : detail (port 30000)
InSim - UDP : no slots available
InSim - UDP : no slots available
InSim timeout : detail