Dosent take my money
#1

Hello i made a bank system and it kinda dosent take from me money

here is my code:
pawn Код:
else
                        {
                                new str[128];
                                new inputext = strval(inputtext);
                                pInfo[playerid][pBank] += inputext;
                                pInfo[playerid][Money] -= inputext;
                                format(str, sizeof(str), "You have deposited $%d into your account. New balance: $%d", inputext, pInfo[playerid][pBank]);
                                SendClientMessage(playerid, 0x008000FF, str);
                        }
Reply
#2

Why Don't you just use GivePlayerMoney instead of pInfo[playerid][Money]

Atleast give this code a try

pawn Код:
GivePlayerMoney(playerid, -inputext);
Reply
#3

pawn Код:
public OnPlayerUpdate(playerid)
{
     ResetPlayerMoney(playerid);
     GivePlayerMoney(playerid, pInfo[playerid][Money]);
     return 1;
}
If you use variables with everything else like you've done in that pawn code you gave us, then this would also work as an anti-cheat.
Reply
#4

But when i do it for withdraw i get this following errors

Код:
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2454) : error 029: invalid expression, assumed zero
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2454) : warning 215: expression has no effect
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2454) : error 001: expected token: ";", but found ")"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2454) : error 029: invalid expression, assumed zero
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2454) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#5

Give 2453 and 2454 lines
Reply
#6

Or Try:
Код:
else
                        {
                                new str[128];
                                new inputext = strval(inputtext);
                                pInfo[playerid][pBank] += inputext;
                                pInfo[playerid][Money] -= inputext;
                                SetPlayerMoney(playerid, pInfo[playerid][Money]);
                                format(str, sizeof(str), "You have deposited $%d into your account. New balance: $%d", inputext, pInfo[playerid][pBank]);
                                SendClientMessage(playerid, 0x008000FF, str);
                        }
Reply
#7

No
the one that decreases works but in this code:


pawn Код:
case DIALOG_WITHDRAW:
                {
                        if(!response) return ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel");
                        else if(strval(inputtext) > pInfo[playerid][pBank]) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount in your bank");
                        else if(!IsNumeric(inputtext))
                        {
                                new str[128];
                                format(str,sizeof(str),"Your Curret Balance Is : $%d\nEnter The Amount You Want To Withdraw Below :",pInfo[playerid][pBank]);
                                ShowPlayerDialog(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Withdraw",str, "Withdraw", "Back");
                                SendClientMessage(playerid,COLOR_RED,"Please Use Numbers");
                        }
                        else
                        {
                                new str[128];
                                new inputext = strval(inputtext);
                                pInfo[playerid][pBank] -= inputext;
                                GivePlayerMoney(playerid, +inputext);
                                format(str, sizeof(str), "You have withdrawn $%d out of your account. New balance: $%d", inputext, pInfo[playerid][pBank]);
                                SendClientMessage(playerid, 0x008000FF, str);
                        }
                }
it dosent i get those errors
Код:
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2454) : error 029: invalid expression, assumed zero
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2454) : warning 215: expression has no effect
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2454) : error 001: expected token: ";", but found ")"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2454) : error 029: invalid expression, assumed zero
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2454) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#8

Show us the code in line 2454
Reply
#9

I just did it
Look at post number seven
Reply
#10

If the exact error line is:

pawn Код:
case DIALOG_WITHDRAW:
Show us the code before that line, around 5-10 lines of it.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)