The online racing simulator
IS_PFL
(6 posts, started )
#1 - Racon
If you know how to get at the $Flags variable then it's just the code below, but I'm afraid I'm not familiar with PRISM if you need help getting at it.

$autogears = $Flags & 8;
$autoclutch = $Flags & 512;

-
(donatas.s) DELETED by donatas.s
#2 - Racon
Yes, that's them. Lots of things to play with Smile

What I'm doing with the '&' is checking to see if that bit is set. So, 'Flags & 8' will be true if the autogears bit is set for that player, and false otherwise.

If your code above is working, then you can replace the message line with this to check:

<?php 

$gears 
$clutch 'No';

if (
$C->Flags PIF_AUTOGEARS)
  
$gears 'Yes';

if (
$C->Flags PIF_AUTOCLUTCH)
  
$clutch 'Yes';

$this->MessageToAll("Autogears: ".$gears.", Autoclutch: ".$clutch);

?>

-
(donatas.s) DELETED by donatas.s
always debug.. So dump $C->Flags


<?php 
var_dump
($C->Flags);
?>

-
(donatas.s) DELETED by donatas.s
#4 - Racon
Quote from donatas.s :There is no errors, but it always says
> Gears: Auto, Clutch: Auto
No matter to which transmission I change

--

var_dump("Flags: ".$C->Flags);

string(11) "Flags: 1601"

1601 is 1+64+512+1024, so PIF_SWAPSIDE (1), PIF_HELP_B (64), PIF_AUTOCLUTCH (512) and PIF_MOUSE (1024).

If it's not catching the autoclutch flag from a flags value of 1601, I can only think that you forgot to copy all those defines you listed into your code? (1601 & 512) will be evaluated as true, but (anything & 0) will be false... and an undefined constant will end up being 0.
-
(donatas.s) DELETED by donatas.s
#5 - Racon
Sorry, I'd forgotten how this bit worked... it's been a while Smile

You get the player flags in the NPL packet when a player joins the track, and in the PFL packet if those flags change while you're already on track. The format is the same in both places.

If you watch both packets, you should be good Thumbs up
-
(donatas.s) DELETED by donatas.s
#6 - Racon
Your PFL function looks to be using the flags that were set in the player's previous NPL, not the flags present in the PFL:
$C = $this->getPlayerByPLID($PFL->PLID);
//..
if ($C->Flags & 8)


You need to use the flags from the PFL directly:
if ($PFL->Flags & 8)


...or update the NPL variables first:
$C = $this->getPlayerByPLID($PFL->PLID);
$C->Flags = $PFL->Flags; // overwrite NPL flags with PFL flags
if ($C->Flags & 8)

-
(donatas.s) DELETED by donatas.s

IS_PFL
(6 posts, started )
FGED GREDG RDFGDR GSFDG