Guys when i buy some thing from the Ammunation , It says that i bought for example a deagle costs 3000$ , it gives me the deagle but it doesnt take away the 3000 $ , and here is the code
Код:
if(listitem == 3) // Desert Eeagle
{
if(GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid, 0xB60000FF, "You do not have $3000 to buy this desert eagle.");
else
{
GivePlayerWeapon(playerid, 24, 150);
GivePlayerMoney(playerid, -3000);
SendClientMessage(playerid, 0x00FFFFFF, "You have bought a Desert Eagle for $3000");
ShowPlayerDialog(playerid, SHOPMENU+2, DIALOG_STYLE_LIST, "Ammunation Menu", "Baseball Bat\t\t\t$1500\nChainsaw\t\t\t$6500\n9mm\t\t\t\t$2500\nDesert Eagle\t\t\t$3000\nSawn-off Shotgun\t\t$4500\nCombat Shotgun\t\t$6000\nMac10\t\t\t\t$5000\nTec9\t\t\t\t$5000\nMP5\t\t\t\t$5500\nM4\t\t\t\t$10000\nAK47\t\t\t\t$10000\nSniper Rifle\t\t\t$12500\nParachute\t\t\t$3500", "Buy", "Cancel");
and same with the bank , when i deposit for example 50$ , i see in my screen or when i check the balance i see that i deposited that amount , but it doesnt take away the 50 $ , and when i withdraw i see in the dialogue that i withdrawed 50 $ .. please help
Код:
if(dialogid == SHOPMENU+10)
{
if(response)
{
new amount = strval(inputtext);
if(amount > GetPlayerMoney(playerid)) return SendClientMessage(playerid, 0xB60000FF, "You don't have that much money!");
if(amount < 1) return SendClientMessage(playerid, 0xB60000FF, "Invalid amount.");
else
{
GivePlayerMoney(playerid, -amount);
UpdatePlayerBankAccountBalance(playerid, amount);
format(string, sizeof(string), "You have deposited $%d into your bank account.", amount);
SendClientMessage(playerid, 0x00FFFFFF, string);
}
}
return 1;
}
if(dialogid ==SHOPMENU+12)
{
if(response)
{
new amount = strval(inputtext);
if(amount > GetBankAccountBalance(playerid)) return SendClientMessage(playerid, 0xB60000FF, "You do not have that much money in your bank account!");
if(amount < 1) return SendClientMessage(playerid, 0xB60000FF, "Invalid amount.");
else
{
GivePlayerMoney(playerid, amount);
UpdatePlayerBankAccountBalance(playerid, -amount);
format(string, sizeof(string), "You have withdrawn $%d from your bank account.", amount);
SendClientMessage(playerid, 0x00FFFFFF, string);
}
}
return 1;
}
if(dialogid == SHOPMENU+13)
{
if(response)
{
new id;
sscanf(inputtext, "u", id);
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xB60000FF, "Invalid player!");
if(id == playerid) return SendClientMessage(playerid, 0xB60000FF, "You can not transfer money to yourself.");
else
{
SetPVarInt(playerid, "BankTransferChoosenID", id);
format(string, sizeof(string), "You have $%d in your bank account.\n\nEnter the amount you want to transfer to %s (%d) below:", GetBankAccountBalance(playerid), pNick(id), id);
ShowPlayerDialog(playerid, SHOPMENU+14, DIALOG_STYLE_INPUT, "Bank Menu", string, "Continue", "Cancel");
}
}
return 1;
}
if(dialogid == SHOPMENU+14)
{
if(response)
{
new amount = strval(inputtext), tmpstring[128], id = GetPVarInt(playerid, "BankTransferChoosenID");
if(GetBankAccountBalance(playerid) < amount) return SendClientMessage(playerid, 0xB60000FF, "You do not have that much money in your bank account!");
if(amount < 1) return SendClientMessage(playerid, 0xB60000FF, "Invalid Amount.");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xB60000FF, "Invalid player!");
else
{
UpdatePlayerBankAccountBalance(id, amount);
UpdatePlayerBankAccountBalance(playerid, -amount);
format(tmpstring, sizeof(tmpstring), "You have transfered $%d to %s's (%d) bank account.", amount, pNick(id), id);
SendClientMessage(playerid, 0x00FFFFFF, tmpstring);
format(tmpstring, sizeof(tmpstring), "%s (%d) have transfered $%d to your bank account.", pNick(playerid), playerid, amount);
SendClientMessage(id, 0x00FFFFFF, tmpstring);
DeletePVar(playerid, "BankTransferChoosenID");
}
}
return 1;
}
return 0;