SA-MP Forums Archive
problйme lecture files - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: problйme lecture files (/showthread.php?tid=81009)



problйme lecture files - Mr_C30 - 07.06.2009

hi;

Right, then I will expose my script rather than tell you.
I'm french and speak very bad English.

at the top of my script

Код:
new model;
changed my yrace begins by opening the file. type I created without problem
Код:
public LoadRace(tmp[])
{

 	new string[256];
 	new race_name[50];
	format(race_name, sizeof(race_name), "%s.type", tmp);
	new File:gfile = fopen(race_name, io_read);
	fread(gfile, string), model = strval(string);
	fclose(gfile);


  	if(model == 0)
	{
	format(ystring,128,"[INFO]: une course a pied se prйpare!");
	return 1;
	}
	if(model == 1)
	{
	format(ystring,128,"[INFO]: une course de voiture se prйpare!");
	return 1;
	}
	if(model == 2)
	{
	format(ystring,128,"[INFO]: une course de moto se prйpare!");
	return 1;
	}


//------------------------STOP MY CHANGE
  	SendClientMessageToAll(COLOR_YELLOW,ystring);

 	new templine[512];
	format(CRaceName,sizeof(CRaceName), "%s",tmp);
	format(race_name,sizeof(race_name), "%s.yr",tmp);
	if(!fexist(race_name)) return -1; // File doesn't exist
	CFile=race_name;
  LCurrentCheckpoint=-1; RLenght=.............................................
.........
.........
.........
}


MY FILE


Код:
model=2
my problem, I not play in my cat still shows race (model = 0)






Thank you for your help; sry for my bad english (****** translation ^ ^)








Re: problйme lecture files - DjSterios - 07.06.2009

Try

Код:
if(model == 0)
	{
	format(ystring,128,"[INFO]: une course a pied se prйpare!");
	return 1;
	}
	else if(model == 1)
	{
	format(ystring,128,"[INFO]: une course de voiture se prйpare!");
	return 1;
	}
	else if(model == 2)
	{
	format(ystring,128,"[INFO]: une course de moto se prйpare!");
	return 1;
	}



Re: problйme lecture files - Mr_C30 - 07.06.2009

ok I'll try

edit:

o its not telling me "Walk" (model =0)

I think I'm wrong between string and race_name.

help my please


Re: problйme lecture files - MenaceX^ - 07.06.2009

You totaly use a wasted array, you use format(..
but you don't do nothing with, though you even return it. So you can simply do SendClientMessageToAll in each.


Re: problйme lecture files - Mr_C30 - 07.06.2009

I am consiente, TY but my problem is reading the file does not change variable: (


Re: problйme lecture files - Mr_C30 - 08.06.2009

Heo can you help me?


Re: problйme lecture files - 63Sylvain - 08.06.2009

Try

Код:
public LoadRace(tmp[])
{
	new string[256];
 	new race_name[50];
	format(race_name, sizeof(race_name), "%s.type", tmp);
	new File:gfile = fopen(race_name, io_read);

	fread(gFile, string, sizeof(string));
	model = string;

	fclose(gfile);

  	if(model == 0)
	{
		SendClientMessageToAll(COLOR_YELLOW,"[INFO]: une course a pied se prйpare!");
		return 1;
	}
	else if(model == 1)
	{
		SendClientMessageToAll(COLOR_YELLOW,"[INFO]: une course de voiture se prйpare!");
		return 1;
	}
	else if(model == 2)
	{
		SendClientMessageToAll(COLOR_YELLOW,"[INFO]: une course de moto se prйpare!");
		return 1;
	}
}



Re: problйme lecture files - Mr_C30 - 08.06.2009

(2160) : error 006: must be assigned to an array

Код:
 	new string[256];
 	new race_name[50];
	format(race_name, sizeof(race_name), "%s.type", tmp);
	new File:gfile = fopen(race_name, io_read);
	fread(gfile, string, sizeof(string));
2160:	model = string;
	fclose(gfile);



Re: problйme lecture files - Correlli - 08.06.2009

Quote:
Originally Posted by pawn-lang.pdf
Error 006: Must be assigned to an array:
String literals or arrays must be assigned to an array. This error
message may also indicate a missing index (or indices) at the array
on the right side of the “=” sign.



Re: problйme lecture files - Mr_C30 - 08.06.2009

ok I change its
Код:
 	new string[256];
 	new race_name[50];
	format(race_name, sizeof(race_name), "%s.type", tmp);
	new File:gfile = fopen(race_name, io_read);
	fread(gfile, string, sizeof(string));
	model = string[100];
	fclose(gfile);

	if(model == 0)
	{
	format(ystring,128,"[INFO]: une course a pied se prйpare!");
	return 1;
	}
	else if(model =...........
...
...
but I shall not post in games





please