05.06.2014, 12:57
Load crashdetect plugin for that. Until then, I found 2 things.
1 placeholder and 2 arguments.
The last one and most important, you should check if the file handle is valid before using any file function because it can crash the server. For example, this (from your code) is incorrect:
It should be:
Then in changepassword, you have:
opening a file without storing the file handle to a variable and closing another file handle.
pawn Код:
printf("* zBlock: LOGIN! %s has logged in the zBlock 'CP'!", GetName(playerid), SecondParam);
The last one and most important, you should check if the file handle is valid before using any file function because it can crash the server. For example, this (from your code) is incorrect:
pawn Код:
new
File: zBlockstuff = fopen("/zblock/password.txt", io_read)
;
fread(zBlockstuff, string);
fclose(zBlockstuff);
pawn Код:
new
File: zBlockstuff = fopen("/zblock/password.txt", io_read)
;
if (zBlockstuff)
{
fread(zBlockstuff, string);
fclose(zBlockstuff);
}
pawn Код:
if(zBlockstuff)
{
fopen("/zblock/password.txt", io_write);
fwrite(zBlockstuff, SecondParam);
fclose(zBlockstuff);
format(messagestring, sizeof(messagestring), "zBlock: %s(%d) has changed the password to %s", GetName(playerid), playerid, SecondParam);
SendMessageToAdmins(COLOR_NOTES2, messagestring);
printf("* zBlock: PASS CHANGE! %s has changed the password to %s!", GetName(playerid), SecondParam);
}