當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。