19.04.2012, 08:44
Alright, this is the hole code.
pawn Код:
new vmods[MAX_VEHICLES][MAX_VEH_MODS]
stock Load_Pvehs(playerid){
new modelid[5], x[20], y[20], z[20], a[20], color1[5], color2[5], car, plate[20], query[200], vmod[12];
format(query, sizeof(query), "SELECT * FROM `private_veh` WHERE `name` LIKE '%s' LIMIT 1", pname);
GetPlayerName(playerid, pname, sizeof(pname));
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() != 0){
while(mysql_fetch_row(query)){
mysql_fetch_field_row(modelid, "modelid");
mysql_fetch_field_row(x, "spawn_x");
mysql_fetch_field_row(y, "spawn_y");
mysql_fetch_field_row(z, "spawn_z");
mysql_fetch_field_row(a, "angle");
mysql_fetch_field_row(color1, "color1");
mysql_fetch_field_row(color2, "color2");
mysql_fetch_field_row(plate, "plate");
mysql_fetch_field_row(vmod[0], "mod1"); mysql_fetch_field_row(vmod[1], "mod2"); mysql_fetch_field_row(vmod[2], "mod3"); mysql_fetch_field_row(vmod[3], "mod4");
mysql_fetch_field_row(vmod[4], "mod5"); mysql_fetch_field_row(vmod[5], "mod6"); mysql_fetch_field_row(vmod[6], "mod7"); mysql_fetch_field_row(vmod[7], "mod8");
mysql_fetch_field_row(vmod[8], "mod9"); mysql_fetch_field_row(vmod[9], "mod10"); mysql_fetch_field_row(vmod[10], "mod11"); mysql_fetch_field_row(vmod[11], "mod12");
vmods[car][0] = strval(vmod[0]); vmods[car][1] = strval(vmod[1]); vmods[car][2] = strval(vmod[2]); vmods[car][3] = strval(vmod[3]); vmods[car][4] = strval(vmod[4]);
vmods[car][5] = strval(vmod[5]); vmods[car][6] = strval(vmod[6]); vmods[car][7] = strval(vmod[7]); vmods[car][8] = strval(vmod[8]); vmods[car][9] = strval(vmod[9]);
vmods[car][10] = strval(vmod[10]); vmods[car][11] = strval(vmod[11]);
car = AddStaticVehicle(strval(modelid), floatstr(x), floatstr(y), floatstr(z), floatstr(a), strval(color1), strval(color2));
SetVehicleNumberPlate(car, plate);
for(new i = 0; i < 12; ++i){
AddVehicleComponent(car, vmods[car][i]);
new string[126];
format(string, sizeof(string), "VehID: %i , compo: %i", car, vmods[car][i]);
SendClientMessage(playerid, -1, string);
}
total_private_vehicles[car]++;
format(query, sizeof(query), "UPDATE `private_veh` SET `vid` = %i WHERE `name` LIKE '%s' LIMIT 1", car, pname);
mysql_query(query);
}
}
mysql_free_result();
return 1;
}