The online racing simulator
php insim send message when stop at node ?
Using a php insim at the moment, could someone help me figure out how to trigger a message

If car drives to node 723 on track, what i need to send a message,

I tired various ways MsgToAll etc, i did get it to work, but wouldnt clear

Any tips would be great

thanks
Mick
If I remember correctly, and it's very possible that I don't, I'm pretty sure that you not always going to get the node value your looking for, there are many many nodes on a track, and InSim simply can't give you information on each node place. As a car travels at high speed it could jump from node 720 to node 726 in a single update, so your going to want to make sure that the node count does not go past your node without your program noticing it.


<?php 
function onNPL() {
    
$p &= $this->packet();
    foreach (
$p->Info as $NodeLap) {
        
$PLID &= $NodeLap->PLID;
        
$CNode &= $NodeLap->Node;
        
$PNode &= $this->DataStore[$PLID]->PrevNode;
        if (
$PNode 723 && $CNode => 723) {
            
// Your Message Code Here!
        
}
        
$PNode $NodeLap->Node;
    }
}
?>

That wouldnt be a problem, if i want the message to display on a long section of rode, IE node 700 - 740 msg= You have entered highway 1, then when it passes node 740, the message goes off,

Hope u understand this

Thanks
Mick
-
(DarkTimes) DELETED by DarkTimes
So change the code into:


<?php 
if ($Info->Node => 700 && $Info->Node <= 740) {
    
MTC::emit(array('PLID' => $PLID'Msg' => 'Highway 1'));
}
?>

Ok thanks for that, i will see if i can add it in the correct place,

Mick

FGED GREDG RDFGDR GSFDG