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


PHP Player::Send方法代码示例

本文整理汇总了PHP中Player::Send方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::Send方法的具体用法?PHP Player::Send怎么用?PHP Player::Send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player::Send方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cmdBalance

 /**
  ** Commands
  **/
 public static function cmdBalance(Player $player, $numparams, $params)
 {
     if ($player->location->ID() == LSBank::$id) {
         $bank = Core::FixIntegerDots($player->GetBank());
         $interest = LSBank::$interest;
         $player->Send(COLOR_BANK_BALANCE, "[BANK] Balance: {$bank}\$, default interests: {$interest}%%");
     }
     return COMMAND_OK;
 }
开发者ID:ryden,项目名称:ItalyMafia-3.0,代码行数:12,代码来源:bank.php

示例2: 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

示例3: cmdCreateVehicle

 public static function cmdCreateVehicle(Player $player, $numparams, $params)
 {
     $vehicle = implode(' ', array_slice($params, 1));
     $model = -1;
     if (!ctype_digit($vehicle)) {
         $model = Vehicles::FindModelidByName($vehicle);
     } else {
         if (Vehicles::IsValidModelid($vehicle)) {
             $model = (int) $vehicle;
         } else {
             return COMMAND_OK;
         }
     }
     if ($model != -1) {
         $pos = clone $player->Position();
         $pos->x++;
         $pos->y++;
         $pos->z++;
         new Vehicle(-1, VEHICLE_STATIC, -1, $model, array(1, 0), $pos, 100, 1.1);
     } else {
         $player->Send(COLOR_ERROR, '.:: Enter a valid vehicle model ID or name ::.');
     }
     return COMMAND_OK;
 }
开发者ID:ryden,项目名称:ItalyMafia-3.0,代码行数:24,代码来源:main.php

示例4: SendUsage

 private static function SendUsage(Player $player, $cmdname, $cmd)
 {
     if ($cmd->usage != null && !empty($cmd->usage)) {
         $player->Send(COLOR_USAGE, '[ERROR] Usage: /' . $cmdname . ' ' . $cmd->usage);
     }
 }
开发者ID:ryden,项目名称:ItalyMafia-3.0,代码行数:6,代码来源:commands.php

示例5: cmdAdmins

 public static function cmdAdmins(Player $player, $numparams, $params)
 {
     $player->Send(COLOR_ADMINLIST, '* Current online admins:');
     foreach (Players::Get() as $p) {
         if ($p->GetAdminLevel() > 0 && Admin::$showadmins[$p->id]) {
             $player->Send(COLOR_ADMINLIST, " {$p->name} (" . Admin::GetLevelStr($p->GetAdminLevel()) . ')');
         }
     }
     return COMMAND_OK;
 }
开发者ID:ryden,项目名称:ItalyMafia-3.0,代码行数:10,代码来源:admin.php

示例6: CheckPayBank

 public static function CheckPayBank(Player $player, Faction $faction, $amount, Faction $target = null)
 {
     if ($amount < 1) {
         $player->Send(COLOR_INVALID_AMOUNT, '[ERROR] Invalid amount');
     } else {
         if ($faction->BankFreezed()) {
             $player->Send(COLOR_BANK_FREEZED, '[ERROR] Your faction bank account has been freezed, operation not completed');
         } else {
             if ($amount > $faction->GetBank()) {
                 $player->Send(COLOR_NOTENOUGH_MONEYBANK, '[ERROR] Your faction bank account doesn\'t have this amount of money');
             } else {
                 if ($target && $target->BankFreezed()) {
                     $player->Send(COLOR_BANK_FREEZED, '[ERROR] Given faction bank account has been freezed, operation cancelled');
                 } else {
                     return true;
                 }
             }
         }
     }
     return false;
 }
开发者ID:ryden,项目名称:ItalyMafia-3.0,代码行数:21,代码来源:main.php

示例7: menuUpgradesSelect

 public static function menuUpgradesSelect(Player $player, $row)
 {
     $skill = Players::GetSkillByName($row);
     if (!$skill || ($pts = $player->GetUpgradePoints()) == 0) {
         return;
     }
     $nextlevel = $player->GetSkill($skill->flag) + 1;
     if ($nextlevel <= $skill->maxlevel && $player->GetLevel() >= $skill->reqlevels[$nextlevel] && ($skill->reqskill == -1 || $player->GetSkill($skill->reqskill) >= $skill->reqskill_level)) {
         $player->SetSkill($skill->flag, $nextlevel);
         $player->SetUpgradePoints($pts - 1);
         $player->Send(COLOR_UPGRADE_DONE, "[UGPRADE] You upgraded the skill '{$skill->name}' to the level {$nextlevel}");
     }
 }
开发者ID:ryden,项目名称:ItalyMafia-3.0,代码行数:13,代码来源:main.php

示例8: TransferOwnership

 public function TransferOwnership(Player $player, Ownership $newowner, $price)
 {
     $oldid = $this->GetOwner();
     $newid = $newowner->GetOwner();
     $oldobj = null;
     $newobj = null;
     $oldstats = null;
     $newstats = null;
     switch ($this->GetType()) {
         case OWNERSHIP_ACCOUNT:
             $oldobj = Players::FindByDBID($oldid);
             if (!$oldobj) {
                 $oldstats = Accounts::LoadStats($oldid);
             }
             if (!$oldobj && !$oldstats) {
                 $player->Send(COLOR_RED, '[ERROR] Internal error, a log of this error has been saved to be fixed');
                 echo "WARNING! Trying to transfer ownership from an old owner identified as OWNERSHIP_ACCOUNT({$oldid}), " . "but unable to load their stats (account deleted?)\n";
                 return false;
             }
             break;
         case OWNERSHIP_FACTION:
             $oldobj = Factions::FindByID($oldid);
             if (!$oldobj) {
                 $player->Send(COLOR_RED, '[ERROR] Internal error, a log of this error has been saved to be fixed');
                 echo "WARNING! Trying to transfer ownership from an old owner identified as OWNERSHIP_FACTION({$oldid}), " . "but unable to find the faction (corrupted database?)\n";
                 return false;
             }
             break;
     }
     switch ($newowner->GetType()) {
         case OWNERSHIP_ACCOUNT:
             $newobj = Players::FindByDBID($newid);
             if (!$newobj) {
                 $newstats = Accounts::LoadStats($newid);
             }
             if (!$newobj && !$newstats) {
                 $player->Send(COLOR_RED, '[ERROR] Internal error, a log of this error has been saved to be fixed');
                 echo "WARNING! Trying to transfer ownership to a new owner identified as OWNERSHIP_ACCOUNT({$newid}), " . "but unable to load their stats (account deleted?)\n";
                 return false;
             }
             break;
         case OWNERSHIP_FACTION:
             $newobj = Factions::FindByID($newid);
             if (!$newobj) {
                 $player->Send(COLOR_RED, '[ERROR] Internal error, a log of this error has been saved to be fixed');
                 echo "WARNING! Trying to transfer ownership to a new owner identified as OWNERSHIP_FACTION({$newid}), " . "but unable to find the faction (corrupted database?)\n";
                 return false;
             }
             break;
     }
     /* Check if the bank accounts are frozen */
     if ($oldobj && $oldobj->BankFreezed()) {
         $player->Send(COLOR_BANK_FREEZED, '[ERROR] The current owner of this property has his bank account frozen, operation cancelled');
         return false;
     }
     if ($newobj && $newobj->BankFreezed()) {
         $facstr = ' ';
         if ($newobj instanceof Faction) {
             $facstr = ' faction ';
         }
         $player->Send(COLOR_BANK_FREEZED, "[ERROR] Your{$facstr}bank account has been freezed, operation cancelled");
         return false;
     }
     /* Check if the buyer has enough money */
     $facstr = ' ';
     if ($newobj) {
         $bank_buyer = $newobj->GetBank();
         if ($newobj instanceof Faction) {
             $facstr = ' faction ';
         }
     } else {
         $bank_buyer = $newstats['bank'];
     }
     if ($bank_buyer < $price) {
         $player->Send(COLOR_NOTENOUGH_MONEYBANK, "[ERROR] Your{$facstr}bank account hasn\\'t enough money to buy this property");
         return false;
     }
     /* Perform the transaction */
     $newname = 'Somebody';
     if ($newobj) {
         $newobj->GiveBank(-$price);
         $fixed_price = Core::FixIntegerDots($price);
         if ($newobj instanceof Faction) {
             $newobj->Send(COLOR_OWNERSHIP_ADQUIRED, "[FACTION BANK] {$player->name} adquired a new property for the faction for {$fixed_price}\$", MEMBER_ALLOWBANK);
             $newname = $newobj->GetName() . ' faction';
         } else {
             $newobj->Send(COLOR_OWNERSHIP_ADQUIRED, "[BANK] New property adquired for {$fixed_price}\$");
             $newname = $newobj->name;
         }
     } else {
         if ($newstats != null) {
             $newstats['bank'] -= $price;
             Accounts::SetLoadedStats($newid, $newstats);
         }
     }
     if ($oldobj) {
         $oldobj->GiveBank($price);
         $fixed_price = Core::FixIntegerDots($price);
         if ($oldobj instanceof Faction) {
             $oldobj->Send(COLOR_OWNERSHIP_SOLD, "[FACTION BANK] {$newname} bought one of the faction properties for sale for {$fixed_price}\$", MEMBER_ALLOWBANK);
//.........这里部分代码省略.........
开发者ID:ryden,项目名称:ItalyMafia-3.0,代码行数:101,代码来源:ownership.php

示例9: cmdStopexercise

 public static function cmdStopexercise(Player $player, $numparams, $params)
 {
     if (Gym::$players_key[$player->id] != -1) {
         SetCameraBehindPlayer($player->id);
         $player->ClearAnimations();
         $player->SetStrength($player->GetStrength() + (int) (Gym::$players_gained[$player->id] / 1));
         $player->Send(COLOR_GYM_EARNT, '[GYM] You have earned a total of ' . (int) (Gym::$players_gained[$player->id] / 1) . ' strength points');
         Gym::UnregisterPlayer($player);
     }
     return COMMAND_OK;
 }
开发者ID:ryden,项目名称:ItalyMafia-3.0,代码行数:11,代码来源:gym.php

示例10: getwep

function getwep(Player $player, $numparams, $params)
{
    $bullets = $player->GetGunAmmo($params[1]);
    $player->Send(COLOR_YELLOW, "You have {$bullets} bullets of gun {$params[1]}");
    return COMMAND_OK;
}
开发者ID:ryden,项目名称:ItalyMafia-3.0,代码行数:6,代码来源:test.php

示例11: cmdCook

 public static function cmdCook(Player $player, $numparams, $params)
 {
     if ($player->location instanceof House) {
         $house = $player->location;
         if (($pos = $house->GetKitchen()) == null) {
             $player->Send(COLOR_HOUSE_HASNTKITCHEN, '[ERROR] This house doesn\'t have a cooker');
             return COMMAND_OK;
         }
         if (!$pos->IsInSphere($player->Position(), 2.5)) {
             $player->Send(COLOR_HOUSE_NOTNEARKITCHEN, '[ERROR] You are not near the cooker');
             return COMMAND_OK;
         }
         $player->SetMenu(Houses::$cookmenu);
     }
     return COMMAND_OK;
 }
开发者ID:ryden,项目名称:ItalyMafia-3.0,代码行数:16,代码来源:main.php

示例12: SendWhisper

 private static function SendWhisper(Player $player, $target, $text)
 {
     $playerv = GetPlayerVehicleID($player->id);
     $targetv = GetPlayerVehicleID($target->id);
     if ($playerv == 0 || $playerv != $targetv) {
         if ($player == $target || $player->vworld != $target->vworld || $player->Position()->DistanceTo($target->Position()) > 3.5) {
             return;
         }
         /* Too far or invalid target */
     }
     Log::Append(LOG_MESSAGE, "{WHISPER} [{$player->id}] {$player->name} whispers to {$target->name}[{$target->id}]: {$text}");
     $target->Send(COLOR_WHISPER, "{$player->name} whispers: {$text}");
     $player->Send(COLOR_WHISPER, "* Whisper sent to {$target->name}: {$text}");
 }
开发者ID:ryden,项目名称:ItalyMafia-3.0,代码行数:14,代码来源:messages.php

示例13: cmdLogin

 public static function cmdLogin(Player $player, $numparams, $params)
 {
     if ($player->account->Authed()) {
         $player->Send(COLOR_GREEN, '* You are already logged in');
         return COMMAND_BREAK;
     }
     if ($player->account->data['password'] == md5($params[1])) {
         $player->Send(COLOR_GREEN, '* Password accepted, welcome to ItalyMafia');
         $player->account->Auth();
     } else {
         $player->account->wrongpassAttempts--;
         if ($player->account->wrongpassAttempts == 0) {
             $player->Send(COLOR_RED, '* Too many invalid passwords!');
             Kick($player->id);
         } else {
             $player->Send(COLOR_RED, '* Wrong password!');
         }
     }
     return COMMAND_BREAK;
 }
开发者ID:ryden,项目名称:ItalyMafia-3.0,代码行数:20,代码来源:account.php


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