I thought I might post how the new features can be used.
I have coded my own button manager(not included in this release that brings in a missing features from buttons as seen in LFSLapper), That is, alternating text. It also has the ability to have preset configs(ini files) that are loaded and placed on screen. Anyways... to the point!
This Timer is made when the user connects(NCN)
<?php
$this->createNamedTimer("Cruise_ButtonHandle_{$UName}", 'DoButtonHandle', 0.50, Timer::REPEAT, array($UName));
?>
Then on Disconnect(CNL)
<?php
$this->removeTimer("Cruise_ButtonHandle_{$UName}");
?>
Of course timers still work the same as they did in 0.4.4
<?php
$this->createTimer('RandMTCAll', 600, Timer::REPEAT);
?>
Now, the use PLC is a lot easier with the variables being defined:
<?php
$this->Packets['PLC'] = new IS_PLC;
$this->Packets['PLC']->UCID($UCID)->Cars(0);
foreach($this->Stats[$this->PrName]['Cars'] as $Car => $Value){
if($Value){
$this->Packets['PLC']->Cars += constant("PLC_$Car");
}
}
$this->Packets['PLC']->Send($HostID);
?>
in this example(from my cruise plugin :schwitz
![](/static/smilies/smile.gif)
, on user connect a new PLC packet is created with no cars, then a foreach is ran against the array of Cars to see if the user owns that car, if the user does, it adds the cars PLC value to the packet, once it's ran through all 20 cars, it will send the PLC packet.
When a user buys a car
![](/static/smilies/schwitz.gif)
, this is ran
<?php
if($this->UCID != null){
$this->Packets['PLC']->Cars += constant("PLC_$Car");
$this->Packets['PLC']->Send();
}
?>
(because I use this function to refund cars, it needs to check if the UCID is not null[cause that's the UCID I use for offline refunds]), anyways, assuming the user is online, it calls their stored PLC packet from my system, and adds the car's PLC value.
To sell a car, same thing:
<?php
if($this->UCID != null && $Profile == $this->PrName){
$this->Packets['PLC']->Cars -= constant("PLC_$Car");
$this->Packets['PLC']->Send();
if($this->CurrCar == $Car){
IS_MST()->Msg("/spec {$this->UName}")->Send();
}
}
?>
call the stored packet once again, and subtract the car's PLC value to get rid of the car(and then spectate them if that is the car they are currently driving)