16.05.2011, 00:30
Attempt to save the coordinates when get off the car. Are saved but when I restart the server the cars appear disorderly, where is the error?
Sorry for my English
Sorry for my English
Код:
OnPlayerExitVehicle(playerid,vehicleid) { new idcoche; idcoche = GetPlayerVehicle (playerid); new Float:x,Float:y,Float:z, Float:angulo; GetVehiclePos(idcoche, x, y, z); GetVehicleZAngle(idcoche, angulo); CarInfo[idcoche][cLocationx]=x; CarInfo[idcoche][cLocationy]=y; CarInfo[idcoche][cLocationz]=z; CarInfo[idcoche][cAngle] = angulo; GuardarCoordenadasCoche(idcoche); } GuardarCoordenadasCoche(idx) { //new tmp[128]; new sql[2048]; format(sql, sizeof(sql), "UPDATE cars SET X=%f,Y=%f,Z=%f,A=%f WHERE `id`=%d", CarInfo[idx][cLocationx], CarInfo[idx][cLocationy], CarInfo[idx][cLocationz], CarInfo[idx][cAngle], CarInfo[idx][cSQLID]); mysql_query(sql); return 1; }