Sistema de vehнculos
#1

Buenas, he puesto un sistema de vehнculos en mi GM hecho desde cero, copiбndolo del de "The Godfather", he copiado algunas cosas para ver si servнa, no da ningъn error, pero los vehнculos no aparecen.

Al principio del server:
Код:
forward CargarCoches();

enum InfoCoche
{
	Modelo,
	Float:Posicionx,
	Float:Posiciony,
	Float:Posicionz,
	ColorUno
};
new Coche[2][InfoCoche];
En OnGameModeInit:
Код:
for(new h = 0; h < sizeof(Coche); h++)
	{
			CreateVehicle(Coche[h][Modelo],Coche[h][Posicionx],Coche[h][Posiciony],Coche[h][Posicionz],180,Coche[h][ColorUno],16,0);
	}
La callback de CargarCoches:
Код:
public CargarCoches()
{
	new arrCoords[5][64];
	new strFromFile2[256];
	new File: file = fopen("Coches/cars.cfg", io_read);
	if (file)
	{
		new idx;
		while (idx < sizeof(Negocio))
		{
			fread(file, strFromFile2);
			split(strFromFile2, arrCoords, ',');
			Coche[idx][Modelo] = strval(arrCoords[0]);
			Coche[idx][Posicionx] = floatstr(arrCoords[1]);
			Coche[idx][Posiciony] = floatstr(arrCoords[2]);
			Coche[idx][Posicionz] = floatstr(arrCoords[3]);
			Coche[idx][ColorUno] = strval(arrCoords[4]);
			
			idx++;
		}
		fclose(file);
	}
	return 1;
}
En la parte para se guarden los coches es esta, dentro de la callback "GuardarCosas", tambiйn se guardan ahн las casas y los negocios, no dan problemas:
Код:
idx = 0;
    while (idx < sizeof(Coche))
    {
        new coordsstring[256];
        format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%d\n",
        Coche[idx][Modelo],
        Coche[idx][Posicionx],
        Coche[idx][Posiciony],
        Coche[idx][Posicionz],
		Coche[idx][ColorUno]);

        if(idx == 0)
        {
            file2 = fopen("Coches/cars.cfg", io_write);
        }
        else
        {
            file2 = fopen("Coches/cars.cfg", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);
    }


Gracias de antemano.
Reply


Messages In This Thread
Sistema de vehнculos - by ib95 - 29.11.2014, 21:47
Respuesta: Sistema de vehнculos - by jwalker - 30.11.2014, 03:35
Re: Sistema de vehнculos - by ib95 - 30.11.2014, 10:09
Respuesta: Sistema de vehнculos - by OTACON - 30.11.2014, 13:07
Re: Sistema de vehнculos - by ib95 - 30.11.2014, 14:42
Respuesta: Sistema de vehнculos - by OTACON - 30.11.2014, 17:05
Respuesta: Re: Sistema de vehнculos - by jwalker - 30.11.2014, 17:52
Re: Respuesta: Re: Sistema de vehнculos - by ib95 - 30.11.2014, 18:24
Respuesta: Sistema de vehнculos - by hotspicytaco - 30.11.2014, 18:38
Re: Respuesta: Sistema de vehнculos - by ib95 - 30.11.2014, 19:27

Forum Jump:


Users browsing this thread: 3 Guest(s)