07.06.2011, 04:51
Eu queria saber como fazer pra checar antes de carregar um arquivo pq tp, minha conce ta tentando carregar arquivos que nгo existem, e eu percebi que antes n fazia isso e do nada comeзou a fazer (dps q eu paguei pra um cara fazer um sistema no meu GM, engraзado nй??) mas enfim, preciso de ajuda urgentemente!!!
Quem me ajudar dou um beijo
pawn Код:
public LoadPlayerVehicle(playerid)
{
new openfile[128];
format(openfile, sizeof openfile, VEH_SAVE_FILE, GetName(playerid));
printf("Nome do Arquivo: %s", openfile);
if (!fexist(openfile)) return 1;
print("Carregando Veiculo");
new File:vehs = fopen(openfile,io_read);
new string[256];
new load[30][32];
new newload = 15;
if (vehs)
{
print("Arquivo");
while (fread(vehs, string, 256))
{
split(string, load, '|');
print("Colocando Veiculos...");
new v = INVALID_VEHICLE_ID;
if (strval(load[11]) == 1)
{
v = CreateVehicle(
strval(load[0]),
floatstr(load[12]),
floatstr(load[13]),
floatstr(load[14]),
floatstr(load[15]),
strval(load[5]),
strval(load[6]),
RESPAWN_TIME
);
}
else
{
v = CreateVehicle(
strval(load[0]),
floatstr(load[1]),
floatstr(load[2]),
floatstr(load[3]),
floatstr(load[4]),
strval(load[5]),
strval(load[6]),
RESPAWN_TIME
);
}
printf("Carro Spawn: %d", v);
VehicleInfo[v][vModel] = strval(load[0]);
VehicleInfo[v][vX] = floatstr(load[1]);
VehicleInfo[v][vY] = floatstr(load[2]);
VehicleInfo[v][vZ] = floatstr(load[3]);
VehicleInfo[v][vA] = floatstr(load[4]);
VehicleInfo[v][vColor1] = strval(load[5]);
VehicleInfo[v][vColor2] = strval(load[6]);
VehicleInfo[v][vPaintjob] = strval(load[7]);
printf("Nome: %s", load[8]);
strmid(VehicleInfo[v][vName], load[8], 0, strlen(load[8]), 128);
printf("Proprietario: %s", load[9]);
strmid(VehicleInfo[v][vOwner], load[9], 0, strlen(load[9]), MAX_PLAYER_NAME);
VehicleInfo[v][vLock] = strval(load[10]);
VehicleInfo[v][vPark] = strval(load[11]);
VehicleInfo[v][vPX] = floatstr(load[12]);
VehicleInfo[v][vPY] = floatstr(load[13]);
VehicleInfo[v][vPZ] = floatstr(load[14]);
VehicleInfo[v][vPA] = floatstr(load[15]);
for(new m = 0; m < MAX_MODS; m++)
{
newload++;
VehicleInfo[v][vMod][m] = strval(load[newload]);
}
for(new m = 0; m < MAX_MODS; m++)
{
if (VehicleInfo[v][vMod][m] > 0)
{
AddVehicleComponent(v,VehicleInfo[v][vMod][m]);
}
}
if (VehicleInfo[v][vPaintjob] > -1)
{
ChangeVehiclePaintjob(v,VehicleInfo[v][vPaintjob]);
}
MAX_VEH_SPAWNED++;
break;
}
fclose(vehs);
}
return 1;
}