Small Help
#1

When i send money to a player they do not see that they got it, i see, but i cant see what i am doing wrong.
Can you look at the script and see the prob for me and correct it? Please
Oh btw i am using aBank FS.

pawn Код:
new file2[50], string2[MAX_PLAYER_NAME],N[MAX_PLAYERS],sname[MAX_PLAYER_NAME],player;
        GetPVarString(playerid, "transfer_name", string2, sizeof(string2));
        format(file2, sizeof(file2), BANK_FILE, string2);
        dini_IntSet(file, "Balance", dini_Int(file, "Balance")-strval(inputtext));
        dini_IntSet(file2, "Balance", dini_Int(file2, "Balance")+strval(inputtext));
        format(string, sizeof(string), "Success: You have transfered $%d to %s's account.", strval(inputtext), string2);
        SendClientMessage(playerid, COLOR_GREEN, string);
        {
        GetPlayerName(player, sname, sizeof(sname));
        format(string, sizeof(string), "$%d has been wired to your account by %s.",strval(inputtext),sname);
        }SendClientMessage(player,0xFFD7C4FF,string);
        SetPVarString(playerid, "transfer_name", " ");
        ShowPlayerBankDialog(playerid);
Reply
#2

Please help.
Reply
#3

What do you mean they don't see it, but you do? Do you mean you see the text showing "You have transfered money to Player X" but they actually don't recieve the cash?
Reply
#4

What i mean is, i see. "Success: You have transfered X to X's account" and
"X has been wired to your account by X."
The problem is, the player who gets the cash does not see the message that they get it.
Reply
#5

Could you show more code then that? I'm guessing it's either a dialog or a command. Either or, could you provide the full code?
Reply
#6

This is the whole transfer code:

pawn Код:
if(dialogid == TRANSFER_1)
    {
        if(!strlen(inputtext)) return SendClientMessage(playerid, COLOR_RED, "Error: You didn't enter a player name to transfer money to!");
        new file2[50];
        format(file2, sizeof(file2), BANK_FILE, inputtext);
        if(!dini_Exists(file2)) return SendClientMessage(playerid, COLOR_RED, "Error: Invalid name; or the player does not have a bank account.");
        SetPVarString(playerid, "transfer_name", inputtext);
        ShowPlayerDialog(playerid, TRANSFER_2, DIALOG_STYLE_INPUT, "Advanced Bank - Transfer (Step 2)", "Insert the amount of money you would like to transfer:", "Submit", "Cancel");
    }
    if(dialogid == TRANSFER_2)
    {
        if(!strlen(inputtext))
        {
            SendClientMessage(playerid, COLOR_RED, "Error: You didn't enter an amount to send to the player.");
            SetPVarString(playerid, "transfer_name", " ");
            ShowPlayerBankDialog(playerid);
            return 1;
        }
        if(strval(inputtext) > dini_Int(file, "Balance"))
        {
            SendClientMessage(playerid, COLOR_RED, "Error: You're trying to transfer more money than you have!");
            SetPVarString(playerid, "transfer_name", " ");
            ShowPlayerBankDialog(playerid);
            ShowPlayerBankDialog(playerid);
            return 1;
        }
        new file2[50], string2[MAX_PLAYER_NAME],N[MAX_PLAYERS],sname[MAX_PLAYER_NAME],player;
        GetPVarString(playerid, "transfer_name", string2, sizeof(string2));
        format(file2, sizeof(file2), BANK_FILE, string2);
        dini_IntSet(file, "Balance", dini_Int(file, "Balance")-strval(inputtext));
        dini_IntSet(file2, "Balance", dini_Int(file2, "Balance")+strval(inputtext));
        format(string, sizeof(string), "Success: You have transfered $%d to %s's account.", strval(inputtext), string2, player);
        SendClientMessage(playerid, COLOR_GREEN, string);
        {
        GetPlayerName(player, sname, sizeof(sname));
        format(string, sizeof(string), "$%d has been wired to your account by %s.",strval(inputtext),sname,playerid);
        }SendClientMessage(player,0xFFD7C4FF,string);
        SetPVarString(playerid, "transfer_name", " ");
        ShowPlayerBankDialog(playerid);
But the problem is with this:
pawn Код:
new file2[50], string2[MAX_PLAYER_NAME],N[MAX_PLAYERS],sname[MAX_PLAYER_NAME],player;
        GetPVarString(playerid, "transfer_name", string2, sizeof(string2));
        format(file2, sizeof(file2), BANK_FILE, string2);
        dini_IntSet(file, "Balance", dini_Int(file, "Balance")-strval(inputtext));
        dini_IntSet(file2, "Balance", dini_Int(file2, "Balance")+strval(inputtext));
        format(string, sizeof(string), "Success: You have transfered $%d to %s's account.", strval(inputtext), string2);
        SendClientMessage(playerid, COLOR_GREEN, string);
        {
        GetPlayerName(player, sname, sizeof(sname));
        format(string, sizeof(string), "$%d has been wired to your account by %s.",strval(inputtext),sname);
        }SendClientMessage(player,0xFFD7C4FF,string);
        SetPVarString(playerid, "transfer_name", " ");
        ShowPlayerBankDialog(playerid);
Reply
#7

I think your braces ( { and } ) are useless, they aren't needed there:

pawn Код:
SendClientMessage(playerid, COLOR_GREEN, string);
{
GetPlayerName(player, sname, sizeof(sname));
format(string, sizeof(string), "$%d has been wired to your account by %s.",strval(inputtext),sname);
}SendClientMessage(player,0xFFD7C4FF,string);
Reply
#8

You never define what 'player' is equal to:

I would suggest you store the players ID (e.g. transfer_id) rather than the name (transfer_name), you can always use GetPlayerName on the ID.

You can use the non-standard function GetPlayerIDFromName (it should be on the forums, or a variety of it*) to get the ID from the name you store. However if you have access to the player ID when you store the name then it'd be best to store the id and use it at a later time-- you save processing time AND memory that way.

* sscanf can get playerid's from name if you can't find the GetPlayerIDFromName function.

Also, what's with the random { }'s in your code?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)