Regarding Loading
#1

This code crashes my OnGameModeInit. I have no idea what's wrong with it, but any help would be appreciated.

pawn Код:
public LoadVehicleExtras()
{
    printf("Loading Vehicle Extras...");
    new resultline[300];
   
    mysql_query("SELECT * FROM `vehicle_extras` ORDER BY `model` ASC");
    mysql_store_result();
   
    new modelid;
    new tmpmodel;
    new arr[4];
   
    while(mysql_fetch_row(resultline)==1)
    {
        if(!sscanf(resultline, "p<|>a<i>[4]", arr))
        {
            modelid = arr[0];
            if(modelid < 400) continue;
            tmpmodel = modelid-400;
            VehicleExtraInfo[tmpmodel][vxModel] = modelid;
            VehicleExtraInfo[tmpmodel][vxBasePrice] = arr[1];
            VehicleExtraInfo[tmpmodel][vxMaxTrunks] = arr[2];
            VehicleExtraInfo[tmpmodel][vxMaxSold] = arr[3];
        }
        else
        {
            print("Error: There was a problem parsing vehicle extra data! Moving to next result.");
        }
    }
    mysql_free_result();
    return 1;
}
Reply
#2

nvm, i have no idea.
Reply
#3

That's fine. Does anybody know?
Reply
#4

I don't know MySQL but 1 question. Do you have sscanf 2.0?
Reply
#5

I believe so, it's the plugin version.
Reply
#6

Try this:
pawn Код:
public LoadVehicleExtras()
{
    printf("Loading Vehicle Extras...");
    new resultline[300];

    mysql_query("SELECT * FROM `vehicle_extras` ORDER BY `model` ASC");
    mysql_store_result();

    new modelid;
    new tmpmodel;
    new arr[4];

    if(mysql_num_rows() > 0)
    {
        while(mysql_fetch_row_format(resultline, "|"))
        {
            sscanf(resultline, "p<|>iiii", arr[0], arr[1], arr[2], arr[3]);
           
            modelid = arr[0];
            if(modelid < 400) continue;
           
            tmpmodel - modelid-400;
            VehicleExtraInfo[tmpmodel][vxModel] = modelid;
            VehicleExtraInfo[tmpmodel][vxBasePrice] = arr[1];
            VehicleExtraInfo[tmpmodel][vxMaxTrunks] = arr[2];
            VehicleExtraInfo[tmpmodel][vxMaxSold] = arr[3];
        }
    }
    else
    {
        print("No rows could be retrieved!");
    }
    mysql_free_result();
    return 1;
}
Reply
#7

I'll try it, however the mysql log shows that it is retrieving all the information from the table..
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)