08.08.2014, 02:20
pawn Код:
enum pInfo
{
pArma[13],
pBalas[13]
}
new PlayerInfo[MAX_PLAYERS][pInfo];
pawn Код:
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
//hace algo
}
if(!fexist(UserPath(playerid)))
{
new INI:File = INI_Open(UserPath(playerid));
new string[64];
for(new i=0;i<13;i++){
format(string,sizeof(string),"Arma%d",i);
INI_WriteInt(File,string,0);
format(string,sizeof(string),"Balas%d",i);
INI_WriteInt(File,string,0);
}
INI_Close(File);
}
return 1;
}
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
new string[64];
for(new i=0;i<13;i++){
format(string,sizeof(string),"Arma%d",i);
INI_Int(string,PlayerInfo[playerid][pArma][i]);
format(string,sizeof(string),"Balas%d",i);
INI_Int(string,PlayerInfo[playerid][pBalas][i]);
}
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason){
new string[64], INI:File = INI_Open(UserPath(playerid));
for(new i=0;i<13;i++){
GetPlayerWeaponData(playerid,i,PlayerInfo[playerid][pArma][i],PlayerInfo[playerid][pBalas][i]);
format(string,sizeof(string),"Arma%d",i);
INI_WriteInt(File,string,PlayerInfo[playerid][pArma][i]);
format(string,sizeof(string),"Balas%d",i);
INI_WriteInt(File,string,PlayerInfo[playerid][pBalas][i]);
}
INI_Close(File);
return 1;
}