Blockland Forums > Modification Help

Adding bricks to minigame

Pages: << < (2/3) > >>

Kalphiter:

Make sure to set the brickgroup's client variable.

Greek2me:

Is there a %brick.minigame or %brickgroup.minigame var?

DontCare4Free:


--- Quote from: Kalphiter on October 02, 2011, 09:43:26 PM ---Make sure to set the brickgroup's client variable.

--- End quote ---
Did. Issue persists.


--- Quote from: Greek2me on October 02, 2011, 09:45:04 PM ---Is there a %brick.minigame or %brickgroup.minigame var?

--- End quote ---
No.

Amade:


--- Quote from: DontCare4Free on October 02, 2011, 09:40:00 PM ---This is basically what I've already done. And no, it still doesn't work.
--- End quote ---
Post your code :|

DontCare4Free:


--- Quote from: Amade on October 02, 2011, 11:03:15 PM ---Post your code :|

--- End quote ---

--- Code: (server.cs) ---$ServerMaint::Time = "10"; //Tick Time in mins.

function ServerMaint_Init()
{
   exec("config/server/servermaint.cs");
   ServerMaint_Load();
   $ServerMaint::Tick = true;
   ServerMaint_Tick();
   warn("Auto Saver Initialising");
}

function ServerMaint_Load(%savenum) {
        if (%savenum $= "") %savenum = $ServerMaint::SaveCount;
        announce("Loading backup number" SPC %savenum @ ".");
        %path = "saves/Slate/CityRP/Backup_" @ %savenum @ ".bls";
        if (true) { // fileExists(%path)) {
                fileCopy(%path, "base/server/temp/temp.bls");
                if (!isObject($ServerMaint::FauxClient)) $ServerMaint::FauxClient = new AIConnection() {
                        name = "Server";
                        bl_id = 1337;
                        isAdmin = true;
                };

                if (isObject(BrickGroup_1337)) $ServerMaint::FauxClient.brickGroup = BrickGroup_1337;
                else {
                        $ServerMaint::FauxClient.brickGroup = new simGroup(BrickGroup_1337) {
                                name = "Server";
                                bl_id = 1337;
                        };
                        mainBrickGroup.add($ServerMaint::FauxClient.brickGroup);
                }
BrickGroup_1337.client = $ServerMaint::FauxClient;
                serverCmdReloadBricks($ServerMaint::FauxClient);
        }

        if (isObject($ServerMaint::Minigame)) {
                $ServerMaint::Minigame.endGame();
                $ServerMaint::Minigame.delete();
        }

        for (%i=0;%i<clientGroup.getCount();%i++) {
                %cl = clientGroup.getObject(%i);
                if (isObject(%cl.minigame)) {
                        %cl.minigame.endGame();
                        %cl.minigame.delete();
                }
        }

        $ServerMaint::Minigame = new ScriptObject() {
                owner = $ServerMaint::FauxClient;
                ownerBL_ID = 1337;
                brickDamage = false;
                class=miniGameSO;
                colorIdx = 9;
                EnableBuilding = true;
                EnablePainting = true;
                enableWand = true;
                fallingdamage = false;
                inviteOnly = false;
                numMembers = 1;
                playerDataBlock = PlayerNoJet;
                PlayersUseOwnBricks = false;
                Points_BreakBrick = 0;
                Points_Die = 0;
                Points_KillPlayer = 0;
                Points_KillSelf = 0;
                Points_PlantBrick = 0;
                respawnTime = 1000;
                SelfDamage = false;
                StartEquip0 = 0;
                StartEquip1 = 0;
                StartEquip2 = 0;
                StartEquip3 = 0;
                StartEquip4 = 0;
                Title = "City RP";
                useAllPlayersBricks = false;
                useSpawnBricks = true;
                VehicleDamage = true;
                vehicleReSpawnTime = 0;
                weaponDamage = true;
        };

        for(%i=0;%i<clientGroup.getCount();%i++) {
                %cl = clientGroup.getObject(%i);
                $ServerMaint::Minigame.addMember(%cl);
        }
        activatePackage(ServerMaint_Minigame);
}

package ServerMaint_Minigame {
        function GameConnection::spawnPlayer(%this) {
                parent::spawnPlayer(%this);

                if (isObject($ServerMaint::Minigame) && %this.minigame != $ServerMaint::Minigame) {
                        $ServerMaint::Minigame.addMember(%this);
                }
        }

        function servercmdleaveminigame() {}
        function servercmdcreateminigame() {}
};

function serverCmdAutoSave(%client)
{
   if(!%client.issuperadmin) return;
   if(!$ServerMaint::Tick)
   {
      announce("Activating Auto-Saver");
      $ServerMaint::Tick = true;
      ServerMaint_Tick();
      return;
   }
   cancel($ServerMaint::Schedule);
   $ServerMaint::Tick = false;
   announce("Deactivating Auto-Saver");
}

function ServerMaint_Tick()
{
   cancel($ServerMaint::Schedule);
   if(!$ServerMaint::Tick)
   {
      return;
   }

   $ServerMaint::SaveCount++;
   $ServerMaint::Schedule = schedule($ServerMaint::Time * 1000 * 60, 0, ServerMaint_Tick);
   export("$ServerMaint::SaveCount", "config/server/servermaint.cs");

   ServerMaint_DoStuff();
}

function ServerMaint_DoStuff()
{
   announce("\c7 Maintenance Tick Initiating...");
   %filename = "CityRP/Backup_" @ $ServerMaint::SaveCount;
   saveBricks(%filename, true, true);
   announce("\c7 - Saved Bricks (" @ $ServerMaint::SaveCount @ "," SPC getBrickCount() SPC "bricks)");
}

schedule(0, 0, ServerMaint_Init);

--- End code ---


Pages: << < (2/3) > >>

Go to full version