[Ajuda] Carregar carros salvos em DOF2 - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (
https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Carregar carros salvos em DOF2 (
/showthread.php?tid=587647)
Carregar carros salvos em DOF2 -
Glodrak - 01.09.2015
Olб, estou tentando criar automaticamente todos os carros prуprios do meu servidor ao abrir o GM, mas nгo estou conseguindo :/
Estou tentando fazer da seguinte forma:
Код:
for(new Lp=0; Lp < MaxCars; Lp++)
{
if(DOF2_FileExists(CarroFile))
{
format(CarroFile, sizeof(CarroFile), "Carros/%i.ini", Lp);
AddStaticVehicle(DOF2_GetInt(CarroFile, "Modelo"), DOF2_GetInt(CarroFile, "x"), DOF2_GetInt(CarroFile, "y"), DOF2_GetInt(CarroFile, "z"), DOF2_GetInt(CarroFile, "a"), DOF2_GetInt(CarroFile, "Cor1"), DOF2_GetInt(CarroFile, "Cor2"));
}
}
Acho que nгo estou conseguindo "chamar" o arquivo correto, alguйm pode me ajudar com isso?
OBS: Os carros foram salvos na pasta "Carros", e com os nomes em ordem crescente (0.ini, 1.ini, 2.ini...).
Re: Carregar carros salvos em DOF2 -
[BOPE]Seu._.Madruga - 01.09.2015
PHP код:
#define MAX_CARS 100
#define PASTA_CARROS "Carros/%d.ini"
new SVCARRO[MAX_CARS];
public OnGameModeInit()
{
new file[155];
for(new i = 0; i < MAX_CARS; i++)
{
format(file, sizeof(file), PASTA_CARROS, i);
if(DOF2_FileExists(file))
{
SVCARRO[i] = CreateVehicle(DOF2_GetInt(file, "Modelo"), DOF2_GetFloat(file, "x"), DOF2_GetFloat(file, "y"), DOF2_GetFloat(file, "z"), DOF2_GetFloat(file, "a"), DOF2_GetInt(file, "Cor1"), DOF2_GetInt(file, "Cor2"), 999999);
}
}
return 1;
}
Re: Carregar carros salvos em DOF2 -
Glodrak - 01.09.2015
Muito obrigado, amigo! deu certinho aqui.