14.11.2015, 21:14
En OngaMemodeInit, algo asi:
Luego la funciуn:
Serнa algo asн, adaptalo a tus variables.
pawn Код:
mysql_format(mysql, query, sizeof(query), "SELECT * FROM `vehiculos` ORDER BY ID ASC");
mysql_tquery(mysql, query, "CargarCoches", "i", playerid);
Luego la funciуn:
pawn Код:
stock CargarCoches()
{
new rows, fields, propietario[25], placa[10], contenido[128];
cache_get_data(rows, fields, mysql);
CochesCargados = 0;
if(rows)
{
for(new i = 1; i < rows; i++)
{
cache_get_field_content(i, "ID", contenido); Auto[i][aID] = strval(contenido);
new e = Auto[i][aID];
cache_get_field_content(i, "IDPropietario", contenido); Auto[e][aIDPropietario] = strval(contenido);
cache_get_field_content(i, "Propietario", propietario, 25);
cache_get_field_content(i, "Faccion", contenido); Auto[e][aFaccion] = strval(contenido);
cache_get_field_content(i, "X", contenido); Auto[e][aX] = floatstr(contenido);
cache_get_field_content(i, "Y", contenido); Auto[e][aY] = floatstr(contenido);
cache_get_field_content(i, "Z", contenido); Auto[e][aZ] = floatstr(contenido);
Auto[i][aigID] = CreateVehicle(Auto[e][aModelo], Auto[e][aX],Auto[e][aY], Auto[e][aZ],Auto[e][aAngulo], Auto[e][aColor1], Auto[e][aColor2], 7200);
Auto[Auto[i][aID]][aigID2] = Auto[i][aigID];
SetVehicleVirtualWorld(Auto[i][aigID], Auto[e][aVW]);
LinkVehicleToInterior(Auto[i][aigID], Auto[e][aInterior]);
SetVehicleNumberPlate(Auto[i][aigID], placa);
SetVehicleHealth(Auto[i][aigID], Auto[e][aVida]);
Auto[i][aGasolina] = 100;
CochesCargados++;
}
printf("* Se cargaron %d coches.", CochesCargados);
}
else print(" No hay coches para cargar.");
}
Serнa algo asн, adaptalo a tus variables.

