The Server Crashed - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: The Server Crashed (
/showthread.php?tid=284239)
The Server Crashed -
avivelkayam - 18.09.2011
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 :
Код:
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;
}
Re: The Server Crashed -
[MWR]Blood - 18.09.2011
pawn Код:
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,"%s.ini",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;
}
I reccomend using Y_INI.
Re: The Server Crashed -
avivelkayam - 18.09.2011
look there is another way to do this without Y.ini i want to learn file fuction
and can you explaine me my wrong and fix my code ty for help
Re: The Server Crashed -
avivelkayam - 18.09.2011
Up !! i need it how much fast that you can