SA-MP Forums Archive
Problem with negative money - 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: Problem with negative money (/showthread.php?tid=412892)



Problem with negative money - KlooP - 03.02.2013

Hey guys, I have a problem. My code:
Код:
switch(dialogid)
{
	case 4: {
		if(response) {
			if(GetPlayerMoney(playerid) < strlen(inputtext)) {
			ShowPlayerDialog(playerid, 4, DIALOG_STYLE_INPUT, "Deposit", "You don't have money!", "Deposit", "Back");
			} 
			if(strlen(inputtext) <= GetPlayerMoney(playerid)) {
			if(strlen(inputtext) > 0) {
			GivePlayerMoney(playerid, -strval(inputtext));
			zDB[playerid][banke] += strval(inputtext);
			ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Bank", "Deposit\nWithdraw\nBalance\nPavedimas", "Pasirinkti", "Exit");
			}
		}
	}
}
	case 5: {
		if(strlen(inputtext) > 0) {
		if(strlen(inputtext) <= zDB[playerid][banke]) {
		GivePlayerMoney(playerid, strval(inputtext));
		zDB[playerid][banke] -= strval(inputtext);
		ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Bank", "Deposit\nWithdraw\nBalance\nPavedimas", "Pasirinkti", "Exit");
		} else {
		ShowPlayerDialog(playerid, 5, DIALOG_STYLE_INPUT, "Withdraw", "You don't have money!", "Withdraw", "Back");
		}
	}
}
}
So now I can deposit how much I want money. Same problem with withdraw. If I have 1 dollar I can deposit 2 dollars and i'll have -1 dollar.