public call back bug bug (server not starting)
#1

I'm coding a vehicle system with mysql but i get stuck with one bug i created one stock to load vehicles and the code looks alright its compiled. I put the LoadVehicles(); at ongamemodeinit and it dont't starts and if i remove it from gamemode init it starts here is my code

pawn Код:
forward LoadVehicles();
public LoadVehicles()
{

        new string[256];

        for(new i; i < MAX_VEHICLES; i++)
        {
            format(string, sizeof(string), "SELECT * FROM vehicles WHERE carid=%d", i);
            mysql_query(string);

        if(mysql_num_rows())
        {
            new row[128];
            new field[13][32]; //
            mysql_fetch_row(row, "|");
            explode(row, field, "|");
            mysql_store_result();
            mysql_free_result();
            vehicleinfo[i][id] = strval(field[1]);
            vehicleinfo[i][Model] = strval(field[2]);
            vehicleinfo[i][Color1] = strval(field[3]);
            vehicleinfo[i][Color2] = strval(field[4]);
            vehicleinfo[i][Locationx] = strval(field[5]);
            vehicleinfo[i][Locationy] = strval(field[6]);
            vehicleinfo[i][Locationz] = strval(field[7]);
            vehicleinfo[i][Angle] = strval(field[8]);
            vehicleinfo[i][Owned] = strval(field[9]);
            vehicleinfo[i][Owner] = strval(field[10]);
            vehicleinfo[i][Type] = strval(field[11]);
            vehicleinfo[i][RespawnTime] = strval(field[12]);
            CreateVehicle(vehicleinfo[i][Model],vehicleinfo[i][Locationx],vehicleinfo[i][Locationy],vehicleinfo[i][Locationz],vehicleinfo[i][Angle],vehicleinfo[i][Color1],vehicleinfo[i][Color2],vehicleinfo[i][RespawnTime]);
            printf(" Cars Loaded ");
        }
        }
}
Reply
#2

Any sugestions to solve this problem?
Reply
#3

hmmm i don't know, seems okay to me.
i sometimes had a problem like this too, everything seemed ok, but the server still only restarted every time he loaded everything. try rewriting it, that sometimes worked for me
Reply
#4

Are you sure the database;

a) connects (Print to find out)
b) exists
c) is accessible
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)