02.08.2013, 13:19
Anything, wrong with this code?
if i open the samp-server.exe, the server close, but if don't have any rows, the samp continues, anything wrong?
if i open the samp-server.exe, the server close, but if don't have any rows, the samp continues, anything wrong?
pawn Код:
stock CarregarCasas()
{
new DBResult:Consulta = db_query(Users, "SELECT * FROM `CASA`");
new rows = db_num_rows(Consulta);
if(!rows) return print("Nгo tem casas para serem carregadas");
for(new i; i < rows; i++);
{
db_get_field_assoc(Consulta, "NOME", CasaInfo[i][NOME], 100);
db_get_field_assoc(Consulta, "PRECO", str, 15);
CasaInfo[i][PRECO] = strval(str);
db_get_field_assoc(Consulta, "LEVEL", str, 4);
CasaInfo[i][LEVEL] = strval(str);
printf("Level: %d",CasaInfo[i][LEVEL]);
db_get_field_assoc(Consulta, "DONO", CasaInfo[i][DONO], 24);
printf("Dono: %s", CasaInfo[i][DONO]);
db_get_field_assoc(Consulta, "ENTRADAX", str, 15);
CasaInfo[i][POSICAO][0] = floatstr(str);
printf("X: %f", floatstr(str));
db_get_field_assoc(Consulta, "ENTRADAY", str, 15);
CasaInfo[i][POSICAO][1] = floatstr(str);
printf("Y: %f", floatstr(str));
db_get_field_assoc(Consulta, "ENTRADAZ", str, 15);
CasaInfo[i][POSICAO][2] = floatstr(str);
printf("Z: %f", floatstr(str));
CasaInfo[i][CHECK][0] = CreateDynamicCP(CasaInfo[i][POSICAO][0], CasaInfo[i][POSICAO][1], CasaInfo[i][POSICAO][2], 1.0);
if(CasaInfo[i][LEVEL] == 1)
{
CasaInfo[i][SAIDA][0] = 223.1482;
CasaInfo[i][SAIDA][1] = 1287.8635;
CasaInfo[i][SAIDA][2] = 1082.1406;
CasaInfo[i][INTERIOR] = 1;
CasaInfo[i][CHECK][1] = CreateDynamicCP(CasaInfo[i][SAIDA][0], CasaInfo[i][SAIDA][1], CasaInfo[i][SAIDA][2], 1.0, 15500000+casaid, CasaInfo[i][INTERIOR]);
}
if(!CasaInfo[i][DONO][0]) format(str, sizeof(str), "Propiedade: %s \n Preзo:$%d \n Nivel: %d", CasaInfo[i][NOME], CasaInfo[i][PRECO], CasaInfo[casaid][LEVEL]);
else if(CasaInfo[i][DONO][0] != 0) format(str, sizeof(str), "Propiedade: %s \n Dono: %s", CasaInfo[i][NOME], CasaInfo[i][DONO]);
CasaInfo[i][LABEL] = CreateDynamic3DTextLabel(str, -1, CasaInfo[i][POSICAO][0], CasaInfo[i][POSICAO][0], CasaInfo[i][POSICAO][0] + 0.5, 10.0);
//SetarDono(CasaInfo[i][NOME], CasaInfo[i][DONO], i);
casaid++;
db_next_row(Consulta);
}
db_free_result(Consulta);
printf("Fields: %d", db_num_fields(Consulta));
printf("%d Casas Carregadas!", rows);
return true;
}