Y_Ini Problem
#1

Hello i have problem with saving data to file in OnGameModeExit. It is gamemode start lines.
Код:
#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;
}
Please help me.
Reply
#2

When you start up the server then you enter your server then exit it does it show y_ini errors in the black panel?in the scriptfiles folder have made you Players folder
Reply
#3

Yes i have folder Players.
Quote:

----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3e-R2, ©2005-2012 SA-MP Team

[06:11:56] filterscripts = "" (string)
[06:11:56]
[06:11:56] Server Plugins
[06:11:56] --------------
[06:11:56] Loading plugin: sscanf
[06:11:56]

[06:11:56] ===============================

[06:11:56] sscanf plugin loaded.

[06:11:56] © 2009 Alex "******" Cole

[06:11:56] 0.3d-R2 500 Players "dnee"

[06:11:56] ===============================

[06:11:56] Loaded.
[06:11:56] Loading plugin: streamer
[06:11:56]

*** Streamer Plugin v2.6.1 by Incognito loaded ***

[06:11:56] Loaded.
[06:11:56] Loaded 2 plugins.

[06:11:56]
[06:11:56] Filterscripts
[06:11:56] ---------------
[06:11:56] Loaded 0 filterscripts.

[06:11:56] OnGameo
[06:11:56]
[06:11:56]
[06:11:56]
[06:11:56] =======================================
[06:11:56] | |
[06:11:56] | YSI version 1.06.0002 |
[06:11:56] | By Alex "******" Cole |
[06:11:56] | |
[06:11:56] =======================================
[06:11:56]
[06:11:56]
[06:11:56]
[06:11:56] Number of vehicle models: 0
[06:12:19] Incoming connection: 192.168.1.100:49569
[06:12:19] [join] Ranchand1998 has joined the server (0:192.168.1.100)
[06:12:23] [part] Ranchand1998 has left the server (0:2)

Reply
#4

Might help if you said what the actual problem is..

This is like taking your car in for repair and saying 'my car is broken fix it'.
Reply
#5

ignore this
Reply
#6

If gamemode is exit code is not performed. File does not created. In this is problem.
Reply
#7

You don't need to kill a timer when the gamemode exits. How can a timer be running if the script isn't loaded..?

IIRC, you can't do any saving in OnGameModeExit as it's sort of called AFTER the server closes, or something weird like that. I remember this from like 5 years ago so don't quote me on that.
Reply
#8

So where i can save this if not in OnGameModeExit?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)