Exemple #1
0
 public function SetAdminLevel($level)
 {
     $this->adminlevel = (int) $level;
     if ($this->adminlevel > 0) {
         /* Show nametags */
         foreach (Players::Get() as $p) {
             $this->CanIdentify($p, true);
         }
     }
 }
Exemple #2
0
 public function Destroy()
 {
     foreach ($this->children as $child) {
         $child->Destroy();
     }
     if ($this->parent) {
         /* Move players to the parent location */
         foreach (Players::Get() as $player) {
             if ($player->location->id == $this->id) {
                 /* Move to the parent location */
                 $player->SetLocation($this->parent);
                 $entrance = $this->GetEntrance();
                 $player->SetPosition($entrance->position);
             }
         }
         $this->parent->RemoveChild($this);
     }
     foreach ($this->entrances as $entrance) {
         if ($entrance->id != -1) {
             DestroyPickup($entrance->id);
         }
         $entrance->location = null;
     }
     $this->entrances = null;
     foreach ($this->objects as $obj) {
         $obj->Destroy();
     }
     $this->objects = null;
     $this->children = null;
     $this->parent = null;
     Locations::Del($this);
     $this->area->Destroy();
     $this->area = null;
 }
Exemple #3
0
 /**
  ** Message sending functions
  **
  ** - SendVehicleMessage:   Sends a message to the people inside a vehicle, except
  **                         if this one is an "open" vehicle.
  ** - SendStandardMessage:  Sends a standard talk message.
  ** - SendLocalOOC:         Sends a OOC message locally (with distance limit)
  ** - SendGlobalOOC:        Sends a OOC message globally (arrives to all players who
  **                         requested OOC.
  ** - SendShout:            Sends a shout.
  ** - SendWhisper:          Sends a whisper from a player to another player.
  ** - SendDescribe:         Sends a player description (/me).
  **
  **/
 private static function SendVehicleMessage(Player $player, Vehicle $vehicle, $text)
 {
     Log::Append(LOG_MESSAGE, "{VEHICLE} [{$player->id}] {$player->name} says: {$text}");
     $str = "{$player->name} says: {$text}";
     foreach (Players::Get() as $p) {
         $v = $p->GetVehicle();
         if ($v != null && $v->ID() == $vehicle->ID()) {
             $p->Send(0xafffafff, $str);
         }
     }
 }
Exemple #4
0
 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;
 }
Exemple #5
0
 public static function Save()
 {
     /* First save all loaded stats */
     foreach (Accounts::$loaded_stats as $stats) {
         unset($stats['married']);
         DB::SaveAccountStats($stats);
     }
     Accounts::$loaded_stats = array();
     /* Save all connected players data */
     foreach (Players::Get() as $p) {
         if ($p->account && $p->account->Authed()) {
             $stats = $p->GetData();
             $stats['acc'] = $p->account->ID();
             DB::SaveAccountStats($stats);
         }
     }
 }