cars don't load properly
#4

i kind of re-coded it.
this is my new code.
still doesn't work tho.
PHP код:
getFreeCarID()
{
    for(new 
i=0i<sizeof(cInfo); i++)
    {
    if(
cInfo[i][id_x]==0)return i;
    }
    return 
1;
}

forward onPlayerCarLoad(playerid);
public 
onPlayerCarLoad(playerid)
{
new 
num_fields,num_rows;
cache_get_data(num_rows,num_fields,dbhandle);
if(!
num_rows)return 1;
 for(new 
i=0i<num_rowsi++)
 {
  new 
id=getFreeCarID();
  
cInfo[id][carmodelid]=cache_get_field_content_int(id,"model",dbhandle);
  
cInfo[id][c_x]=cache_get_field_content_float(id,"x",dbhandle);
  
cInfo[id][c_y]=cache_get_field_content_float(id,"y",dbhandle);
  
cInfo[id][c_z]=cache_get_field_content_float(id,"z",dbhandle);
  
cInfo[id][c_r]=cache_get_field_content_float(id,"a",dbhandle);
  
cInfo[id][c_color1]=cache_get_field_content_int(id,"color1",dbhandle);
  
cInfo[id][c_color2]=cache_get_field_content_int(id,"color2",dbhandle);
  
cInfo[id][c_respawntime]=cache_get_field_content_int(id,"autorespawn",dbhandle);
  
cInfo[id][carteam]=cache_get_field_content_int(id,"carteam",dbhandle);


cache_get_field_content(id"plate"cInfo[id][plate]);
cache_get_field_content(id"owner"cInfo[id][carowner]);

CreateVehicle2(id);

}
return 
1;
}
stock CreateVehicle2(vehicleid)
{
    
cInfo[vehicleid][data1337] = CreateVehicle(cInfo[vehicleid][carmodelid], cInfo[vehicleid][c_x], cInfo[vehicleid][c_y], cInfo[vehicleid][c_z], cInfo[vehicleid][c_r], cInfo[vehicleid][c_color1], cInfo[vehicleid][c_color2], cInfo[vehicleid][c_respawntime]);
    
SetVehicleNumberPlate(cInfo[vehicleid][data1337], cInfo[vehicleid][plate]);
    
AddVehicleComponent(cInfo[vehicleid][data1337], cInfo[vehicleid][cnitro]);
    
SetVehicleToRespawn(vehicleid);
    return 
1;

Reply


Messages In This Thread
cars don't load properly - by justjamie - 31.05.2016, 11:35
Re: cars don't load properly - by Dayrion - 31.05.2016, 12:17
Re: cars don't load properly - by justjamie - 31.05.2016, 12:34
Re: cars don't load properly - by justjamie - 31.05.2016, 12:44
Re: cars don't load properly - by justjamie - 31.05.2016, 12:59

Forum Jump:


Users browsing this thread: 2 Guest(s)