Hmm alright, I'll work on that when I get home. almost done here in class.
if (Index >= AXO_CONCRETE_SLAB && Index <= AXO_CONCRETE_RAMP_WALL)
{
// Concrete objects - always floating regardless of 0x80 bit
// Flags byte contains various attributes depending on the object
// Each concrete object has three attributes
Attributes:
name bits values
Width : 0x03 >> 0 : 2, 4, 8, 16
Length : 0x0c >> 2 : 2, 4, 8, 16
Size X : 0x03 >> 0 : 0.25, 0.5, 0.75, 1
Size Y : 0x0c >> 2 : 0.25, 0.5, 0.75, 1
Height : 0xf0 >> 4 : 0.25 to 4 in steps of 0.25
Pitch : 0xf0 >> 4 : 0 to 90 in steps of 6 degrees
Colour : 0x03 >> 0 : grey / red / blue / yellow
Attributes used by each object:
AXO_CONCRETE_SLAB : Width / Length / Pitch
AXO_CONCRETE_RAMP : Width / Length / Height
AXO_CONCRETE_WALL : Colour / Length / Height
AXO_CONCRETE_PILLAR : Size X / Size Y / Height
AXO_CONCRETE_SLAB_WALL : Colour / Length / Pitch
AXO_CONCRETE_RAMP_WALL : Colour / Length / Height
}
if (Index >= AXO_CONCRETE_SLAB && Index <= AXO_CONCRETE_RAMP_WALL)
{
// Concrete objects - always floating regardless of 0x80 bit
// Flags byte contains various attributes depending on the object
// Each concrete object has three attributes
Attributes:
name bits values
Width : 0x03 >> 0 : 2, 4, 8, 16
Length : 0x0c >> 2 : 2, 4, 8, 16
Size X : 0x03 >> 0 : 0.25, 0.5, 0.75, 1
Size Y : 0x0c >> 2 : 0.25, 0.5, 0.75, 1
Height : 0xf0 >> 4 : 0.25 to 4 in steps of 0.25
Pitch : 0xf0 >> 4 : 0 to 90 in steps of 6 degrees
Colour : 0x03 >> 0 : grey / red / blue / yellow
Attributes used by each object:
AXO_CONCRETE_SLAB : Width / Length / Pitch
AXO_CONCRETE_RAMP : Width / Length / Height
AXO_CONCRETE_WALL : Colour / Length / Height
AXO_CONCRETE_PILLAR : Size X / Size Y / Height
AXO_CONCRETE_SLAB_WALL : Colour / Length / Pitch
AXO_CONCRETE_RAMP_WALL : Colour / Length / Height
}
<?php
private function concrete_parse($index, $bits)
{
switch($index)
{
case AXO_CONCRETE_SLAB:
$name = 'Width/Length/Pitch';
break;
case AXO_CONCRETE_RAMP:
$name = 'Width/Length/Height';
break;
case AXO_CONCRETE_WALL:
$name = 'Color/Length/Height';
break;
case AXO_CONCRETE_PILLAR:
$name = 'SizeX/SizeY/Pitch';
break;
case AXO_CONCRETE_SLAB_WALL:
$name = 'Colour/Length/Pitch';
break;
case AXO_CONCRETE_RAMP_WALL:
$name = 'Colour/Length/Height';
break;
default:
// No idea why we would get here.
break;
}
foreach (explode('/', $name) as $name)
$packet[$name] = self::concret_bits($name, $bits);
}
private function concrete_bits($name, $bits)
{
switch ($name)
{ // Some of these will not return the correct value yet.
case 'Width':
return $bits & 0x03 >> 0; # 2, 4, 8, 16
case 'Length':
return $bits & 0x0c >> 2; # 2, 4, 8, 16
case 'SizeX':
return $bits & 0x03 >> 0; # 0.25, 0.5, 0.75, 1
case 'SizeY':
return $bits & 0x0c >> 2; # 0.25, 0.5, 0.75, 1
case 'Height':
return $bits & 0xf0 >> 4; # 0.25 to 4 in steps of 0.25
case 'Pitch':
return $bits & 0xf0 >> 4; # 0 to 90 in steps of 6 degrees
case 'Colour':
return $bits & 0x03 >> 0; # grey / red / blue / yellow
}
}
?>
if (Index >= AXO_CONCRETE_SLAB && Index <= AXO_CONCRETE_RAMP_WALL)
{
// Concrete objects - always floating regardless of 0x80 bit
// Flags byte contains various attributes depending on the object
// Each concrete object has three attributes
Attributes:
name bits values
Width : 0x03 >> 0 : 2, 4, 8, 16
Length : 0x0c >> 2 : 2, 4, 8, 16
Size X : 0x03 >> 0 : 0.25, 0.5, 0.75, 1
Size Y : 0x0c >> 2 : 0.25, 0.5, 0.75, 1
Height : 0xf0 >> 4 : 0.25 to 4 in steps of 0.25
Pitch : 0xf0 >> 4 : 0 to 90 in steps of 6 degrees
Colour : 0x03 >> 0 : grey / red / blue / yellow
Attributes used by each object:
AXO_CONCRETE_SLAB : Width / Length / Pitch
AXO_CONCRETE_RAMP : Width / Length / Height
AXO_CONCRETE_WALL : Colour / Length / Height
AXO_CONCRETE_PILLAR : Size X / Size Y / Height
AXO_CONCRETE_SLAB_WALL : Colour / Length / Pitch
AXO_CONCRETE_RAMP_WALL : Colour / Length / Height
}
<?php
private function concrete_parse($index, $bits)
{
switch($index)
{
case AXO_CONCRETE_SLAB:
$name = 'Width/Length/Pitch';
break;
case AXO_CONCRETE_RAMP:
$name = 'Width/Length/Height';
break;
case AXO_CONCRETE_WALL:
$name = 'Color/Length/Height';
break;
case AXO_CONCRETE_PILLAR:
$name = 'SizeX/SizeY/Pitch';
break;
case AXO_CONCRETE_SLAB_WALL:
$name = 'Colour/Length/Pitch';
break;
case AXO_CONCRETE_RAMP_WALL:
$name = 'Colour/Length/Height';
break;
default:
// No idea why we would get here.
break;
}
foreach (explode('/', $name) as $name)
$packet[$name] = self::concret_bits($name, $bits);
}
private function concrete_bits($name, $bits)
{
switch ($name)
{ // Some of these will not return the correct value yet.
case 'Width':
return $bits & 0x03 >> 0; # 2, 4, 8, 16
case 'Length':
return $bits & 0x0c >> 2; # 2, 4, 8, 16
case 'SizeX':
return $bits & 0x03 >> 0; # 0.25, 0.5, 0.75, 1
case 'SizeY':
return $bits & 0x0c >> 2; # 0.25, 0.5, 0.75, 1
case 'Height':
return $bits & 0xf0 >> 4; # 0.25 to 4 in steps of 0.25
case 'Pitch':
return $bits & 0xf0 >> 4; # 0 to 90 in steps of 6 degrees
case 'Colour':
return $bits & 0x03 >> 0; # grey / red / blue / yellow
}
}
?>
<?php
// do a request for extra connection info update (LFS_ID/Language/IP)
$TINY = new IS_TINY;
$TINY->ReqI(1)->SubT(TINY_NCI)->Send();
?>
PHP NOTICE:
Undefined variable: UName in /prism0462/plugins/welcome.php on line 31
1 :: onClientConnect in /prism0462/modules/prism_plugins.php:158
2 :: dispatchPacket in /prism0462/modules/prism_hosts.php:579
3 :: inspectPacket in /prism0462/modules/prism_hosts.php:487
4 :: handlePacket in /prism0462/modules/prism_hosts.php:340
5 :: checkTraffic in /prism0462/PHPInSimMod.php:225
PHP NOTICE:
Undefined index: in /prism0462/plugins/welcome.php on line 31
1 :: onClientConnect in /prism0462/modules/prism_plugins.php:158
2 :: dispatchPacket in /prism0462/modules/prism_hosts.php:579
3 :: inspectPacket in /prism0462/modules/prism_hosts.php:487
4 :: handlePacket in /prism0462/modules/prism_hosts.php:340
5 :: checkTraffic in /prism0462/PHPInSimMod.php:225
Fatal error: Call to a member function InitButton() on a non-object in /prism0462/plugins/welcome.php on line 31
PHP NOTICE:
Undefined variable: UName in /prism0462/plugins/welcome.php on line 31
1 :: onClientConnect in /prism0462/modules/prism_plugins.php:158
2 :: dispatchPacket in /prism0462/modules/prism_hosts.php:579
3 :: inspectPacket in /prism0462/modules/prism_hosts.php:487
4 :: handlePacket in /prism0462/modules/prism_hosts.php:340
5 :: checkTraffic in /prism0462/PHPInSimMod.php:225
PHP NOTICE:
Undefined index: in /prism0462/plugins/welcome.php on line 31
1 :: onClientConnect in /prism0462/modules/prism_plugins.php:158
2 :: dispatchPacket in /prism0462/modules/prism_hosts.php:579
3 :: inspectPacket in /prism0462/modules/prism_hosts.php:487
4 :: handlePacket in /prism0462/modules/prism_hosts.php:340
5 :: checkTraffic in /prism0462/PHPInSimMod.php:225
Fatal error: Call to a member function InitButton() on a non-object in /prism0462/plugins/welcome.php on line 31
<?php
public function onClientConnect(IS_NCI $NCI)
{
$Client = $this->getClientByUCID($NCI->UCID);
#Continue on with rest of NCN packet using $Client instead of $NCN
#You could probably just save yourself some time by just naming the $Client variable $NCN
?>
<?php
$this->setTranslationSettings('plugin_name'); # if your default fallback language is english(en)
$this->setTranslationSettings('plugin_name', 'fr'); # if you'd rather specify a different fallback
# Translations will fail if this isn't ran.
?>
<?php
public function onClientConnect(IS_NCI $NCI)
{
$NCN = $this->getClientByUCID($NCI->UCID);
#Continue on with rest of NCN packet the way you would in the IS_NCN packet
?>
<?php
public function onPlayerJoin(IS_NPL $NPL)
{
$client = $this->getClientByUCID($NPL->UCID);
$this->translatePrivateMessage($NPL->UCID, 'User_Welcome', array($client->PName));
$this->translateGlobalMessage('Global_Message'); # You can also specify an argument array here aswell
}
?>
; PRISM/data/langs/plugin_name/en.ini
Global_Message = "^7This is a global message!"
User_Welcome = "^7Hello, %s^7!"
; PRISM/data/langs/plugin_name/fr.ini
Global_Message = "^7Ce est un message global!"
User_Welcome = "^7Bonjour, %s^7!"
<?php
class ClientHandler extends PropertyMaster
{
public static $handles = array
(
ISP_NCN => '__construct', # 18
ISP_CNL => '__destruct', # 19
ISP_CPR => 'onRename', # 20
ISP_TOC => 'onTakeOverCar', # 31
ISP_NCI => 'onClientInfo' # 57
);
// ..[snip]..
public function __destruct()
{
unset($this);
}
?>
<?php
class ClientHandler extends PropertyMaster
{
public static $handles = array
(
ISP_NCN => '__construct', # 18
ISP_CNL => 'onClientLeave', # 19
ISP_CPR => 'onRename', # 20
ISP_TOC => 'onTakeOverCar', # 31
ISP_NCI => 'onClientInfo' # 57
);
// ..[snip]..
public function onClientLeave(IS_CNL $CNL)
{
unset($this->parent->clients[$CNL->UCID]);
}
?>