01.01.2015, 13:54
pawn Код:
mysql_format(MySQLConnect, query, 1024, "INSERT INTO `vehs` (`ModelID`, `PosX`, `PosY`, `PosZ`, `PosA`, `Couleur1`, `Couleur2`) VALUES (%d, '%f', '%f', '%f', '%f', %d, %d)", VehInfo[entry][ModelID], VehInfo[entry][Pos][0], VehInfo[entry][Pos][1], VehInfo[entry][Pos][2], VehInfo[entry][Pos][3], couleur1, couleur2);
mysql_tquery(MySQLConnect, query, "OnVehicleCreated", "i", entry);
now on The "OnVehicleCreated" Callback part:
pawn Код:
forward OnVehicleCreated(entry);
public OnVehicleCreated(entry)
{
VehInfo[entry][VID] = cache_insert_id(); // here, we set the vehicle id in this variable, and the mysql VID field, which we're gonna add later.
printf("%i", VehInfo[entry][VID]); // debugging.
}
After launching your XAMP program to start the localhost to access the mysql database, go to vehicles table,
and Add a new field called "VID" , In index, (while you are creating it) , put "PRIMARY", and enable "A_I", that's required for a UID in every MySQL table.
an example in this tut: https://sampforum.blast.hk/showthread.php?tid=485633 , look at the 8th picture.
now you are done, check mysql_log.txt for any notices / errors returned.