The online racing simulator
Forgot MCI flag.

It's running but it is not working. Doesn't readout the node info correctly.. (It's dumping node info arrays on the console though , so .pth is being read)

PHP NOTICE:
Undefined offset: 78 in /prism042/plugins/LVS.php on line 81
1 :: onMCI in /prism042/modules/prism_plugins.php:156
2 :: dispatchPacket in /prism042/modules/prism_hosts.php:440
3 :: handlePacket in /prism042/modules/prism_hosts.php:310
4 :: checkTraffic in /prism042/PRISM_ot.php:226
UNKNOWN:
Argument 3 passed to Plugins::isInPoly() must be an array, null given, called in /prism042/plugins/LVS.php on line 81 and defined in /prism042/modules/prism_plugins.php on line 449
1 :: isInPoly in /prism042/plugins/LVS.php:81
2 :: onMCI in /prism042/modules/prism_plugins.php:156
3 :: dispatchPacket in /prism042/modules/prism_hosts.php:440
4 :: handlePacket in /prism042/modules/prism_hosts.php:310
5 :: checkTraffic in /prism042/PRISM_ot.php:226
PHP WARNING:
Invalid argument supplied for foreach() in /prism042/modules/prism_plugins.php on line 459
1 :: isInPoly in /prism042/plugins/LVS.php:81
2 :: onMCI in /prism042/modules/prism_plugins.php:156
3 :: dispatchPacket in /prism042/modules/prism_hosts.php:440
4 :: handlePacket in /prism042/modules/prism_hosts.php:310
5 :: checkTraffic in /prism042/PRISM_ot.php:226
PHP NOTICE:
Undefined variable: xmin_x in /prism042/modules/prism_plugins.php on line 471
1 :: isInPoly in /prism042/plugins/LVS.php:81
2 :: onMCI in /prism042/modules/prism_plugins.php:156
3 :: dispatchPacket in /prism042/modules/prism_hosts.php:440
4 :: handlePacket in /prism042/modules/prism_hosts.php:310
5 :: checkTraffic in /prism042/PRISM_ot.php:226

Clearly something goes wrong somewhere
Continuing with this....

Quote :foreach ($pth->Nodes as $Node)

The s should not be there.

But...

Quote :public function toPolyLimit()
{
$XL = $this->Center->X + $this->Limit->Left;
$XR = $this->Cetner->X + $this->Limit->Right;
$YL = $this->Center->Y + $this->Limit->Left;
$YR = $this->Cetner->Y + $this->Limit->Right;
return array($XL, $XR, $YL, $YR);
}
public function toPolyRoad()
{
$XL = $this->Center->X + $this->Road->Left;
$XR = $this->Cetner->X + $this->Road->Right;
$YL = $this->Center->Y + $this->Road->Left;
$YR = $this->Cetner->Y + $this->Road->Right;
return array($XL, $XR, $YL, $YR);
}

This also isn't helping.

After those corrections the system still doesn't work.

Quote :PHP NOTICE:
Undefined variable: xmin_x in /prism042/modules/prism_plugins.php on line 471
1 :: isInPoly in /prism042/plugins/LVS.php:85
2 :: onMCI in /prism042/modules/prism_plugins.php:156
3 :: dispatchPacket in /prism042/modules/prism_hosts.php:440
4 :: handlePacket in /prism042/modules/prism_hosts.php:310
5 :: checkTraffic in /prism042/PRISM_ot.php:226

But... Hey... There is progress :doh:
Mjeh...

Quote :if ($x < $xmin_x || $x > $max_x || $y < $min_y || $y > $max_y)

xmin_x should just be min_x

Eehhhh

Then we get this

PHP NOTICE:
Indirect modification of overloaded property ClientHandler::$UName has no effect in /prism042/modules/prism_plugins.php on line 257
1 :: canUserAccessCommand in /prism042/modules/prism_plugins.php:213
2 :: handleCmd in /prism042/modules/prism_plugins.php:156
3 :: dispatchPacket in /prism042/modules/prism_hosts.php:440
4 :: handlePacket in /prism042/modules/prism_hosts.php:310
5 :: checkTraffic in /prism042/PRISM_ot.php:226
> IS_MTC Packet to ot.
< IS_MCI Packet from ot.
PHP NOTICE:
Undefined property: LVS::$OffTrack in /prism042/plugins/LVS.php on line 85
1 :: onMCI in /prism042/modules/prism_plugins.php:156
2 :: dispatchPacket in /prism042/modules/prism_hosts.php:440
3 :: handlePacket in /prism042/modules/prism_hosts.php:310
4 :: checkTraffic in /prism042/PRISM_ot.php:226

My dearest Dygear... I get the feeling this piece of coding isn't really tested upon release
It was not. If anything the changes posted where the main points of the update. I don't have anything new but what you can find on the GitHub repo. I've had zero time to do anything with prism since this update, but that's why this is open source. Anyone can take what I've done and continue the work. Thank you for the bug reports, if I get some time, I'll fix to the level you have here and I'll update as needed. I'm pretty sure that I'm not done with the base class for PTH and that's why I've not really done anything with the LVS plugin.
Yes well .. More then a half year ahead in time... I don't see it actually happening anymore.

Not something you have to take personal btw!

But, now you are talking about GIT.. Whats there is completely different from this release. Not working also, sadly

Funny thing is that I get the feeling I'm almost there with this release.
I've tried reinstalling PHP, disabling the HTTP PRISM function, and keep getting this error:

ERROR: [8] fwrite(): send of 252 bytes failed with errno=10035 A non-blocking socket operation could not be completed immediately.
. prism_hosts.php:1022

And:

ERROR: [8] Indirect modification of overloaded property ClientHandler::$UName has no effe
line 1022 is this;

writeTCP function

// It's Ok to send packet
if (($bytes = @fwrite($this->socket, $data)) === FALSE)
console('TCP: Error sending packet through socket.');

You sure you configured your TCP ports correctly? Firewall thisthat?
Did you modify PRISM's error handler?

When do you get this error?
Quote from Dygear :Did you modify PRISM's error handler?

Yes I did...

First one is when insim starts, 2nd is when ever a command is typed...

I found out that I can ignore the errors(surpressed errors that is) in my custom handler using

if (error_reporting() === 0)
return true;

so... Gonna add that and now it won't bug me when ever it hits a suppressed error

Edit2: 2nd error is actually from


<?php 
    
protected function canUserAccessCommand($UCID$cmd)
    {
        
# Hosts are automatic admins so due to their nature, they have full access.
        # Commands that have no premission level don't require this check.
        
if ($UCID == OR $cmd['accessLevel'] == -1)
            return 
TRUE;

        global 
$PRISM;
        
$adminInfo $PRISM->admins->getAdminInfo($this->getClientByUCID($UCID)->UName);
        return (
$cmd['accessLevel'] & $adminInfo['accessFlags']) ? TRUE FALSE;
    }
?>

Ok, there is a really annoying bug, When a user is on the server already when Insim starts, their ISP_NCN packet sends twice, so anything done on PRISM connect(While that client is on the server), sends twice...

found the culprit:


<?php 
        
# Get information on the clients & players, and their current race state.
        # These are redundant because of the above request for an ISM packet.
        # They must remain in order to avoid an error state in some plugins.
        
$ISP->SubT(TINY_NCN)->Send();    # get all connections (ISP_NCN)
?>

Quote from T3charmy :ERROR: [8] fwrite(): send of 252 bytes failed with errno=10035 A non-blocking socket operation could not be completed immediately.

Quote from Dygear :Did you modify PRISM's error handler?

Quote from T3charmy :Yes I did...

It's really best if you leave PRISM's core alone, everything is programmed in a way for a reason, even the error handler. It's very hard for me to support code that I can't see, and even more so when your reporting bugs in code that is no longer mine because of the modifications that you've made.

Quote from T3charmy :ERROR: [8] Indirect modification of overloaded property ClientHandler::$UName has no effe

As for the Indirect modification error, that's because of somewhere in your code you have modified UName some how. Check your plugins, and I'll need the whole error message next time so I can tell you where it's coming from, hopefully.

Quote from T3charmy :Ok, there is a really annoying bug, When a user is on the server already when Insim starts, their ISP_NCN packet sends twice, so anything done on PRISM connect(While that client is on the server), sends twice...

Yeah, that's a known bug. Not really sure how I am going to fix that yet. I ask for the connections in the case of PRISM starting while there is already a session in progress and I don't have their information yet. The request is needed so that I can populate their information within the state module. I'll probably check to see if there is a session in progress before I request an NCN packet.
Quote from Dygear :It's really best if you leave PRISM's core alone, everything is programmed in a way for a reason, even the error handler. It's very hard for me to support code that I can't see, and even more so when your reporting bugs in code that is no longer mine because of the modifications that you've made.



As for the Indirect modification error, that's because of somewhere in your code you have modified UName some how. Check your plugins, and I'll need the whole error message next time so I can tell you where it's coming from, hopefully.



Yeah, that's a known bug. Not really sure how I am going to fix that yet. I ask for the connections in the case of PRISM starting while there is already a session in progress and I don't have their information yet. The request is needed so that I can populate their information within the state module. I'll probably check to see if there is a session in progress before I request an NCN packet.

I must have misunderstood you, I haven't modified the core in anyway, I just have an additional error handler in my plugin. When I get a problem with modules, first thing I do is go and download fresh copy of PRISM...

As for the UName, I have found that problem, and I think I've fixed it...

Looking forward to that bug being fixed, really messes with my cruise plugin by calling NCN twice...
Quote from T3charmy :Looking forward to that bug being fixed, really messes with my cruise plugin by calling NCN twice...

Really? Why? Why are you handling NCN packets anyway?
Quote from Dygear :Really? Why? Why are you handling NCN packets anyway?

I use it to get Player Cruise stats...

<?php 
    
public function onClientConnect(IS_NCN $NCN)
    {
        if (empty(
$NCN->UName) || isset($this->conns[$this->curHostID]['Client'][$NCN->UCID])) // Checking if UCID is used Quick fix for Double NCN packet
            
return PLUGIN_CONTINUE;
        
$UName strtolower($NCN->UName);
        
$this->conns[$this->curHostID]['Client'][$NCN->UCID] = $UName;
        
$this->Acc[$UName] = new Account($NCN->UCID$UName$NCN->PName);
        
$this->Acc[$UName]->InitButton('HUD_Cash'0170304ISB_DARK);
        
$this->Acc[$UName]->InitButton('HUD_Meters_Total'4170304ISB_DARK);
        
$this->Acc[$UName]->InitButton('HUD_Meters_Today'8170304ISB_DARK);
        
$this->Acc[$UName]->InitButton('HUD_Road_Name'90180204ISB_DARK 6);
        
$this->Acc[$UName]->InitButton('HUD_Road_Limit'94180204ISB_DARK);
        
$this->Acc[$UName]->UpdateStatGUI();
    }
?>

Also as for this error:
Quote :Notice: Indirect modification of overloaded property ClientHandler::$UName has no effect in <snip>\PRISM\modules\prism_plugins.php on line 257

I tried this, and the error is gone:

<?php 
    
protected function canUserAccessCommand($UCID$cmd)
    {
        
# Hosts are automatic admins so due to their nature, they have full access.
        # Commands that have no premission level don't require this check.
        
if ($UCID == OR $cmd['accessLevel'] == -1)
            return 
TRUE;

        global 
$PRISM;
        
$ClientUName $this->getClientByUCID($UCID)->UName;
        
$adminInfo $PRISM->admins->getAdminInfo($ClientUName);
        return (
$cmd['accessLevel'] & $adminInfo['accessFlags']) ? TRUE FALSE;
    }
?>

Also; If you are intrested in seeing my insim and I'm online at [SC] Insim Dev Feel free to pass by
Is there a way to call a btn click function with params? such as


<?php 
registerOnClick
($this"ChaseClient('{$UName}', '{$CliUName}')")
?>

How about ...

PRISM/modules/prism_button.php L39-L59

<?php 
    
public function registerOnClick(Plugins $plugin$methodName$params NULL)
    {
        
$this->onClick = array($plugin$methodName$params);
        
$this->BStyle |= ISB_CLICK;
    }
    public function 
click(IS_BTC $BTC)
    {
        if (!
is_array($this->onClick))
            return;

        switch (
count($this->onClick))
        {
            case 
3:
                
call_user_func_array(array($this->onClick[0], $this->onClick[1]), $this->onClick[2]);
            break;
            case 
2:
            default:
                
call_user_func($this->onClick$BTC$this);
            break;
        }
    }
?>

Let me know if that works out better for you.


<?php 
$this
->registerOnClick($this'ChaseClient', array($UName$CliUName));
?>

If after you update this breaks anything let me know, because I'll have to change it on the commit too.
Quote from Dygear :Let me know if that works out better for you.

Seems to be working perfectly fine. Thanks.

Edit:


Warning: call_user_func_array() expects parameter 2 to be array, null given in \PRISM\modules\prism_button.php on line 52

This seems to work fine...


<?php 
    
public function registerOnClick(Plugins $plugin$methodName$params NULL)
    {
        
$this->onClick = array($plugin$methodName);
        if(
$params != NULL)
            
$this->onClick[] = $params;
        
$this->BStyle |= ISB_CLICK;
    }
    public function 
click(IS_BTC $BTC)
    {
        if (!
is_array($this->onClick))
            return;

        switch (
count($this->onClick))
        {
            case 
3:
                
call_user_func_array(array($this->onClick[0], $this->onClick[1]), $this->onClick[2]);
            break;
            case 
2:
            default:
                
call_user_func($this->onClick$BTC$this);
            break;
        }
    }
?>

Alright Now I seem the be having trouble with


<?php 
    
public function onMCI(IS_MCI $MCI)
    {
        
var_export($MCI->Info);
        foreach (
$MCI->Info as $CompCar)
        {
?>

Only the first car in MCI Info gets called?
Quote from T3charmy :

Warning: call_user_func_array() expects parameter 2 to be array, null given in \PRISM\modules\prism_button.php on line 52


Sorry, I'll fix that when I get home.


Quote from T3charmy :Only the first car in MCI Info gets called?

What do you mean by that? Do you mean only the first MCI packets information is given, or do you mean that the packet's Info only has one member, and that's the only thing that your getting?

First off, you might only get one Info item in that array because that is the last packet of the set to be sent, or there is only one client on the server. Secondly, the MCI function you defined will be fired one time for each packet in an MCI set, some times there is only 1 packet if there is less then 1 client.
Quote from Dygear :Sorry, I'll fix that when I get home.




What do you mean by that? Do you mean only the first MCI packets information is given, or do you mean that the packet's Info only has one member, and that's the only thing that your getting?

First off, you might only get one Info item in that array because that is the last packet of the set to be sent, or there is only one client on the server. Secondly, the MCI function you defined will be fired one time for each packet in an MCI set, some times there is only 1 packet if there is less then 1 client.

there was 3 people on the track.. it used to work fine, but now it doesnt, just sends the first client that is in the info array... anything after it is ignored... hmm I just thought of something to check on my end... Will double check that see if that is causing my issue, which may explain why its only doing first user...

EDIT: Yep, the problem with MCI was completely my fault, was using a return instead of a continue...
I am stuck with this... Not on the track!? ;



MCI packet
IS_MCI Object
(
[Size:protected] => 32
[Type:protected] => 38
[ReqI] => 0
[NumC] => 1
[Info] => Array
(
[0] => CompCar Object
(
[Node] => 646
[Lap] => 1
[PLID] => 6
[Position] => 1
[Info] => 194
[Sp3:protected] => 0
[X] => -48785751
[Y] => 26956816
[Z] => 703267
[Speed] => 3
[Direction] => 56891
[Heading] => 35327
[AngVel] => -2
)

)

)

$Info->X
-48772184


$Info->Y

26919232

$this->Path[$Info->Node]
Array
(
[0] => -48425412.199998
[1] => -48425396.049973
[2] => 27561493.800002
[3] => 27561509.950027
)

PTH array
PTH Object
(
[Version] => 0
[Revision] => 0
[Nodes] => 771
[FinishLine] => 648
[Node] => Array
(
[0] => Node Object

....

[646] => Node Object
(
[Center] => stdClass Object
(
[X] => -48425408
[Y] => 27561498
[Z] => 735658
)

[Direction] => stdClass Object
(
[X] => 0.20768044888973
[Y] => -0.97819674015045
[Z] => 0
)

[Limit] => stdClass Object
(
[Left] => -44.403587341309
[Right] => 24.649909973145
)

[Road] => stdClass Object
(
[Left] => -4.1999979019165
[Right] => 11.95002746582
)

)

I cannot understand why the node information is incorrect. Its really KY3.pth

Copy the PTH files from your LFS directory into the pth files that PRISM has. If they are not the same file you're going to have this problem.
This is the original LFS KY3.pth from 2005.

There is something wrong with these node conversion calculations... It seems.. Not sure yet how this is happening.

I've read that thread with that German too about sincostan shizzle and multiply it with 65536 but it doesn't result in correct data.

On the other hand, sources indicate that this shouldn't be so difficult to crack at all but ...

Quote from Dygear :into the pth files that PRISM has. If they are not

Say what? PRISM has PTH files? When, where?

.
It's on the repo, I forgot that you stick to official updates. As far as multiplying by a the size of a small int, I'll get into it.
From pth.txt found on the lfs website.
1) X,Y,Z int : 32-bit fixed point world coordinates (1 metre = 65536)

X and Y are ground coordinates, Z is up.

From the CompCar struct found in the InSim.txt, found in LFS 0.6B.

int X; // X map (65536 = 1 metre)
int Y; // Y map (65536 = 1 metre)
int Z; // Z alt (65536 = 1 metre)

So they are directly compatible from a datatype stand point. No conversion needed on our end. What you get from the packet should be, there for directly compatible with what you get from the pth file.

Don't worry, I'm working on the LVS plugin right now.
2

PHPInSimMod - PRISM 0.4.2 Discussion
(50 posts, started )
FGED GREDG RDFGDR GSFDG