Vice City: Multiplayer

VC:MP Discussion => Support => Topic started by: MEGAMIND on Jul 18, 2018, 03:28 PM

Title: ini object n lag!
Post by: MEGAMIND on Jul 18, 2018, 03:28 PM
hello everyone i have an issue, well it works fine i can save load objects but the problem is it lags as hell

well heres the code

autosave <- NewTimer("SaveObjects",10000,0);
LoadAllObjects();

and in functions

function LoadAllObjects()
{ local i = 0;
  while(true)
  {
    local str = ReadIniString( "objects.ini", "objects", i.tostring() );
    if(!str) break;
    else
    {
      local a = compilestring(str);
      a();

      i++;
    }
  }
  for(local a=0;a<GetObjectCount();a++)
  {
      FindObject(a).TrackingShots = true;
  }
}

function SaveObjects()
{ local n = GetObjectCount();
  for(local i=0;i<n;i++)
  {
    local o = FindObject(i);
    if(o) {
    WriteIniString("objects.ini","autosaved",i.tostring(), "CreateObject("+o.Model+","+o.World+",Vector"+o.Pos+","+o.Alpha+").RotateToEuler(Vector"+o.RotationEuler+",1);"); }
  }
}

function LoadAutoSaved()
{
  local i = 0;
    while(true)
    {
      local str = ReadIniString( "objects.ini", "autosaved", i.tostring() );
      if(!str) break;
      else
      {
        local a = compilestring(str);
        a();

        i++;
      }
    }
    for(local a=0;a<GetObjectCount();a++)
    {
        FindObject(a).TrackingShots = true;
    }
}
it lags alot when a second player either joins or not while creating object it lags too

so is there a better way to do it
Title: Re: ini object n lag!
Post by: NicusorN5 on Jul 18, 2018, 04:16 PM
NEVER USE INI FOR SAVING PICKUPS AND OBJECTS AND SHIT! SERIOUSLY IT SUCKS!
Title: Re: ini object n lag!
Post by: MEGAMIND on Jul 18, 2018, 04:19 PM
anyone else there or could some one convert this shit to db or something else