/** ** MovePlayer ** Moves a player to this location. Must also change the spawn information of the player to ** ** Parameters: ** - player: The player to move **/ public function MovePlayer(Player $player, $vworld_offset, LocationEntrance $entrance = null) { if ($entrance == null) { $player->SetSpawnPosition($this->start); $player->SetPosition($this->start); } else { $player->SetSpawnPosition($entrance->start); $player->SetPosition($entrance->start); } $player->SetVirtualWorld($this->vworld + $vworld_offset); SetPlayerInterior($player->id, $this->interior); $player->SetWorldBounds($this->bounds['min'], $this->bounds['max']); $player->Update(); /* Stream the objects for this player if the sight is -1 */ if ($this->sight == -1) { foreach ($this->objects as $o) { $o->CreateForPlayer($player); } } }
public static function OnPlayerSpawn(Player $player) { if ($player->firstSpawn == true) { $player->firstSpawn = false; } else { $player->SetHunger(MAX_HUNGER_POINTS); $player->SetInjures(60); $player->SetDead(false); $player->CheckHealth(true); if ($player->location) { SetPlayerInterior($player->id, $player->location->GetInteriorID()); } $player->ClearAnimations(); } return CALLBACK_OK; }