本文整理汇总了PHP中Player::Position方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::Position方法的具体用法?PHP Player::Position怎么用?PHP Player::Position使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player::Position方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: OnPlayerEnterVehicle
public static function OnPlayerEnterVehicle(Player $player, $vehicle)
{
if ($player->timedeath != 0) {
$pos = $player->Position();
SetPlayerPos($player->id, $pos->x, $pos->y, $pos->z);
return CALLBACK_DISALLOW;
}
return CALLBACK_OK;
}
示例3: IsInExit
/**
** IsInExit
** Checks if a player is in some of this location exits. If true, return the entrance.
**
** Parameters:
** - player: The player to check
**/
public function IsInExit(Player $player)
{
foreach ($this->entrances as $entrance) {
if ($entrance->start->IsInSphere($player->Position(), 2.5)) {
return $entrance;
}
}
return null;
}
示例4: cmdExercise
/**
** Commands
**/
public static function cmdExercise(Player $player, $numparams, $params)
{
foreach (Gym::$machines as $machine) {
if (isset(Gym::$anims[$machine->type]) && $machine->position->IsInSphere($player->Position(), 1.5)) {
if ($machine->player) {
$player->Send(COLOR_GYM_MACHINE_USED, '[ERROR] This exercise machine is already being used');
return COMMAND_OK;
}
$player->SetPosition($machine->position);
$player->SetCamera($machine->camera);
$player->CameraLookAt($machine->position);
$player->Animate(Gym::$anims[$machine->type]);
$machine->player = $player;
}
}
return COMMAND_OK;
}
示例5: dodrivenext
function dodrivenext(Player $player, $numparams, $params)
{
$pos = $player->Position();
$nearest = null;
$distance = 0;
for ($i = 0; $i < 700; $i++) {
GetVehiclePos($i, &$x, &$y, &$z);
if ($x == 0 && $y == 0 && $z == 0) {
continue;
}
$vpos = new Position($x, $y, $z);
$dist = $vpos->DistanceTo($pos);
if ($nearest === null || $dist < $distance) {
$distance = $dist;
$nearest = $i;
}
}
if ($nearest !== null) {
PutPlayerInVehicle($player->id, $nearest, 0);
}
return COMMAND_OK;
}
示例6: 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;
}
示例7: SendDescribe
private static function SendDescribe(Player $player, $text)
{
Log::Append(LOG_MESSAGE, "{ACTION} [{$player->id}] {$player->name} describes: {$text}");
$str = "** {$player->name} {$text}";
$sectors = $player->sector->FindSectors($player->Position(), 20);
foreach ($sectors as $sector) {
foreach ($sector->GetPlayers() as $target) {
if ($player->vworld == $target->vworld && $player->Position()->DistanceTo($target->Position()) < 20) {
$target->Send(COLOR_ACTION, $str);
}
}
}
}
示例8: StreamCheckpoints
public function StreamCheckpoints(Player $player)
{
$nearest = null;
$distance = 0.0;
$tmpdist = 0.0;
for ($cp = $this->checkpoints; $cp != null; $cp = $cp->next) {
if (($tmpdist = $cp->position->DistanceTo($player->Position())) < $distance || $nearest == null) {
$nearest = $cp;
$distance = $tmpdist;
}
}
if ($player->checkpoint != $nearest) {
if ($nearest != null) {
SetPlayerCheckpoint($player->id, $nearest->position->x, $nearest->position->y, $nearest->position->z, $nearest->size);
} else {
DisablePlayerCheckpoint($player->id);
}
}
$player->checkpoint = $nearest;
}