SA-MP Forums Archive
advanced question - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: advanced question (/showthread.php?tid=186411)



advanced question - WillyP - 28.10.2010

okay, so say if you have something like

timesquitted or something

you would have timesquitted++;

then dini_set("quitted",++?

im confused with this

reply asap


Re: advanced question - cessil - 29.10.2010

no you'd save the variable.


Respuesta: advanced question - admantis - 29.10.2010

pawn Код:
public OnPlayerDisconnect(playerid)
{
PlayerInfo[playerid][pTimesQuitted]++;
dini_IntSet(file, "TimesQuitted", PlayerInfo[playerid][pTimesQuitted]);
return 1;
}
Just a basic idea change as you like


Re: advanced question - ViruZZzZ_ChiLLL - 29.10.2010

First you must have this :
pawn Код:
#define PlayerFile "/FolderName/%s.ini"
On top of your script.

To create :
pawn Код:
if(!dini_Exists(file))
{
  dini_Create(file);
}
To save :
pawn Код:
new file[126];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), PlayerFile, name);
dini_IntSet(file, "VarNameOrWhatever", PlayerInfo[playerid][pTimesQuitted]);
To load :
pawn Код:
new file[126];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), PlayerFile, name);
PlayerInfo[playerid][pTimesQuitted] = dini_Int(file, "VarNameOrWhatever");



Respuesta: Re: advanced question - admantis - 29.10.2010

Quote:
Originally Posted by ViruZZzZ_ChiLLL
Посмотреть сообщение
First you must have this :
pawn Код:
#define PlayerFile "/FolderName/%s.ini"
On top of your script.

To create :
pawn Код:
if(!dini_Exists(file))
{
  dini_Create(file);
}
To save :
pawn Код:
new file[126];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), PlayerFile, name);
dini_IntSet(file, "VarNameOrWhatever", PlayerInfo[playerid][pTimesQuitted]);
To load :
pawn Код:
new file[126];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), PlayerFile, name);
PlayerInfo[playerid][pTimesQuitted] = dini_Int(file, "VarNameOrWhatever");
He asked only for the times quited thing not the whole account system xD but nice script i forgot the load thing as well