20.01.2011, 19:06
Hi,
I have in my GM a file "test.txt" within some names. This file is called in OnPlayerConnect
Alex_Green
John_Smith
.
.
.
I want to create a commande who replace a name with another.
My code is:
Example I want to remplace John_Smith by Will_Black with this code it check John_Smith but dont delete this name just add Will_Black In the end.
I know my code don't replace but I don't know how to make.
Thank to help.
I have in my GM a file "test.txt" within some names. This file is called in OnPlayerConnect
Alex_Green
John_Smith
.
.
.
I want to create a commande who replace a name with another.
My code is:
Код:
gpname = old name
tmp = new name
file = fopen("test.txt", io_readwrite); // open the file, read and write
while(fread(file,openf,sizeof(openf)))
{
if (strfind(openf, gpname, true) != -1) search a name
{
strmid(gpname, tmp, 0, strlen(tmp), 255); replace this name by a new name
format(string, 256, "%s",tmp);
}
}
fwrite(file, string); //write
fclose(file);
I know my code don't replace but I don't know how to make.
Thank to help.

