You can check out my tutorial to see the general idea behind the whole "offline" thing.
Link is in signature. |
y_ini has no concept of "online" or "offline", only "files". All you need is a filename for it to do its job. How you get that is nothing to do with y_ini.
|
if(dialogid == BANKT2 && response)
{
new file[40];
format(file,sizeof(file), "Players/%s.ini",inputtext);
if(!fexist(file)) return SendClientMessage(playerid, -1, ""RED"[ERRORE:]"WHITE" Conto inesistente.");
if(PInfo[playerid][pBalance] < GetPVarInt(playerid, "ImportofTrans"))
INI_ParseFile(file, "LoadBank", .bExtra = true, .extra = playerid);
printf("%d, Before",PInfo[playerid][pLoadedAccount]);
PInfo[playerid][pLoadedAccount] += GetPVarInt(playerid, "ImportofTrans");
printf("%d Import",GetPVarInt(playerid, "ImportOfTrans"));
printf("%d, After",PInfo[playerid][pLoadedAccount]);
new INI:ini = INI_Open(file);
INI_SetTag(ini, "Player's Data");
INI_WriteInt(ini,"BankBalance",PInfo[playerid][pLoadedAccount]);
INI_Close(ini);
PInfo[playerid][pBalance] -= GetPVarInt(playerid, "ImportofTrans");
SavePlayerData(playerid);
return 1;
}
forward LoadBank(playerid, name[], value[]);
public LoadBank(playerid, name[], value[])
{
// Just a debug message. print("Callback recalled");
INI_Int("BankBalance",PInfo[playerid][pLoadedAccount]);
return 1;
}
format(file,sizeof(file), "Players/%s.ini",inputtext);
if(!fexist(inputtext)) return SendClientMessage(playerid, -1, "[ERROR] That player name does not exist.");
if(fexist(filestring))
{
new INI:File = INI_Open(file);
INI_SetTag(File, "Player's Data");
INI_WriteInt(File,"BankBalance",PInfo[playerid][pLoadedAccount]+inputtext);
}
pawn Код:
|
if(dialogid == BANKT2 && response)
{
new file[MAX_PLAYER_NAME+14];
format(file,sizeof(file), "Players/%s.ini",inputtext);
if(!fexist(file)) return SendClientMessage(playerid, -1, ""RED"[ERRORE:]"WHITE" Conto inesistente.");
if(PInfo[playerid][pBalance] < GetPVarInt(playerid, "ImportofTrans")) return SendClientMessage(playerid, -1, ""RED"[ERRORE:] "WHITE" Non hai abbastanza liquiditа nel tuo conto");
if(fexist(file))
{
INI_ParseFile(file, "LoadBank", .bExtra = true, .extra = playerid);
PInfo[playerid][pLoadedAccount] += GetPVarInt(playerid,"ImportofTrans");
new INI:File = INI_Open(file);
INI_SetTag(File, "Player's Data");
INI_WriteInt(File,"BankBalance",PInfo[playerid][pLoadedAccount]);
INI_Close(File);
PInfo[playerid][pBalance] -= GetPVarInt(playerid, "ImportofTrans");
SavePlayerData(playerid);
}
return 1;
}
return 1;