Saving Player Stats On GMX -
Scripter12345 - 26.04.2012
Well i am trying to create my own server, but i have a problem i need everyone's stats to save after the server has done GMX, I have tried lots of tutorial and i either don't get them or they don't work, I am wondering if anyone here can show me a good working tutorial.
Scripter
Re: Saving Player Stats On GMX -
.FuneraL. - 26.04.2012
I have a system that saves money and the player's score if this help you:
pawn Код:
#include <Dini>
OnPlayerConnect:
if(dini_Isset("score.ini",PlayerName(playerid))) SetPlayerScore(playerid,dini_Int("score.ini",PlayerName(playerid)));
if(dini_Isset("money.ini",PlayerName(playerid))) GivePlayerMoney(playerid,dini_Int("money.ini",PlayerName(playerid)));
OnPlayerDisconnect :
dini_IntSet("score.ini",PlayerName(playerid),GetPlayerScore(playerid));
dini_IntSet("money.ini",PlayerName(playerid),GetPlayerMoney(playerid));
OnGameModeInit:
if(!fexist("score.ini")) dini_Create("score.ini");
if(!fexist("money.ini")) dini_Create("money.ini");
Re: Saving Player Stats On GMX -
ReneG - 26.04.2012
Make a gmx command that loops through all the players, and save their stats, and calls gmx in the command
Код:
SendRconCommand("gmx");
Re: Saving Player Stats On GMX -
Scripter12345 - 26.04.2012
Quote:
Originally Posted by .FuneraL.
I have a system that saves money and the player's score if this help you:
pawn Код:
#include <Dini>
OnPlayerConnect:
if(dini_Isset("score.ini",PlayerName(playerid))) SetPlayerScore(playerid,dini_Int("score.ini",PlayerName(playerid))); if(dini_Isset("money.ini",PlayerName(playerid))) GivePlayerMoney(playerid,dini_Int("money.ini",PlayerName(playerid)));
OnPlayerDisconnect :
dini_IntSet("score.ini",PlayerName(playerid),GetPlayerScore(playerid)); dini_IntSet("money.ini",PlayerName(playerid),GetPlayerMoney(playerid));
OnGameModeInit:
if(!fexist("score.ini")) dini_Create("score.ini"); if(!fexist("money.ini")) dini_Create("money.ini");
|
Naa, Thank You anyway, Im using Y_INI, Its really annoying i just need to find a decent tutorial or a way how to do it.
Re: Saving Player Stats On GMX -
Scripter12345 - 26.04.2012
Quote:
Originally Posted by VincentDunn
Make a gmx command that loops through all the players, and save their stats, and calls gmx in the command
Код:
SendRconCommand("gmx");
|
I have done that, but it just dont work, Can you give me a little start ?
Re: Saving Player Stats On GMX -
shitbird - 26.04.2012
I'm assuming that you are saving player data when the OnPlayerDisconnect callback is called.
If so, do this:
pawn Код:
public OnGameModeExit()
{
foreach(Player, i) OnPlayerDisconnect(i, 1);
}
This'll require the foreach include of course, which you can easily find using the search function.
Re: Saving Player Stats On GMX -
awsomedude - 26.04.2012
Put This in OnGamemodeExit
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
//player files [replace playerid to i]
}
Re: Saving Player Stats On GMX -
Scripter12345 - 26.04.2012
Quote:
Originally Posted by awsomedude
Put This in OnGamemodeExit
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++) { //player files [replace playerid to i] }
|
So like this ?
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
new INI:File = INI_Open(UserPath(i));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_Close(File);
}
?
Re: Saving Player Stats On GMX -
awsomedude - 26.04.2012
Quote:
Originally Posted by Scripter12345
So like this ?
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++) { new INI:File = INI_Open(UserPath(i)); INI_SetTag(File,"data"); INI_WriteInt(File,"Cash",GetPlayerMoney(playerid)); INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]); INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]); INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]); INI_Close(File); }
?
|
yeah but replace playerid with i
Re: Saving Player Stats On GMX -
Scripter12345 - 26.04.2012
Quote:
Originally Posted by awsomedude
yeah but replace playerid with i
|
Tried that it still did not work, I really want this to work