27.08.2017, 08:14
Код:
SaveVehicleCarToy(carid, toyidx, update) { if(update) { format(query, sizeof(query), "UPDATE `playercartoys` SET `X` = %f, `Y` = %f, `Z` = %f, `RX` = %f, `RY` = %f, `RZ` = %f WHERE `id` = %d",VehicleCarToys[carid][toyidx][EVehCarToy_X],VehicleCarToys[carid][toyidx][EVehCarToy_Y],VehicleCarToys[carid][toyidx][EVehCarToy_Z],VehicleCarToys[carid][toyidx][EVehCarToy_RX],VehicleCarToys[carid][toyidx][EVehCarToy_RY],VehicleCarToys[carid][toyidx][EVehCarToy_RZ],VehicleCarToys[carid][toyidx][EVehCarToy_SQLID]); } else { format(query, sizeof(query), "INSERT INTO `playercartoys` SET `X` = %f, `Y` = %f, `Z` = %f, `RX` = %f, `RY` = %f, `RZ` = %f, `carid` = %d, `toyidx` = %d",VehicleCarToys[carid][toyidx][EVehCarToy_X],VehicleCarToys[carid][toyidx][EVehCarToy_Y],VehicleCarToys[carid][toyidx][EVehCarToy_Z],VehicleCarToys[carid][toyidx][EVehCarToy_RX],VehicleCarToys[carid][toyidx][EVehCarToy_RY],VehicleCarToys[carid][toyidx][EVehCarToy_RZ],GetVehicleSQLID(carid),VehicleCarToys[carid][toyidx][EVehCarToy_ToyIdx]); } mysql_function_query(g_mysql_handle, query, true, "OnSaveCarToy", "ddd", carid, toyidx, update); } forward OnSaveCarToy(carid, toyidx, update); public OnSaveCarToy(carid, toyidx, update) { new id = mysql_insert_id(); if(!update) { VehicleCarToys[carid][toyidx][EVehCarToy_SQLID] = id; } }