Hi, I seem to have a problem with tracking my UniqueID:
I spectate, and join the race hence getting a new UniqueID that I read from the IS_NPL packet that contains my uname.
<?php
$npl->parse($control); //$control = packet
if($npl->uname != $ply) return NULL; //$ply = "notanillusion"
?>
$npl->parse($control):
<?php
function parse($packet) {
$foo = unpack("a4id/a24uname/a24pname/a8plate/a32cname/Sflags/ctype/cunique_id/cply_num/ctotal/Sverify_id", $packet);
foreach($foo as $key => $value) {
$this->$key = $value;
}
}
?>
And put the UniqueID into a $race object which holds stuff like lap, split, sector times, names etc.
<?php
$race->unique_id = $npl->unique_id;
?>
Then I wait for SPX and LAP packets, and on arrival parse them and do some operations if it matches my UniqueID.
$spx->parse($control):
<?php
function parse($packet) {
$foo = unpack("a4id/c3time/cply_num/cunique_id/Sverify_id", $packet);
$foo['time'] = ($foo['time1'] * 60) + $foo['time2'].".".$foo['time3'];
foreach($foo as $key => $value) {
$this->$key = $value;
}
}
?>
<?php
if($spx->unique_id == $race->unique_id) {
//$spx is an instance of the SPX packet object
//$race is an instance of the $race object to which the IS_NPL UniqueID was placed when I joined the race
// do operations
}
?>
My problem is that the UniqueID's in the $race object and the $spx object don't match even though I haven't pitted or spectated again since joining.
Am I reading the IS_NPL or IS_SPX packets incorrectly or what?
I must be reading the IS_NPL wrong because I get UniqueID's like 46, 23, 37 etc, while all the UniqueID's from IS_SPX and IS_LAP packets are in the order of 0-2x.