Beispiel #1
0
 /**
  ** Init
  ** Initialize all factions.
  **/
 public static function Init()
 {
     $factions = DB::GetAllFactions();
     foreach ($factions as $name) {
         /* Load the faction source code */
         $fixed_name = str_replace(' ', '_', $name);
         require_once "gamemodes/factions/{$fixed_name}.php";
         $factiondata = DB::GetFactionData($name);
         $classname = 'Faction_' . $fixed_name;
         $newfaction = new $classname($name, $factiondata['color'], $factiondata['bank'], $factiondata['maxvehicles'], $factiondata['maxmembers'], $factiondata['membercount']);
         if ($factiondata['HQ'] != null) {
             $room = Houses::FindByDBID($factiondata['HQ']);
             if ($room) {
                 $newfaction->SetHQ($room);
             }
         }
         if ($factiondata['bankfreezed'] == 1) {
             $newfaction->FreezeBank();
         }
         Factions::Register($newfaction, $newfaction->GetHQ());
         echo ">>>>> Loaded faction '{$name}'\n";
     }
     /* Register common faction commands */
     CommandHandler::Register('invite', 1, null, array('Factions', 'cmdInvite'), '[ID]', 1);
     CommandHandler::Register('uninvite', 1, null, array('Factions', 'cmdUninvite'), '[ID]', 1);
     CommandHandler::Register('rankup', 1, null, array('Factions', 'cmdRankup'), '[ID]', 1);
     CommandHandler::Register('rankdown', 1, null, array('Factions', 'cmdRankdown'), '[ID]', 1);
     CommandHandler::Register('duty', 1, null, array('Factions', 'cmdDuty'), '[on/off]', 1, -1000);
     CommandHandler::Register('open', 0, null, array('Factions', 'cmdOpen'), '', 1);
     CommandHandler::Register('close', 0, null, array('Factions', 'cmdClose'), '', 1);
 }