07.01.2015, 22:01
Hello,
I want to use this command for : check if my name is in a file (names.txt) and if yes to add in the file "OKwrite"
The command work's I has:
1
2
1
2
1
2
3 => read
4
But the file it's no edit ( no add "OKwrite" ). Why? I believe it's "if (strfind(string, plname, true) != -1)" if i remove it. it's work but it doesn't check my name.
Regard.
I want to use this command for : check if my name is in a file (names.txt) and if yes to add in the file "OKwrite"
Код:
if (strcmp(cmd, "/test", true) ==0 )
if(IsPlayerConnected(playerid))
{
new plname[24];
GetPlayerName(playerid, plname, 24); // The name of the player
new File:file;
file = fopen("names.txt",io_readwrite);
if (file)
{
printf("1");
while(fread(file,string,sizeof(string)))
{
printf("2");
if (strfind(string, plname, true) != -1)
{
printf("3");
fwrite(file,"OKwrite");
}
}
printf("4");
fclose(file);
}
}
return 1;
}
Код:
names.txt : Name_1 Name_2 My_Name
1
2
1
2
1
2
3 => read
4
But the file it's no edit ( no add "OKwrite" ). Why? I believe it's "if (strfind(string, plname, true) != -1)" if i remove it. it's work but it doesn't check my name.
Regard.

