The online racing simulator
IS_CON
(4 posts, started , go to first unread)
IS_CON
ISF_CON is added

<?php 
    
    $this
->registerPacket('onPlayerHit'ISP_CON);

    public function 
onPlayerHit(IS_CON $CON)
    {
    
$C $this->getClientByPLID($CON->PLID);
    
    
$this->SoundMessageToAllPlayers("Car contact: ".$CON->A($C->PName)." and ".$CON->B($C->PName));
    }
?>

Log:

2019-08-23 17:00:55 : ^8^B^17Car contact: IS_CON {
2019-08-23 17:00:55 : ^7 C Size = 40
2019-08-23 17:00:55 : ^7 C Type = IS_CON (50)
2019-08-23 17:00:55 : ^7 C ReqI = 0
2019-08-23 17:00:55 : ^7 C Zero = 0
2019-08-23 17:00:55 : ^7 v SpClose = 9
2019-08-23 17:00:55 : ^7 v Time = 21390
2019-08-23 17:00:55 : ^7 A =
2019-08-23 17:00:55 : ^7 B = CarContact {
2019-08-23 17:00:55 : ^7 C PLID = 37
2019-08-23 17:00:55 : ^7 C Info = 0
2019-08-23 17:00:55 : ^7 C Sp2 = 0
2019-08-23 17:00:55 : ^7 c Steer = 0
2019-08-23 17:00:55 : ^7 C ThrBrk = 0
2019-08-23 17:00:55 : ^7 C CluHan = 0
2019-08-23 17:00:55 : ^7 C GearSp = 0
2019-08-23 17:00:55 : ^7 C Speed = 0
2019-08-23 17:00:55 : ^7 C Direction = 0
2019-08-23 17:00:55 : ^7 C Heading = 247
2019-08-23 17:00:55 : ^7 c AccelF = 0
2019-08-23 17:00:55 : ^7 c AccelR = 0
2019-08-23 17:00:55 : ^7 s X = -1477
2019-08-23 17:00:55 : ^7 s Y = 3337
2019-08-23 17:00:55 : ^7}
2019-08-23 17:00:55 : ^7
2019-08-23 17:00:55 : ^7}
2019-08-23 17:00:55 : ^7 and IS_CON {
2019-08-23 17:00:55 : ^7 C Size = 40
2019-08-23 17:00:55 : ^7 C Type = IS_CON (50)
2019-08-23 17:00:55 : ^7 C ReqI = 0
2019-08-23 17:00:55 : ^7 C Zero = 0
2019-08-23 17:00:55 : ^7 v SpClose = 9
2019-08-23 17:00:55 : ^7 v Time = 21390
2019-08-23 17:00:55 : ^7 A =
2019-08-23 17:00:55 : ^7 B =
2019-08-23 17:00:55 : ^7}
2019-08-23 17:00:55 : ^7


How do i use this?
Example: A simple message to all players like:
Car contact: Player A and Player B
#2 - Racon
Quote from donatas.s :

<?php 
$C 
$this->getClientByPLID($CON->PLID);
?>


PLID isn't a property of CON (the packet), it's a property of CON->A and CON->B (the two carContact structures inside the packet).

Quote from donatas.s :

<?php 
    
$this
->SoundMessageToAllPlayers("Car contact: ".$CON->A($C->PName)." and ".$CON->B($C->PName));
?>


If PRISM sets up the object as I would guess it does, you should be able to remove the '$C=...' line, and then replace the above line with the following:

<?php 
$playerA 
$this->getClientByPLID($CON->A->PLID);
$playerB $this->getClientByPLID($CON->B->PLID);
$this->SoundMessageToAllPlayers("Car contact: ".$playerA->PName." and ".$playerB->PName);
?>

Quote from Racon :PLID isn't a property of CON (the packet), it's a property of CON->A and CON->B (the two carContact structures inside the packet).


If PRISM sets up the object as I would guess it does, you should be able to remove the '$C=...' line, and then replace the above line with the following:

<?php 
$playerA 
$this->getClientByPLID($CON->A->PLID);
$playerB $this->getClientByPLID($CON->B->PLID);
$this->SoundMessageToAllPlayers("Car contact: ".$playerA->PName." and ".$playerB->PName);
?>


OMG thank you. As always you are a life saver! Thumbs up
-
(donatas.s) DELETED by Dygear : Double Post
Quote from Racon :PLID isn't a property of CON (the packet), it's a property of CON->A and CON->B (the two carContact structures inside the packet).


If PRISM sets up the object as I would guess it does, you should be able to remove the '$C=...' line, and then replace the above line with the following:

<?php 
$playerA 
$this->getClientByPLID($CON->A->PLID);
$playerB $this->getClientByPLID($CON->B->PLID);
$this->SoundMessageToAllPlayers("Car contact: ".$playerA->PName." and ".$playerB->PName);
?>


Sorry for double post. But what about CarContact SpClose?

$this->SoundMessageToAllPlayers("Car contact: ".$playerA->PName." and ".$playerB->PName);
$this->SoundMessageToAllPlayers("^7A? Car durability: ^1-".number_format($CON->SpClose / 1000,1)."%");
$this->SoundMessageToAllPlayers("^7B? Car durability: ^1-".number_format($CON->SpClose / 1000,1)."%");

it shows spclose, but im not sure if this is playerA and playerB spclose, or just one of playerA in both messages
#5 - Racon
Happy to help Smile

CON->spClose is the speed of the contact between the two cars, not the speed of the cars themselves (which are A->Speed and B->Speed).

Two cars could be driving side by side at 100mph for instance, and just lightly touch as they do so. In that case both car speeds would be 100mph, but the closing speed would be something tiny like 1mph - it would be the speed the cars were moving towards each other, regardless of the speed they're going forwards.

Or one car driving at 100mph rear-ends a car driving in the same direction at 80mph - the closing speed would be 20mph.

Or two cars driving head head-on into each other at 30mph each, spClose would be 60mph.

IS_CON
(4 posts, started )
FGED GREDG RDFGDR GSFDG