#include <YSI\y_ini> //If you have installed YSI, then you shouldn't have any problem
#define UserPath "changeme0/%s.ini"
#define COLOR_GREEN 0x33CC33C8
stock SavePlayerData(playerid)
{
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file,"Player's Data");
INI_WriteInt(file,"chnageme1",pInfo[playerid][chnageme1]);
INI_WriteInt(file,"chnageme2",pInfo[playerid][chnageme2]);
INI_WriteInt(file,"chnageme3",pInfo[playerid][chnageme3]);
INI_WriteInt(file,"chnageme4",pInfo[playerid][chnageme4]);
INI_WriteInt(file,"chnageme5",pInfo[playerid][chnageme5]);
INI_Close(file);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
SavePlayerData(playerid);
return 1;
}
CMD:ss(playerid, params[])
{
new string[130] ;
format(string, sizeof string, "* Your stats saved to your database", pName(playerid));
SendClientMessage(playerid, COLOR_GREEN, string);
if(User[playerid][accountLogged] == true)
{
SavePlayerData(playerid);
}
return 1;
}
#define UserPath "Data/%s.ini"
public OnPlayerDisconnect(playerid, reason)
//if(User[playerid][accountLogged] == true) *if u want don't add this
//{ *if u want don't add this
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file,"Player's Data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",pInfo[playerid][Cash]);
INI_WriteInt(File,"Admin",pInfo[playerid][Admin]);
INI_WriteInt(File,"Kills",pInfo[playerid][Kills]);
INI_WriteInt(File,"Deaths",pInfo[playerid][Deaths]);
INI_Close(File);
//} *if u want don't add this
return 1;
}
|
yes
SO we have to write his data when he leave *So we have to use 1- Check this in the defines Plase don't Forget this in the Top PHP код:
PHP код:
4- Create A file named Data in ur Scriptefiles , in the DAta file u can found the %s.ini (%s=playername) datas |