Problem with bank
#1

I have this code. If i have in 0 $ save in database then payment entered in the amount of. Where is a problem?

Код:
if(dialogid == BANK_PAYMENT)
	{


		if(!response)
			return SendClientMessage(playerid, 0xB0B0B0AA, "Canceled...");
		new payment = strval(inputtext);
		if(!IsNull(inputtext) )
		{
   			if(payment < SprawdzKasa(playerid))
			{
				SendClientMessage(playerid, 0xFF0000AA, "Lack of cash!");
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				return 0;
			}
			
			if(payment == 0)
			{
				SendClientMessage(playerid, 0xFF0000AA, "It can not be 0!");
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				return 0;
			}
			if(payment < 0)
			{
				SendClientMessage(playerid, 0xFF0000AA, "It can not be negative!");
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				return 0;
			}

			new bankbufpayment[127];
			format(bankbufpayment, sizeof(bankbufpayment), "UPDATE `Gracze` SET `Bank_kasa` = `Bank_kasa` - '%d' WHERE `Nick`='%s'", payment, PlayerName(playerid));
			new str[128];
			format(str, sizeof(str), "Payment {FFFFFF}(%d  $)", payment);
			SendClientMessageToAll(0xFF0000, str);
			GivePlayerMoney(playerid, payment);
			mysql_query(bankbufpayment);
		}
		if(IsNull(inputtext))
		{
			SendClientMessage(playerid, 0xFF0000FF, "Not NULL!");
			return 0;
		}
	}
Код:
stock SprawdzKasa(playerid)
{
	new buffer[127], nick[24], BankKasa, bool: istnieje = false;
	GetPlayerName(playerid, nick, MAX_PLAYER_NAME);
	mysql_real_escape_string(nick, nick);
	format(buffer, sizeof buffer, "SELECT `Bank_kasa` FROM `Gracze` WHERE `Nick` = '%s'", BankKasa, PlayerName(playerid));
	if (mysql_query(buffer)) mysql_ping();
	mysql_store_result();
	if (mysql_num_rows()) istnieje=true;
	mysql_free_result();
	return istnieje;
}
Reply


Messages In This Thread
Problem with bank - by Kerth - 17.11.2013, 18:16
Re: Problem with bank - by Kerth - 18.11.2013, 09:54

Forum Jump:


Users browsing this thread: 1 Guest(s)