SA-MP Forums Archive
/deposit and /withdraw not doing anything - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /deposit and /withdraw not doing anything (/showthread.php?tid=377615)



/deposit and /withdraw not doing anything - RLGaming - 15.09.2012

So, I have my bank system:

CMDS:

Quote:

CMD:deposit(playerid,params[])
{
new string[256];
new type;
{
if(sscanf(params, "d", type)) return SendClientMessage(playerid, -1, "[USAGE]: /deposit [amount]");
if(type == 0)
if(GetPlayerMoney(playerid)< type)
{
GivePlayerMoney(playerid,-type);
BankInfo[playerid][pBankAccount] += type;
format(string, sizeof(string), "INFO: You have successfully deposited $%d to your bank account.", type);
SendClientMessage(playerid, 0xFFFFFF, string);
}
else SendClientMessage(playerid, 0xFFFFFF, "SERVER: You do not have that much amount in your hand");
}
return 1;
}
CMD:withdraw(playerid,params[])
{
new string[256];
new type;
{
if(sscanf(params, "d", type)) return SendClientMessage(playerid, -1, "[USAGE]: /withdraw [amount]");
if(type == 0)
if(BankInfo[playerid][pBankAccount] >= type)
{
BankInfo[playerid][pBankAccount] -= type;
GivePlayerMoney(playerid, type);
format(string, sizeof(string), "INFO: You have successfully withdrawn $%d from your bank account.", type);
SendClientMessage(playerid, 0xFFFFFF, string);
}
else SendClientMessage(playerid, 0xFFFFFF, "SERVER: You do not have that much amount in your account");
}
return 1;
}

When I do /deposit it says to do /deposit [amount] same for /withdraw(/withdraw [amount] - But, whenever I attempt to put money into it nothing happens, not even a client message, the bank is all setup the enum and such, no errors or warnings, I also have the money when im doing it

so any help:/


Re: /deposit and /withdraw not doing anything - KoczkaHUN - 15.09.2012

That code is a bit messed up, I tried to clean it up, check if it works:

pawn Code:
CMD:deposit(playerid,params[])
{
    new string[92];
    new type;
    if(sscanf(params, "d", type)) return SendClientMessage(playerid, -1, "[USAGE]: /deposit [amount]");
    if(type <= 0) return SendClientMessage(playerid, -1, "ERROR: Amount must be greater than zero.");
    if(GetPlayerMoney(playerid) >= type)
    {
        GivePlayerMoney(playerid, -type);
        BankInfo[playerid][pBankAccount] += type;
        format(string, sizeof(string), "INFO: You have successfully deposited $%d to your bank account.", type);
        SendClientMessage(playerid, 0xFFFFFFFF, string);
    }
    else SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: You do not have that much amount in your hand");

    return 1;
}

CMD:withdraw(playerid,params[])
{
    new string[92];
    new type;
    if(sscanf(params, "d", type)) return SendClientMessage(playerid, -1, "[USAGE]: /withdraw [amount]");
    if(type <= 0) return SendClientMessage(playerid, -1, "ERROR: Amount must be greater than zero.");
    if(BankInfo[playerid][pBankAccount] >= type)
    {
        BankInfo[playerid][pBankAccount] -= type;
        GivePlayerMoney(playerid, type);
        format(string, sizeof(string), "INFO: You have successfully withdrawn $%d from your bank account.", type);
        SendClientMessage(playerid, 0xFFFFFFFF, string);
    }
    else SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: You do not have that much amount in your account");
   
    return 1;
}



Re: /deposit and /withdraw not doing anything - RLGaming - 15.09.2012

Thank you so much!

Rep'd, worked!


Re: /deposit and /withdraw not doing anything - arvifilter - 15.09.2012

bro,honestly i feel you are in love with hackers or something like that
make ur own give cash system so no one can use some cute hacks and become billioner


Re: /deposit and /withdraw not doing anything - KoczkaHUN - 15.09.2012

From where do you know he does not use an anticheat?