11.02.2013, 03:53
Hello i have problem with saving data to file in OnGameModeExit. It is gamemode start lines.
Please help me.
Код:
#include <a_samp>
#include <sscanf2>
#include <streamer>
#include <YSI\y_ini>
#include <YSI\y_commands>
#include <foreach>
#define MAXIMAL_PLAYERS 100
#define MAXIMAL_ATTEMPT_PASSWORDS 5
#define PLAYERS_FOLDER "Players/"
#define DIALOG_LOGIN 0
#define DIALOG_REGISTER 1
new ServerBans;
new ServerKicks;
new ServerKills;
new ServerDeaths;
new ServerSuicides;
new ServerVisits;
new ServerPlayersRecord;
new ServerPlayersRegistered;
new ServerFile[30];
new ServerGlobalFunctionsTimer;
new ServerAdministrators;
new ServerModerators;
new ServerVips;
new ServerPlayers;
new PlayerName[MAXIMAL_PLAYERS][30];
new PlayerIp[MAXIMAL_PLAYERS][30];
new PlayerPassword[MAXIMAL_PLAYERS][30];
new PlayerMoney[MAXIMAL_PLAYERS];
new PlayerScore[MAXIMAL_PLAYERS];
new PlayerLevel[MAXIMAL_PLAYERS];
new PlayerScoreToNextLevel[MAXIMAL_PLAYERS];
new PlayerKills[MAXIMAL_PLAYERS];
new PlayerDeaths[MAXIMAL_PLAYERS];
new PlayerSuicides[MAXIMAL_PLAYERS];
new PlayerVisits[MAXIMAL_PLAYERS];
new PlayerBans[MAXIMAL_PLAYERS];
new PlayerKicks[MAXIMAL_PLAYERS];
new PlayerJailTime[MAXIMAL_PLAYERS];
new PlayerMuteTime[MAXIMAL_PLAYERS];
new PlayerAdministratorLevel[MAXIMAL_PLAYERS];
new PlayerModerator[MAXIMAL_PLAYERS];
new PlayerVipTime[MAXIMAL_PLAYERS];
new PlayerFile[MAXIMAL_PLAYERS][30];
new PlayerLoggedIn[MAXIMAL_PLAYERS];
new PlayerAttemptPassword[MAXIMAL_PLAYERS];
new PlayerVipTimer[MAXIMAL_PLAYERS];
main()
{
return 1;
}
public OnGameModeInit()
{
AddPlayerClass(0,0,0,0,0,0,0,0,0,0,0);
ServerBans = 0;
ServerKicks = 0;
ServerKills = 0;
ServerDeaths = 0;
ServerSuicides = 0;
ServerVisits = 0;
ServerPlayersRecord = 0;
ServerPlayersRegistered = 0;
format(ServerFile,30,"Server.ini");
INI_Load(ServerFile);
ServerGlobalFunctionsTimer = SetTimer("ServerGlobalFunctions",1000,1);
ServerAdministrators = 0;
ServerModerators = 0;
ServerVips = 0;
ServerPlayers = 0;
return 1;
}
public OnGameModeExit()
{
new INI:File;
File = INI_Open(ServerFile);
INI_SetTag(File,"Data");
INI_WriteInt(File,"Bans",ServerBans);
INI_WriteInt(File,"Kicks",ServerKicks);
INI_WriteInt(File,"Kills",ServerKills);
INI_WriteInt(File,"Deaths",ServerDeaths);
INI_WriteInt(File,"Suicides",ServerSuicides);
INI_WriteInt(File,"Visits",ServerVisits);
INI_WriteInt(File,"PlayersRecord",ServerPlayersRecord);
INI_WriteInt(File,"PlayersRegistered",ServerPlayersRegistered);
INI_Close(File);
KillTimer(ServerGlobalFunctionsTimer);
return 1;
}

