当前位置: 首页>>代码示例>>PHP>>正文


PHP Vehicle::ID方法代码示例

本文整理汇总了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;
 }
开发者ID:ryden,项目名称:ItalyMafia-3.0,代码行数:21,代码来源:shop.php

示例2: Add

 public static function Add(Vehicle $vehicle)
 {
     Vehicles::$vehicles[$vehicle->ID()] = $vehicle;
 }
开发者ID:ryden,项目名称:ItalyMafia-3.0,代码行数:4,代码来源:main.php

示例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);
         }
     }
 }
开发者ID:ryden,项目名称:ItalyMafia-3.0,代码行数:25,代码来源:messages.php


注:本文中的Vehicle::ID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。