17.09.2011, 17:05
hellow
sorry with my bad english ok
i learned dini but now i start to learn file fuction
is the first try in the file fuction i try to build register system but my server after i write number to register it
crashed
ok this is the code thnx for who help
and i have a little question how i do in file fuction if the password = inputtext .......
thnx for who help
sorry with my bad english ok
i learned dini but now i start to learn file fuction
is the first try in the file fuction i try to build register system but my server after i write number to register it
crashed
ok this is the code thnx for who help
Код:
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_append); 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; }
thnx for who help