08.02.2010, 19:12
Thank you very muck
It works
Now with this :
It's harder because of the split with ','
I should apply the precedent method? Or not?
It works
Now with this :
Код:
stock CreatePlayer(playerid)
{
new fname[256],playername[256],filestring[256];
new SplitDiv[99][V_LIMIT];
new File: file;
GetPlayerName(playerid, playername, sizeof(playername));
format(fname,sizeof(fname),P_FILE,udb_encode(playername));
file = fopen(fname, io_write);
if(file) {
format(filestring,sizeof(filestring),"%s,0,0,%d,1",playername,PlayerInfo[playerid][pass],PlayerInfo[playerid][pcash],PlayerInfo[playerid][phone],PlayerInfo[playerid][niveau]);
fwrite(file,filestring);
fclose(file);
}
file = fopen(fname, io_read);
if (file) {
fread(file, filestring);
split(filestring, SplitDiv, ',');
strmid(PlayerInfo[playerid][name], SplitDiv[0], 0, strlen(SplitDiv[0]), 255);
PlayerInfo[playerid][vowned] = strval(SplitDiv[1]);
PlayerInfo[playerid][vowner] = strval(SplitDiv[2]);
PlayerInfo[playerid][pass] = strval(SplitDiv[3]);
PlayerInfo[playerid][pcash] = strval(SplitDiv[4]);
PlayerInfo[playerid][bank] = strval(SplitDiv[5]);
PlayerInfo[playerid][admin] = strval(SplitDiv[6]);
PlayerInfo[playerid][bowner] = strval(SplitDiv[7]);
PlayerInfo[playerid][bowned] = strval(SplitDiv[8]);
PlayerInfo[playerid][phone] = strval(SplitDiv[9]);
PlayerInfo[playerid][phonenr] = strval(SplitDiv[10]);
PlayerInfo[playerid][niveau] = strval(SplitDiv[11]);
fclose(file);
}
}
I should apply the precedent method? Or not?

