Server doesn't load database id correctly
#1

Hello.
So my car load system loads everything perfectly, instead of the database id of the car.
this is my code:
PHP код:
forward onPlayerCarLoad(playerid);
public 
onPlayerCarLoad(playerid)
{
    new 
num_fields,num_rows;
    new 
string 20 ];
    
cache_get_data(num_rows,num_fields,dbhandle);
    if(!
num_rows)return 1;
    for(new 
i=0i<num_rowsi++)
    {
        for(new 
0MAX_VEHICLESv++)
        {
            
cInfo[v][carmodelid]=cache_get_field_content_int(i,"model",dbhandle);
            
cInfo[v][c_x]=cache_get_field_content_float(i,"x",dbhandle);
            
cInfo[v][c_y]=cache_get_field_content_float(i,"y",dbhandle);
            
cInfo[v][c_z]=cache_get_field_content_float(i,"z",dbhandle);
            
cInfo[v][c_r]=cache_get_field_content_float(i,"a",dbhandle);
            
cInfo[v][c_color1]=cache_get_field_content_int(i,"color1",dbhandle);
            
cInfo[v][c_color2]=cache_get_field_content_int(i,"color2",dbhandle);
            
cInfo[v][c_respawntime]=cache_get_field_content_int(i,"autorespawn",dbhandle);
            
cInfo[v][carteam]=cache_get_field_content_int(i,"carteam",dbhandle);
            
cInfo[v][db_id]=cache_get_field_content_int(i,"id",dbhandle);
            
cache_get_field_content(i"plate"string);
            
format(cInfo[v][plate], 20"%s"string);
            
cache_get_field_content(i"owner"cInfo[v][carowner]);
            
cInfo[v][cnitro]=cache_get_field_content_int(i"nitro"dbhandle);
            
CreateVehicle2(v);
            
//CreateVehicle(cInfo[v][carmodelid],cInfo[v][c_x],cInfo[v][c_y],cInfo[v][c_z],cInfo[v][c_r],cInfo[v][c_color1],cInfo[v]        [c_color2],cInfo[v][c_respawntime]);
            //AddVehicleComponent(v, cInfo[v][cnitro]);
            //SetVehicleNumberPlate(v, cInfo[v][plate]);
            //SetVehicleToRespawn(v);
            
break;
        }
    }
    return 
1;

it does load this:
PHP код:
cInfo[v][carteam]=cache_get_field_content_int(i,"carteam",dbhandle); 
it doesn't load this:
PHP код:
cInfo[v][db_id]=cache_get_field_content_int(i,"id",dbhandle); 
Someone any idea why it doesn't load it?

Edit:

i also get these errors in the mysql logs:

PHP код:
[13:22:33] [WARNINGCMySQLResult::GetRowDataByName() - invalid row index ('0')
[
13:22:33] [ERRORcache_get_field_content_float invalid data type
[13:22:33] [WARNINGCMySQLResult::GetRowDataByName() - invalid row index ('0')
[
13:22:33] [ERRORcache_get_field_content_int invalid data type
[13:22:33] [WARNINGCMySQLResult::GetRowDataByName() - invalid row index ('0')
[
13:22:33] [ERRORcache_get_field_content_int invalid data type
[13:22:33] [WARNINGCMySQLResult::GetRowDataByName() - invalid row index ('0')
[
13:22:33] [ERRORcache_get_field_content_int invalid data type
[13:22:33] [WARNINGCMySQLResult::GetRowDataByName() - invalid row index ('0')
[
13:22:33] [ERRORcache_get_field_content_int invalid data type
[13:22:33] [WARNINGCMySQLResult::GetRowDataByName() - invalid row index ('0')
[
13:22:33] [ERRORcache_get_field_content_int invalid data type
[13:22:33] [WARNINGCMySQLResult::GetRowDataByName() - invalid row index ('0')
[
13:22:33] [WARNINGCMySQLResult::GetRowDataByName() - invalid row index ('0')
[
13:22:33] [WARNINGCMySQLResult::GetRowDataByName() - invalid row index ('0')
[
13:22:33] [ERRORcache_get_field_content_int invalid data type 
Reply
#2

PHP код:
forward onPlayerCarLoad(playerid);
public 
onPlayerCarLoad(playerid)
{
    new 
num_fields,num_rows;
    new 
string 20 ];
    
cache_get_data(num_rows,num_fields,dbhandle);
    if(!
num_rows)return 1;
    for(new 
i=0i<num_rowsi++)
    {
        for(new 
0MAX_VEHICLESv++)
        {
            
cInfo[v][carmodelid]=cache_get_field_content_int(i,"model",dbhandle);
            
cInfo[v][c_x]=cache_get_field_content_float(i,"x",dbhandle);
            
cInfo[v][c_y]=cache_get_field_content_float(i,"y",dbhandle);
            
cInfo[v][c_z]=cache_get_field_content_float(i,"z",dbhandle);
            
cInfo[v][c_r]=cache_get_field_content_float(i,"a",dbhandle);
            
cInfo[v][c_color1]=cache_get_field_content_int(i,"color1",dbhandle);
            
cInfo[v][c_color2]=cache_get_field_content_int(i,"color2",dbhandle);
            
cInfo[v][c_respawntime]=cache_get_field_content_int(i,"autorespawn",dbhandle);
            
cInfo[v][carteam]=cache_get_field_content_int(i,"carteam",dbhandle);
            
cInfo[v][db_id]=i;
            
cache_get_field_content(i"plate"string);
            
format(cInfo[v][plate], 20"%s"string);
            
cache_get_field_content(i"owner"cInfo[v][carowner]);
            
cInfo[v][cnitro]=cache_get_field_content_int(i"nitro"dbhandle);
            
CreateVehicle2(v);
            
//CreateVehicle(cInfo[v][carmodelid],cInfo[v][c_x],cInfo[v][c_y],cInfo[v][c_z],cInfo[v][c_r],cInfo[v][c_color1],cInfo[v]        [c_color2],cInfo[v][c_respawntime]);
            //AddVehicleComponent(v, cInfo[v][cnitro]);
            //SetVehicleNumberPlate(v, cInfo[v][plate]);
            //SetVehicleToRespawn(v);
        
}
        break;
    }
    return 
1;

changed into this, still doesn't work.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)