Blockland Forums > Modification Help

What is dedicated-compatible?

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

Ipquarx:

my code involves getting a list from a .txt, and unless there's a way to completly delete variables, i may need to stick with that. the reason im asking is because the last mod i made that used a .txt list management system crashed the dedicated server the moment it started.

Red_Guy:


--- Quote from: Ipquarx on April 26, 2011, 07:15:16 PM ---my code involves getting a list from a .txt, and unless there's a way to completly delete variables, i may need to stick with that. the reason im asking is because the last mod i made that used a .txt list management system crashed the dedicated server the moment it started.

--- End quote ---
Chances are you were trying to call some function that was only available client-side.

What are you trying to accomplish?  im sure theres a server-side friendly way to do it.

Ipquarx:

i was trying to accomplish a flexible list system, using a .txt, and my average scripting skills.
it worked on a non-dedicated server, but it completly ruined the dedicated server. (crashed it, not corrupted it.)
here was the code for that, it was made along with a gui, so ignore any: (its not going to be released, and its broken. dont copy it.)

function servercmdreserve(%client, %id, %type, %g)
{
   if(!%client.isAdmin)
   return;
   if(%id $= "")
   return;
   for(%c=0;%c<strLen(%id);%c++)
   {
      %char[%c]=sn(getSubStr(%id,%c,1));
      if(%char[%c] !$= "NONE")
      {
         %char[%c] = %char[%c];
         %id[%a++] = %char[%c];
      }
   }
   %id = %id[%a - %a + 1] @ %id[%a - %a + 2] @ %id[%a - %a + 3] @ %id[%a - %a + 4] @ %id[%a - %a + 5];
   if(%type $= "")
   {
      %type = 1;
   }
   %val = %id TAB %type;
   %line = ln(%id, %type);
   if(%type == 2 && ln(%id) == 0)
   {
      return;
   }
   if(%type == 2 && ln(%id) >= 1)
   {
      $Res::ResC--;
      ReservedIDs.setSelectedRow(1);
   }
   if(%type == 1 && ln(%id) == 0)
   {
      $Res::ResC++;
   }
   if(%type == 1 && ln(%id) >= 1)
   {
      if(ln2(%id) == 1)
      {
         return;
      }
   }
   if(%line == 0)
   $Res::Line[$Res::LineCount++] = %val;
   else
   $Res::Line[%line] = %val;
   %file = new FileObject();
   %file.openForWrite("config/server/res/res.txt");
   %file.writeline("--RESERVATION LIST--");
   for(%i=1;%i<=$Res::LineCount;%i++)
   {
      if(getField($Res::Line[%i], 1) $= 1)
      {
         %file.writeLine($Res::Line[%i]);
      }
   }
   %file.close();
   %file.delete();
   if(%g $= "")
   {
      %g = 2;
   }
   if(%g == 1)
   {
      canvas.popdialog(ReserveGUI);
      canvas.pushdialog(ReserveGUI);
   }
}

Greek2me:


--- Quote from: Ipquarx on April 26, 2011, 07:15:16 PM ---there's a way to completly delete variables

--- End quote ---
$var = "";
If you do this to a variable contained in a scriptObject, you'll see that the var no longer appear when you dump it.

Headcrab Zombie:

the canvas.pop/pushdialog would probably be the cause


--- Quote from: Greek2me on April 26, 2011, 07:40:01 PM ---$var = "";

--- End quote ---
Or the DeleteVariables function

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

Go to full version