SQLite VehLock Saving
#1

Hey Everyone,

I'm working on a SQLite game mode. A friend of mine helped me with this SQLite Vehicle System. This script doesnt creates the table if it doesnt exist. So first of all i got it working , Now it Creates the table with the given Types of fields for the table. I made this new Column called "locked" and this new VehicleVar called "Vehicle[vehicleid][vLocked]"

Now the problem is. This array works fine in game. That means if this array is 0 then it will be zero also in game . I can lock a vehicle and see the printf which shows that this array is changed to 1 and then the SaveVehicle() is called , it saves the vehicles and printf's the Vehicle Vars. Lock is the same as it was in the database , i.e if it was zero then it will zero , if it was one then it will be one here. Vehicle Vars changes in the game but doenst save properly. They load just fine. But saving is the problem i dont know why.

Everything use to work fine before. But after adding this new column called "locked" and PVar "Vehicle[vehicleid][vLocked]" in the game mode. It doesnt save the lock variable , everything is stored and loaded just fine. Its just the problem with lock (Saving Not Loading)

My SaveVehicle(vehicleid) callback.

pawn Код:
public SaveVehicle(vehicleid)
{
    if(VehicleExistsArray(vehicleid))
    {
        new array_id = VEHICLE_ARRAY_ID[vehicleid];
        //printf("SV ARRAY_ID %d", array_id);
        format(query, sizeof(query), "UPDATE `Vehicle` SET `x` = '%f', `y` = '%f', `z` = '%f', `model` = '%d', `color1` = '%d', `color2` = '%d', `angle` = '%f', `world` = '%d', `price` = '%d', `forsale` = '%d', `factionid` = '%d', `locked` = '%d', `owner_id` = '%d', `owned` = '%d' WHERE `id` = '%d'",
        Vehicle[array_id][vX],
        Vehicle[array_id][vY],
        Vehicle[array_id][vZ],
        Vehicle[array_id][vModel],
        Vehicle[array_id][vColor1],
        Vehicle[array_id][vColor2],
        Vehicle[array_id][vAngle],
        Vehicle[array_id][vWorld],
        Vehicle[array_id][vPrice],
        Vehicle[array_id][vForSale],
        Vehicle[array_id][vFactionID],
        Vehicle[array_id][vLocked],
        Vehicle[array_id][vOwner_ID],
        Vehicle[array_id][vOwned],
        Vehicle[array_id][vSQLID]);
        db_free_result(db_query(database,query));
        printf("[VEH]%d (%d) saved. [%d|%d|%d|Lock:%d]", Vehicle[array_id][vSQLID], Vehicle[array_id][vID], Vehicle[array_id][vOwner_ID], Vehicle[array_id][vOwned], array_id, Vehicle[array_id][vLocked]);
    }
    return true;
}
Reply


Messages In This Thread
SQLite VehLock Saving - by Ballu Miaa - 28.05.2012, 04:10
Re: SQLite VehLock Saving - by [HiC]TheKiller - 28.05.2012, 04:48
Re: SQLite VehLock Saving - by Ballu Miaa - 28.05.2012, 05:45
Re: SQLite VehLock Saving - by ReneG - 28.05.2012, 05:51
Re: SQLite VehLock Saving - by Ballu Miaa - 28.05.2012, 06:06
Re: SQLite VehLock Saving - by Ballu Miaa - 29.05.2012, 01:56
Re: SQLite VehLock Saving - by Jonny5 - 29.05.2012, 02:02
Re: SQLite VehLock Saving - by Ballu Miaa - 29.05.2012, 02:06
Re: SQLite VehLock Saving - by ReneG - 29.05.2012, 02:29
Re: SQLite VehLock Saving - by Ballu Miaa - 29.05.2012, 02:45

Forum Jump:


Users browsing this thread: 2 Guest(s)