Give money to an Offline Player.
#1

I Tryed all my ideas to give money to an Offline player. I'm not a total retard with Pawn. But i don't know the solution

I Use Y_INI. I don't need the entire script. I think is a bit long. Just a way do give the money.




(Sorry for Bad English.)
Reply
#2

You can check out my tutorial to see the general idea behind the whole "offline" thing.

Link is in signature.
Reply
#3

Quote:
Originally Posted by gtakillerIV
Посмотреть сообщение
You can check out my tutorial to see the general idea behind the whole "offline" thing.

Link is in signature.
That gived me the basic. I need a way to Load the Integer and then add up the player's money. I really don't understand how i can do this.
Reply
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
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.
I Know that. so i do and now i have:

pawn Код:
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;
    }
pawn Код:
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;
}
And the callback "LoadBank" will not be called by INI_ParseFile, i know is something easy. but i really don't understand why. Sorry for the print's as a debug message for me.
Reply
#5

pawn Код:
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);
    }
note: didn't test
Reply
#6

Quote:
Originally Posted by Vanter
Посмотреть сообщение
pawn Код:
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);
    }
note: didn't test
Worked changig your code like this:

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;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)