Y_INI , Do I on the right ? - 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)
+--- Thread: Y_INI , Do I on the right ? (
/showthread.php?tid=518196)
Y_INI , Do I on the right ? -
Need4samp - 08.06.2014
Hi guys
i make register/login system, but there are things that stuck in my mind
Okey !!
this " WriteInt " will give player his stat or Write Pinfo in the file.ini
( Ini ===> Pinfo or Pinfo ===> Ini
)
pawn Код:
forward SaveAccountout(playerid);
public SaveAccountout(playerid)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
INI_Close(File);
return 1;
}
and where can i post it ?
EX: when player " OnPlayerDisconnect " or " OnPlayerConnect " 
and what about
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Cash",PlayerInfo[playerid][pCash]);
return 1;
}
Re : Y_INI , Do I on the right ? -
S4t3K - 08.06.2014
"INI_WriteInt" will write "Cash = PlayerInfo[playerid][pCash]", of course it will replace "PlayerInfo[playerid][pCash] with his integer value.
So if the player has $500 registered in "pCash", it will write "Cash = 500" in the player's file.
You should create a per-player timer when the player connects which will save all the player data each time the function is called.
And about "INI_Int("Cash", ...)", it just takes what's after the "Cash =" in the player's file and put it as an integer value in the variable which was passed where the "..." are in my example.