Author Topic: Need help with detecting map type  (Read 362 times)

I am trying to make a modified version of Honor's Mining script so that I can actually use it. It was made to detect the map you are using but I have no clue how to convert that into detecting an environment.
This is the code I have right now.
Code: [Select]
function servercmdstartDig(%client)
{
    if(%client.bl_id != getNumKeyID() && findLocalClient() !$= %client)
    {
      messageClient(%client, '', "You are not the host so you cannot start dig mode");
      return;
    }
   
    %terms = $Dig_addon["Terms"];
   
    if(%terms $= "True")
    {
      messageall('',"<color:00FF00>Terms of conditions: AGREED!");
    }
   
    else
    {
      messageall('',"<color:FF0000>Terms of conditions: DENIED! Please read READ THIS!.txt");
      return;
    }

    $Dig_allowedMission["Slate"] = 1;
    $Dig_allowedMission["Slate Aurora"] = 1;
    $Dig_allowedMission["Destruct"] = 1;
    $Dig_groundID["Slate"] = 5;
    $Dig_groundID["Slate Aurora"] = 6;
    $Dig_groundID["Destruct"] = 5;

    if(!$Dig_allowedMission[missionInfo.name])
    {
messageClient(%client, '', "Dig mode is only usable in Slate, Slate Aurora, and Destruct");
return;
    }

    $Dig_host = %client;
    $Dig_host_brickgroup = %client.brickgroup;
    $Dig_host_id = %client.bl_id;
    deleteVariables("$Dig_placedDirt*");
    %ground = missionGroup.getobject($Dig_groundID[missionInfo.name]);
    if(missionInfo.name $= "Slate Aurora")
%water = missionGroup.getobject(7);

    if(isObject(%ground))
%ground.delete();

    if(isObject(%water))
%water.delete();

    %spawnsphere = playerDropPoints.getobject(0);
    %spawnsphere.radius = 5;
    %spawnsphere.RayHeight = 3;
   
    $pref::server::Maxplayers = 1000;

    messageAll('', "<color:00FF00>Dig mode is now enabled");

    for(%x = -5.5; %x <= 5.5; %x++)
for(%y = -5.5; %y <= 5.5; %y++)
{
    Dig_PlaceCement(%x*2 SPC %y*2 SPC 0, "brick4xCubeData");
    Dig_PlaceCement(%x*2 SPC %y*2 SPC 10, "brick4xCubeData");
}

    %pos[0] = "10 10";
    %pos[1] = "10 -10";
    %pos[2] = "-10 10";
    %pos[3] = "-10 -10";

    for(%a = 0; %a < 4; %a++)
    {
Dig_PlaceCement(%pos[%a] SPC 3, "brick8xCubeData");
Dig_PlaceCement(%pos[%a] SPC 7, "brick8xCubeData");
    }

    for(%z = 0; %z <= 3; %z++)
    {
for(%x = 0; %x < 8; %x++)
    Dig_PlaceDirt(-7 + %x*2 SPC 11 SPC 2+%z*2);

for(%y = 0; %y < 8; %y++)
    Dig_PlaceDirt(11 SPC 7 - %y*2 SPC 2+%z*2);

for(%x = 0; %x < 8; %x++)
    Dig_PlaceDirt(7 - %x*2 SPC -11 SPC 2+%z*2);

for(%y = 0; %y < 8; %y++)
    Dig_PlaceDirt(-11 SPC -7 + %Y*2 SPC 2+%z*2);
    }

    %light = Dig_PlaceCement("0 0 8.75", "brick2x2FRoundData");
    %light1 = Dig_PlaceCement("6 0 8.75", "brick2x2FRoundData");
    %light2 = Dig_PlaceCement("0 6 8.75", "brick2x2FRoundData");
    %light3 = Dig_PlaceCement("-6 0 8.75", "brick2x2FRoundData");
    %light4 = Dig_PlaceCement("0 -6 8.75", "brick2x2FRoundData");
   
    %light.setLight(PlayerLight);
    %light1.setLight(PlayerLight);
    %light2.setLight(PlayerLight);
    %light3.setLight(PlayerLight);
    %light4.setLight(PlayerLight);

    activatepackage(Dig_spawnPackage);
    for(%c = 0; %c < ClientGroup.getCount(); %c++)
if(ClientGroup.getObject(%c).hasSpawnedOnce)
    ClientGroup.getObject(%c).instantRespawn();

    Dig_announceStats();
    $Dig_on = 1;
}

This script is so old, it's older than my grandma. But you would change the first function to this, and then change everything to do with placing bricks and spawning. Needs to be ported 50,000 blocks high..
Code: [Select]
function servercmdstartDig(%client)
{
    if(%client.bl_id != getNumKeyID() && findLocalClient() !$= %client)
    {
      messageClient(%client, '', "You are not the host so you cannot start dig mode");
      return;
    }
   
    %terms = $Dig_addon["Terms"];
   
    if(%terms $= "True")
    {
      messageall('',"<color:00FF00>Terms of conditions: AGREED!");
    }
   
    else
    {
      messageall('',"<color:FF0000>Terms of conditions: DENIED! Please read READ THIS!.txt");
      return;
    }

    $Dig_host = %client;
    $Dig_host_brickgroup = %client.brickgroup;
    $Dig_host_id = %client.bl_id;
    deleteVariables("$Dig_placedDirt*");

    %spawnsphere = playerDropPoints.getobject(0);
    %spawnsphere.radius = 5;
    %spawnsphere.RayHeight = 3;
   
    $pref::server::Maxplayers = 1000;

    messageAll('', "<color:00FF00>Dig mode is now enabled");

    for(%x = -5.5; %x <= 5.5; %x++)
for(%y = -5.5; %y <= 5.5; %y++)
{
    Dig_PlaceCement(%x*2 SPC %y*2 SPC 0, "brick4xCubeData");
    Dig_PlaceCement(%x*2 SPC %y*2 SPC 10, "brick4xCubeData");
}

    %pos[0] = "10 10";
    %pos[1] = "10 -10";
    %pos[2] = "-10 10";
    %pos[3] = "-10 -10";

    for(%a = 0; %a < 4; %a++)
    {
Dig_PlaceCement(%pos[%a] SPC 3, "brick8xCubeData");
Dig_PlaceCement(%pos[%a] SPC 7, "brick8xCubeData");
    }

    for(%z = 0; %z <= 3; %z++)
    {
for(%x = 0; %x < 8; %x++)
    Dig_PlaceDirt(-7 + %x*2 SPC 11 SPC 2+%z*2);

for(%y = 0; %y < 8; %y++)
    Dig_PlaceDirt(11 SPC 7 - %y*2 SPC 2+%z*2);

for(%x = 0; %x < 8; %x++)
    Dig_PlaceDirt(7 - %x*2 SPC -11 SPC 2+%z*2);

for(%y = 0; %y < 8; %y++)
    Dig_PlaceDirt(-11 SPC -7 + %Y*2 SPC 2+%z*2);
    }

    %light = Dig_PlaceCement("0 0 8.75", "brick2x2FRoundData");
    %light1 = Dig_PlaceCement("6 0 8.75", "brick2x2FRoundData");
    %light2 = Dig_PlaceCement("0 6 8.75", "brick2x2FRoundData");
    %light3 = Dig_PlaceCement("-6 0 8.75", "brick2x2FRoundData");
    %light4 = Dig_PlaceCement("0 -6 8.75", "brick2x2FRoundData");
   
    %light.setLight(PlayerLight);
    %light1.setLight(PlayerLight);
    %light2.setLight(PlayerLight);
    %light3.setLight(PlayerLight);
    %light4.setLight(PlayerLight);

    activatepackage(Dig_spawnPackage);
    for(%c = 0; %c < ClientGroup.getCount(); %c++)
if(ClientGroup.getObject(%c).hasSpawnedOnce)
    ClientGroup.getObject(%c).instantRespawn();

    Dig_announceStats();
    $Dig_on = 1;
}

This script is so old, it's older than my grandma. But you would change the first function to this, and then change everything to do with placing bricks and spawning. Needs to be ported 50,000 blocks high..
Code: [Select]
function servercmdstartDig(%client)
{
    if(%client.bl_id != getNumKeyID() && findLocalClient() !$= %client)
    {
      messageClient(%client, '', "You are not the host so you cannot start dig mode");
      return;
    }
   
    %terms = $Dig_addon["Terms"];
   
    if(%terms $= "True")
    {
      messageall('',"<color:00FF00>Terms of conditions: AGREED!");
    }
   
    else
    {
      messageall('',"<color:FF0000>Terms of conditions: DENIED! Please read READ THIS!.txt");
      return;
    }

    $Dig_host = %client;
    $Dig_host_brickgroup = %client.brickgroup;
    $Dig_host_id = %client.bl_id;
    deleteVariables("$Dig_placedDirt*");

    %spawnsphere = playerDropPoints.getobject(0);
    %spawnsphere.radius = 5;
    %spawnsphere.RayHeight = 3;
   
    $pref::server::Maxplayers = 1000;

    messageAll('', "<color:00FF00>Dig mode is now enabled");

    for(%x = -5.5; %x <= 5.5; %x++)
for(%y = -5.5; %y <= 5.5; %y++)
{
    Dig_PlaceCement(%x*2 SPC %y*2 SPC 0, "brick4xCubeData");
    Dig_PlaceCement(%x*2 SPC %y*2 SPC 10, "brick4xCubeData");
}

    %pos[0] = "10 10";
    %pos[1] = "10 -10";
    %pos[2] = "-10 10";
    %pos[3] = "-10 -10";

    for(%a = 0; %a < 4; %a++)
    {
Dig_PlaceCement(%pos[%a] SPC 3, "brick8xCubeData");
Dig_PlaceCement(%pos[%a] SPC 7, "brick8xCubeData");
    }

    for(%z = 0; %z <= 3; %z++)
    {
for(%x = 0; %x < 8; %x++)
    Dig_PlaceDirt(-7 + %x*2 SPC 11 SPC 2+%z*2);

for(%y = 0; %y < 8; %y++)
    Dig_PlaceDirt(11 SPC 7 - %y*2 SPC 2+%z*2);

for(%x = 0; %x < 8; %x++)
    Dig_PlaceDirt(7 - %x*2 SPC -11 SPC 2+%z*2);

for(%y = 0; %y < 8; %y++)
    Dig_PlaceDirt(-11 SPC -7 + %Y*2 SPC 2+%z*2);
    }

    %light = Dig_PlaceCement("0 0 8.75", "brick2x2FRoundData");
    %light1 = Dig_PlaceCement("6 0 8.75", "brick2x2FRoundData");
    %light2 = Dig_PlaceCement("0 6 8.75", "brick2x2FRoundData");
    %light3 = Dig_PlaceCement("-6 0 8.75", "brick2x2FRoundData");
    %light4 = Dig_PlaceCement("0 -6 8.75", "brick2x2FRoundData");
   
    %light.setLight(PlayerLight);
    %light1.setLight(PlayerLight);
    %light2.setLight(PlayerLight);
    %light3.setLight(PlayerLight);
    %light4.setLight(PlayerLight);

    activatepackage(Dig_spawnPackage);
    for(%c = 0; %c < ClientGroup.getCount(); %c++)
if(ClientGroup.getObject(%c).hasSpawnedOnce)
    ClientGroup.getObject(%c).instantRespawn();

    Dig_announceStats();
    $Dig_on = 1;
}
Thanks