21.06.2016, 15:44
Hi. I have this function make my server crash.
Function which is calling WriteLogs.
I call ResetSetData a first time, all is working. I call it a second time, the server crash.
Help is appreciate.
Best regards.
PHP код:
WriteLogs(const playername[], file[30], const author[], const reason[], const other[])
{
static day, month, hour, minute, seconde, year, stringW[190];
if(strfind(file, ".log", false, 0) == -1) format(file, sizeof(file), "%s.log", file);
format(file, sizeof(file), "/Logs/%s", file);
new File:pos=fopen(file, io_append);
gettime(hour, minute, seconde);
getdate(year, month, day);
format(stringW,sizeof(stringW),"\r\n[%02i/%02i/%02i] %02i:%02i:%02i | %s %s %s : %s", day, month, year, hour, minute, seconde, author, reason, playername, other);
fwrite(pos,stringW);
fclose(pos);
}
PHP код:
ResetSetData(setid, const reason[])
{
printf("[Debut]ResetSetData %i", setid);
new INI:File = INI_Open(DMSetPath(setid));
INI_SetTag(File, "Weapons");
INI_WriteString(File, "Name", DMWeapons[setid][sName]);
INI_WriteInt(File,"Weapon1",DMWeapons[setid][sWeapon1]);
INI_WriteInt(File,"Weapon2",DMWeapons[setid][sWeapon2]);
INI_WriteInt(File,"Weapon3",DMWeapons[setid][sWeapon3]);
INI_WriteInt(File,"Weapon4",DMWeapons[setid][sWeapon4]);
INI_WriteFloat(File,"Version", DMWeapons[setid][sVersion]);
INI_Close(File);
printf("[FS] ResetSetData | Set %i | Rewrote | [Reason : %s]", setid, reason);
static str[90];
format(str, sizeof(str), "SetID: %i", setid);
WriteLogs(str, "LOG_DM_System", "SERVER", "REWROTE SET DATA [Reset Set Data]", reason); // THERE IS THE LINE MAKING CRASH THE SERVER
printf("[FS] ResetSetData | Set %i | End", setid, reason);
return 1;
}
Help is appreciate.
Best regards.