PHPInSimMod - PRISM 0.4.5 Discussion
You can download PHPInSimMod - PRISM 0.4.5 from that link. Please use this thread to talk about this release.

Thank you.

PHPInSimMod (PRISM) 0.4.5
  • Version changed to 0.4.5
  • Added ability to create timers with names so that they can later be removed
  • Defined PLC car values Ex: PLC_UF1
  • Fix packet issue introduced in PHP 5.5
  • Fixed Pit Work Flags
  • Added a shell script to make it easier to run PRISM on linux
  • Code clean up(proper use of tabs and { })
PHPInSimMod (PRISM) 0.4.5.1
  • Fixes Undefined variable: cmdString. prism_plugins.php:213(,219, 231 and ,243)
PHPInSimMod (PRISM) 0.4.5.2
  • Fixes error from indirect modification of overloaded property... prism_plugins.php:258
PHPInSimMod (PRISM) 0.4.5.3
  • Fixes Double State information bug
  • Fixes a goof in Timers
PHPInSimMod (PRISM) 0.4.5.4
  • Includes missing [PLC] declared values that were to be in 0.4.5
Congrats on your first release T3!
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.50Timer::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'600Timer::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, 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 , 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)
I perfer to do 0.4.5.1 and then 0.4.5.2 as apposed to 0.4.5a, 0.4.5b. PRISM follows PHP's number scheme and the version number should be able to be parsed by version_compare.
Quote from Dygear :I perfer to do 0.4.5.1 and then 0.4.5.2 as apposed to 0.4.5a, 0.4.5b. PRISM follows PHP's number scheme and the version number should be able to be parsed by version_compare.

I had a feeling you'd say that, I've never seen PRISM get patched like this so.. improvised. Figured you'd say something one way or another. I shall fix that.

Also. I never knew of that PHP function.... Learn something new everyday. :P
Lol, we live we learn. I kinda like that you put them all in this thread for their patch level. That's kinda nice.
Can anyone report if they are still having issues with the client / player state information?
I don't see code changes according to this?

---
While I was busy manually updating some stuff I spotted this;

# /modules/prism_timers.php

# decide next timeout timestamp
if ($timestamp = null || $timerTS > $timestamp)
$timestamp = $timerTS;

$timestamp = null in an if statement gives the effect of always assigning null to $timestamp. It should be == .. No idea why it doesn't lead to broken timers but would be nicer to not have this error in the code. Saves me from a yellow underlining @Netbeans
T3, do you wanna hotfix this as .3?
Sure thing I'll fix that after work!
Quote from Dygear :You sir are awesome

What ever you say.

Quote from Dygear :Thanks for merging them into my master branch as well!

Merged it after testing it on my server for a bit since I knew it was stable already. Timers seem to be working as normal.
Also in other news... after going through my flash drive and finding multiple PRISM backups... I'm happy to say I found the new website that I made for PRISM a while back!
Quote from T3charmy :Also in other news... after going through my flash drive and finding multiple PRISM backups... I'm happy to say I found the new website that I made for PRISM a while back!

although I'm gonna redo it yet again cause it was terrible...

Also I've pushed an update to fix undefined index on Take Over(TOC). I will create an updated Zip here shortly.
Quote from T3charmy :Also in other news... after going through my flash drive and finding multiple PRISM backups... I'm happy to say I found the new website that I made for PRISM a while back!

Oh! I own the domain PRISM.IO, send it over what you have and I'll put it on my web server. I'll give you SSH access once I'm setup.
Quote from Dygear :Oh! I own the domain PRISM.IO, send it over what you have and I'll put it on my web server. I'll give you SSH access once I'm setup.

Wrong kind of website... but I can make one of those too! Just give me a few days. :P

Edit: What exactly would you like on the website? One thing I thought about was server stats such as X amount of PRISM instances running on Y amount of LFS servers. various examples as well as a function list and how they're used. Also various things that can be done with PRISM etc.
Quote from T3charmy :Wrong kind of website... but I can make one of those too! Just give me a few days. :P

Edit: What exactly would you like on the website? One thing I thought about was server stats such as X amount of PRISM instances running on Y amount of LFS servers. various examples as well as a function list and how they're used. Also various things that can be done with PRISM etc.

I've shied away from doing documentation, because the API is not solid until 1.0. (I'll just wait for cargame to make a comment on how that will never happen.) I like the idea of the number of running instances that PRISM has running. I guess we could make a pingback plugin that gives us this stats, log information like Host Name, IP address, number of clients on the sever. It can update this information as client's leave / join.
Quote from Dygear :I've shied away from doing documentation, because the API is not solid until 1.0. (I'll just wait for cargame to make a comment on how that will never happen.

Someday we'll hit 1.0...

Quote from Dygear : I like the idea of the number of running instances that PRISM has running. I guess we could make a pingback plugin that gives us this stats, log information like Host Name, IP address, number of clients on the sever. It can update this information as client's leave / join.

Sounds good. I was gonna make it built in to PRISM but that works too!
1.0 or not.. For me it doesn't matter that much, already happy with the results so far!

But,

prism_buttonmanager.php
if ($BTN->UCID == 255) {
// TODO special handling...
}

Somebody having thoughts about this?

// I am testing but I actually do not know why it needs special treatment.

//// OK, I know understand it [I was wondering for quite some time why my other buttons kept disappearing, it overwrites all button IDs in use by private UCID ofcourse]
I've added the ISP_HCP packet into the master branch on Github and is ready for testing.
Very nice that you act so fast... One little thing;

Quote :define('ISP_HCP',56):// 66 - instruction: car handicaps

The first : Should be ;

and its 56, not 66.
1

FGED GREDG RDFGDR GSFDG