title.
code:
code:
PHP Code:
forward onPlayerCarLoad(playerid);
public onPlayerCarLoad(playerid)
{
new num_fields,num_rows;
new temp_carowner[35],temp_plate[50];
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", temp_plate);
cache_get_field_content(id, "owner", temp_carowner);
format(cInfo[id][plate],30,"%s",temp_plate);
format(cInfo[id][carowner],35,"%s",temp_carowner);
CreateVehicle(cInfo[id][carmodelid],cInfo[id][c_x],cInfo[id][c_y],cInfo[id][c_z],cInfo[id][c_r],cInfo[id][c_color1],cInfo[id][c_color2],cInfo[id][c_respawntime]);
cInfo[id][cnitro]=cache_get_field_content_int(i,"nitro",dbhandle);
AddVehicleComponent(id,cInfo[id][cnitro]);
SetVehicleNumberPlate(id,cInfo[id][plate]);
}
return 1;
}
loadPlayerCars(playerid)
{
new query[128],name[35];
GetPlayerName(playerid,name,35);
format(query,sizeof(query),"SELECT * FROM vehicles WHERE owner='%s'",name);
mysql_function_query(dbhandle,query,true,"onPlayerCarLoad","i",playerid);
}