31.05.2016, 12:44
i kind of re-coded it.
this is my new code.
still doesn't work tho.
this is my new code.
still doesn't work tho.
PHP код:
getFreeCarID()
{
for(new i=0; i<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=0; i<num_rows; i++)
{
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;
}