本文整理匯總了PHP中Messages::SendNear方法的典型用法代碼示例。如果您正苦於以下問題:PHP Messages::SendNear方法的具體用法?PHP Messages::SendNear怎麽用?PHP Messages::SendNear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Messages
的用法示例。
在下文中一共展示了Messages::SendNear方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: cmdPay
public static function cmdPay(Player $player, $numparams, $params)
{
if ($target = Core::FindPlayer($player, $params[1])) {
if ($player->Position()->DistanceTo($target->Position()) > 5) {
$player->Send(COLOR_TOO_FAR, '[ERROR] Given player is too far');
return COMMAND_BREAK;
}
$amount = (int) $params[2];
if ($amount > 100000) {
$player->Send(COLOR_PAYMENT_TOO_HIGH, '[ERROR] You can pay a max of 100,000$');
return COMMAND_BREAK;
}
if (Players::CheckPayment($player, $amount)) {
$money = Core::FixIntegerDots($amount);
$player->GiveMoney(-$amount);
$player->Send(COLOR_YOU_PAY, "* You have given {$money}\$ to {$target->name}");
$target->GiveMoney($amount);
$target->Send(COLOR_GET_PAID, "* {$player->name} has given you {$money}\$");
Messages::SendNear($player, COLOR_ACTION, "{$player->name} takes some money and gives it to {$target->name}");
}
}
return COMMAND_BREAK;
}
示例2: cmdUnlockwindows
public static function cmdUnlockwindows(Player $player, $numparams, $params)
{
$vehicle = $player->GetVehicle();
if ($player->IsDriver() && $vehicle != null && $vehicle->HasRollableWindows()) {
if ($vehicle->LockedWindows()) {
$vehicle->LockWindows(false);
Messages::SendNear($player, COLOR_LOCKING_WINDOWS, "{$player->name} has unlocked the vehicle windows");
}
}
return COMMAND_OK;
}
示例3: cookItem
public static function cookItem(Player $player, $item)
{
if ($player->location instanceof House && isset(Houses::$cookitems[$item])) {
$house = $player->location;
$room = $house->GetPlayerRoom($player);
$cook = Houses::$cookitems[$item];
$fridge = $room->GetFridge();
if ($fridge < $cook->food) {
$player->Send(COLOR_HOUSE_NOTENOUGHFOOD, "[ERROR] There is not enough food in your fridge to cook a {$item}");
} else {
if (($anim = $player->GetAnimation()) && $anim->stop_data instanceof CookItem) {
$player->Send(COLOR_HOUSE_ALREADYCOOKING, "[ERROR] You are already cooking something");
} else {
Messages::SendNear($player, COLOR_ACTION, "{$player->name} is cooking {$cook->name}");
$cookanim = clone Houses::$cookanim;
$cookanim->steptime = $cook->time;
$cookanim->stop_cbk = array('Houses', 'playerCooked');
$cookanim->stop_data = $cook;
$player->Animate($cookanim);
$room->SetFridge($fridge - $cook->food);
}
}
}
}