18.09.2011, 14:09
hellow sorry about my english
ok i started to learn file fuction befor a few hours and i tried to create my own register system but
the server after i write password is crashed and it doesn't create a file in folder Users
i need someone correct my code and give me a liitle explaine what wrong with my code thnx for help
this is the code :
ok i started to learn file fuction befor a few hours and i tried to create my own register system but
the server after i write password is crashed and it doesn't create a file in folder Users
i need someone correct my code and give me a liitle explaine what wrong with my code thnx for help
this is the code :
Код:
new pName[MAX_PLAYER_NAME];
enum PlayerStats {
Password,
Level,
Kills
};
new PlayerInfo[MAX_PLAYERS][PlayerStats];
Код:
public OnPlayerConnect(playerid)
{
new file[256];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(file,sizeof(file),"%s.ini",pName);
if(!fexist(file))
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Register","дчщ аъ сйсоък лгй мдйшщн","айщеш","бйием");
} else {
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login","дчщ аъ сйсоък лгй мдъзбш","айщеш","бйием");
}
return 1;
}
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new file[256];
new string[256];
format(file,sizeof(file),"Users/%s.ini",GetPlayerName(playerid, pName, MAX_PLAYER_NAME));
if(dialogid == 1)
{
if(!response || !strlen(inputtext))
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Register","дчщ аъ сйсоък лгй мдйшщн","айщеш","бйием");
return 1;
}
new File: PlayerFile = fopen(file,io_write);
format(string,256,"Name: %s",GetPlayerName(playerid, pName, MAX_PLAYER_NAME));
fwrite(PlayerFile,string);
PlayerInfo[playerid][Level] = 1;
PlayerInfo[playerid][Level] = fwrite(PlayerFile,"Level");
PlayerInfo[playerid][Kills] = 0;
PlayerInfo[playerid][Kills] = fwrite(PlayerFile,"Kills");
fclose(PlayerFile);
}
return 1;
}

