Why does this work perfect in windows but not in linux?
#1

I'm having trouble saving certain things to my database.

First is properties, and the other is vehicles. I've tested both of the commands in Windows server and they completed in under 1 second with no errors or lag. I tried the same in linux server which my main server runs on, and it lagged the server for a few minutes. Sometimes it completes instantly, but after a few seconds the server crashes.

This is how long it too to complete the task in linus..

[21:57:57]Start

[22:01:13]Finish


This only happens in linux, does anyone see anything wrong with the code below that could be causing this?

pawn Код:
stock SaveVehicles()
{
    new DB:Database = db_open(VEHICLES_DB);
    new DBResult:result,
        query[256];


    if(Database)
    {
        for(new i=1; i<=vTotal; i++)
        {
            if(VehData[i][vModel] >= 400 && VehData[i][vModel] <= 611)
            {
                if(VehData[i][Saved] == 1)
                {
                    switch(VehData[i][vType])
                    {
                        case TYPE_DEFAULT:
                        {
                            VehData[i][vType] = 0;
                        }
                        case TYPE_ADMIN:
                        {
                            VehData[i][vType] = 1;
                        }
                        case TYPE_VIP:
                        {
                            VehData[i][vType] = 2;
                        }
                        case TYPE_VALLOW:
                        {
                            VehData[i][vType] = 3;
                        }
                        case TYPE_RESERVED:
                        {
                            VehData[i][vType] = 6;
                        }
                    }
                   
                    format(query, sizeof(query), "SELECT `ID` from `vehicles` WHERE `ID`=%d", i);
                    result = db_query(Database, query);
                   
                    if(db_num_fields(result))
                    {
                        db_free_result(result);
                       
                        format(query, sizeof(query), "UPDATE `vehicles` SET `ID`=%d,`model`=%d,`xpos`=%f,`ypos`=%f,`zpos`=%f,`angle`=%f,\
                        `colour1`=%d,`colour2`=%d,`type`=%d,`owner`='%s' WHERE `ID`=%d"
, i, VehData[i][vModel], VehData[i][VxPos], VehData[i][VyPos],
                        VehData[i][VzPos], VehData[i][VRot], VehData[i][Colour1], VehData[i][Colour2], VehData[i][vType], VehData[i][Owner], i);
                        result = db_query(Database, query);
                       
                        db_free_result(result);
                    }
                    else
                    {
                        db_free_result(result);
                       
                        format(query, sizeof(query), "INSERT INTO vehicles(ID,model,xpos,ypos,zpos,angle,colour1,colour2,type,owner)\
                        values(%d,%d,%f,%f,%f,%f,%d,%d,%d,'%s');"
, i, VehData[i][vModel], VehData[i][VxPos], VehData[i][VyPos],
                        VehData[i][VzPos], VehData[i][VRot], VehData[i][Colour1], VehData[i][Colour2], VehData[i][vType], VehData[i][Owner]);
                        result = db_query(Database, query);

                        db_free_result(result);
                    }
                    savedcars++;
                }
            }
        }
        db_close(Database);
    }
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)