I currently have this... As you can see it takes information from the file to create the vehicles. The problem is the loop.
It only creates the first vehicle on the list and even so, the vehicle ID it takes is messed up... The #define MAX_VEHS is at 200.
pawn Код:
for(new i = 0; i < MAX_VEHS; i++)
{
new Float:X, Float:Y, Float:Z, Float:A, color1, color2, model;
new veh[5], get_veh[128], pos;
for(new v = 0; v < 7; v++)
{
format(veh, sizeof(veh), "%d", i);
format(get_veh, sizeof(get_veh), "%s", dini_Get("vehs", veh));
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
if(v == 0)
{
pos = strfind(get_veh, " ", true);
strdel(get_veh, pos, strlen(get_veh));
X = strval(get_veh);
}
if(v == 1)
{
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, pos, strlen(get_veh));
Y = strval(get_veh);
}
if(v == 2)
{
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, pos, strlen(get_veh));
Z = strval(get_veh);
}
if(v == 3)
{
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
A = strval(get_veh);
}
if(v == 4)
{
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
color1 = strval(get_veh);
}
if(v == 5)
{
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
color2 = strval(get_veh);
}
if(v == 6)
{
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
pos = strfind(get_veh, " ", true);
strdel(get_veh, 0, pos + 1);
model = strval(get_veh);
}
}
Cars[i] = CreateVehicle(model, X, Y, Z, A, color1, color2, -1);
}