本文整理汇总了PHP中Vehicle::ID方法的典型用法代码示例。如果您正苦于以下问题:PHP Vehicle::ID方法的具体用法?PHP Vehicle::ID怎么用?PHP Vehicle::ID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vehicle
的用法示例。
在下文中一共展示了Vehicle::ID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnPlayerEnterVehicle
public static function OnPlayerEnterVehicle(Player $player, Vehicle $vehicle, $ispassenger)
{
if (!$ispassenger && $vehicle->Type() == VEHICLE_SHOP) {
$price = VehicleShop::$prices[$vehicle->ID()];
$name = $vehicle->Name();
$capacity = $vehicle->FuelSpace();
$usage = sprintf('%.2f', $vehicle->FuelUsage() * 60);
$trunk = $vehicle->TrunkSpace();
$player->Send(COLOR_CARSHOP_HEADER, '');
$player->Send(COLOR_CARSHOP_HEADER, '.:: Vehicle shop ::.');
$player->Send(COLOR_CARSHOP_INFO, "This '{$name}' is for sale for {$price}\$");
$player->Send(COLOR_CARSHOP_INFO, 'If you want to buy it, type /buy');
$player->Send(COLOR_CARSHOP_INFO, 'Vehicle details:');
$player->Send(COLOR_CARSHOP_INFO, "* Gas tank capacity: {$capacity}lt");
$player->Send(COLOR_CARSHOP_INFO, "* Fuel usage: {$usage}lt / minute");
$player->Send(COLOR_CARSHOP_INFO, "* Trunk space: {$trunk} units");
$vehicle->SetHealth(1000);
return CALLBACK_BREAK;
}
return CALLBACK_OK;
}
示例2: Add
public static function Add(Vehicle $vehicle)
{
Vehicles::$vehicles[$vehicle->ID()] = $vehicle;
}
示例3: SendVehicleMessage
/**
** Message sending functions
**
** - SendVehicleMessage: Sends a message to the people inside a vehicle, except
** if this one is an "open" vehicle.
** - SendStandardMessage: Sends a standard talk message.
** - SendLocalOOC: Sends a OOC message locally (with distance limit)
** - SendGlobalOOC: Sends a OOC message globally (arrives to all players who
** requested OOC.
** - SendShout: Sends a shout.
** - SendWhisper: Sends a whisper from a player to another player.
** - SendDescribe: Sends a player description (/me).
**
**/
private static function SendVehicleMessage(Player $player, Vehicle $vehicle, $text)
{
Log::Append(LOG_MESSAGE, "{VEHICLE} [{$player->id}] {$player->name} says: {$text}");
$str = "{$player->name} says: {$text}";
foreach (Players::Get() as $p) {
$v = $p->GetVehicle();
if ($v != null && $v->ID() == $vehicle->ID()) {
$p->Send(0xafffafff, $str);
}
}
}