SA-MP Forums Archive
Database help. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Database help. (/showthread.php?tid=340859)



Database help. - Cyniic - 08.05.2012

Recently, I implemented a vehicle script into a VX:RP gamemode, however when there is a GMX or samp-server.exe closes, the vehicles do not save into the database file.

If you can help, please PM me, and we'll go from there. Thanks.


Re: Database help. - Cyniic - 10.05.2012

Is no one able to help me with this issue? I have no problem sending code through PMs. It's restricting us from doing updates as every time we do we have to refund everyone for their cars.


Re: Database help. - Elysian` - 10.05.2012

Well show us the code and what saving system are you using?

We cannot help you if you do not show us any.


Re: Database help. - Cyniic - 10.05.2012

Quote:
Originally Posted by Windows32
View Post
Well show us the code and what saving system are you using?

We cannot help you if you do not show us any.
Here's my SaveVehicle stock.

pawn Code:
stock SaveVehicle(sqlid)
{
    new query[1500], idx = GetVIndex(sqlid);
    format(query, sizeof(query), "UPDATE vehicles SET model = '%d' , color1 = '%d' , color2 = '%d' , groupid = '%d' , jobid = '%d' , owner = '%s' , vname = '%s', respawn = '%d', x = '%f', y = '%f', z = '%f', angle = '%f'",
    Veh[idx][Model], Veh[idx][Color1], Veh[idx][Color2], Veh[idx][Group], Veh[idx][Job], Veh[idx][Owner], Veh[idx][VName] ,Veh[idx][Respawn], Veh[idx][vX], Veh[idx][vY], Veh[idx][vZ], Veh[idx][vAngle]);
   
    format(query, sizeof(query), "%s,interior = '%d', virtualworld = '%d', plate = '%s', mod0 = '%d', mod1 = '%d', mod2 = '%d', mod3 = '%d', mod4 = '%d', mod5 = '%d', mod6 = '%d', mod7 = '%d', mod8 = '%d', mod9 = '%d'",
    query ,Veh[idx][vInt], Veh[idx][vVWorld], Veh[idx][Plate], Veh[idx][Mod0], Veh[idx][Mod1], Veh[idx][Mod2], Veh[idx][Mod3], Veh[idx][Mod4], Veh[idx][Mod5], Veh[idx][Mod6], Veh[idx][Mod7], Veh[idx][Mod8], Veh[idx][Mod9]);
   
    format(query, sizeof(query), "%s, mod10 = '%d', mod11 = '%d', mod12 = '%d', mod13 = '%d', paintjob = '%d', weapon1 = '%d', weapon2 = '%d', weapon3 = '%d', vip = '%d', lockstate = '%d', health = '%f', spawnstate = '%d', fuel = '%d'",
    query, Veh[idx][Mod10], Veh[idx][Mod11], Veh[idx][Mod12], Veh[idx][Mod13], Veh[idx][PaintJob], Veh[idx][Weapons][0], Veh[idx][Weapons][1], Veh[idx][Weapons][2], Veh[idx][VIP], Veh[idx][lockState], Veh[idx][vHealth],Veh[idx][spawnState],Veh[idx][Fuel]);
   
    format(query, sizeof(query), "%s WHERE sqlid = '%d'", query ,sqlid);

    db_query(vehicle_db, query);
    return query;
}
It's supposed to save to a local file named 'Vehicles" Which is in a database file format.