/** ** Commands **/ public static function cmdTogjq(Player $player, $numparams, $params) { if ($player->togjq == false) { Players::AddToJQ($player); $player->SendInfo('Join/quits are now enabled'); } else { Players::DelFromJQ($player); $player->SendInfo('Join/quits are now disabled'); } return COMMAND_BREAK; }
public function Auth() { /* Load the player stats */ $this->stats = Accounts::GetLoadedStats($this->id); if ($this->stats == null) { $this->stats = DB::GetAccountStats($this->id); } if ($this->stats == null) { $this->player->Send(COLOR_RED, '* Error loading your stats, contact an administrator.'); $this->player->Kick(); return; } Log::Append(LOG_JOINQUIT, "[{$this->player->id}] {$this->player->name} logged in"); /* Set the player authed and stop the limit login time */ Accounts::EraseLoadedStats($this->id); $this->authed = true; $this->data['password'] = null; KillTimer($this->loginTimer); $this->loginTimer = null; $this->player->SetAdminLevel($this->data['adminlevel']); /* Save the player last ip */ $data = array(); $data['id'] = $this->id; $data['last_ip'] = $this->player->ip; DB::SaveAccount($data); /* * Set the player starting location */ $location0 = Locations::Find(0); $location = Locations::Find($this->stats['location']); $vworld = $this->stats['vworld']; if ($location != null) { if ($location->StayAfterLogout() == false) { /* Find the location entrance to location0 */ while ($location->GetParent() != null && $location->GetParent() != $location0) { $location = $location->GetParent(); } if ($location->GetParent() != null) { $entrance = $location->GetEntrance(); $this->stats['x'] = $entrance->position->x; $this->stats['y'] = $entrance->position->y; $this->stats['z'] = $entrance->position->z; $this->stats['angle'] = $entrance->position->angle; } $location = $location0; $vworld = 0; } } else { $location = $location0; $vworld = 0; } $this->player->SetLocation($location); $this->player->SetVirtualWorld($vworld); /* Set player data */ $this->player->SetSkin($this->stats['skin']); $this->player->SetExperience($this->stats['experience']); $this->player->SetLevel($this->stats['level']); $this->player->SetSex($this->stats['sex']); $this->player->SetAge($this->stats['age']); $this->player->SetReports($this->stats['reports']); $this->player->SetBank($this->stats['bank']); $this->player->FreezeBank($this->stats['bankfreezed']); $this->player->SetStrength($this->stats['strength']); $this->player->SetSpeedometer($this->stats['speedo']); /* Marriage is a special case */ if ($this->stats['married'] != null) { /* Find their marriage */ $marrystats = DB::GetAccountStats($this->stats['married'], 'sex'); $marryaccount = DB::GetAccount($this->stats['married'], 'id', 'name'); $this->player->MarryTo($marryaccount['name'], $marrystats['sex']); } /* Set the player faction and rank */ $faction_is_null = 0; $rank_is_null = 0; if ($this->stats['faction'] == null) { $faction_is_null = 1; } if ($this->stats['rank'] == null) { $rank_is_null = 1; } if ($faction_is_null ^ $rank_is_null) { echo "[WARNING] Player {$this->player->name} has faction but not rank, or viceversa. Setting both to null\n"; $this->stats['faction'] = null; $this->stats['rank'] = null; } $this->player->SetFaction($this->stats['faction']); $this->player->SetRank($this->stats['rank']); $this->player->SetOnduty($this->stats['onduty']); /** ** Load player skills **/ $this->player->SetUpgradePoints($this->stats['upgradepts']); foreach ($this->stats as $name => $value) { if (!strncmp($name, 'sk_', 3)) { $name = substr($name, 3); $this->player->SetSkill(Players::GetSkillFlag($name), $value); } } /** ** Load player properties **/ /* Spawn the player and set his last position, if he had */ $this->player->LagProtection(); $this->player->Spawn(); if ($this->stats['x'] != 0 || $this->stats['y'] != 0 || $this->stats['z'] != 0 || $this->stats['angle'] != 0) { $pos = new Position($this->stats['x'], $this->stats['y'], $this->stats['z'], $this->stats['angle']); $sector = $location->Locate($pos); $this->player->SetPosition($pos); $location->StreamObjects($this->player, $pos, $sector); } /* Set player data required to be set after spawn */ $this->player->SetHunger($this->stats['hunger']); $this->player->SetInjures($this->stats['injures']); $this->player->SetMoney($this->stats['money']); $this->player->CheckHealth(true); $this->player->CheckGuns(true); /* Set the player guns */ for ($i = 0; $i < 13; $i++) { if ($this->stats['slot_' . $i] > 0) { } } /* Send the join info to players who requested it */ foreach (Players::GetJQ() as $p) { $p->Send(COLOR_GRAY, "[JOIN] {$this->player->name}({$this->player->id}) has logged in"); } /* Set the player message receiving defaults */ if ($this->player->togjq == true) { Players::AddToJQ($this->player); } if ($this->player->togooc == true) { Players::AddToOOC($this->player); } /* Check if the player must spawn in jail */ if ($this->stats['jailtime'] > 0) { $this->player->Jail($this->stats['jailtime']); } /* Show the clock */ TextDrawShowForPlayer($this->player->id, Core::GetClock()); $this->player->Update(); }