problйme lecture files
#1

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 ^ ^)





Reply
#2

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;
	}
Reply
#3

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
Reply
#4

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.
Reply
#5

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

Heo can you help me?
Reply
#7

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;
	}
}
Reply
#8

(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);
Reply
#9

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.
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)