15.04.2010, 19:10
Hi, i tried to make a bank system with dialog input, but it seems to not working.
When i write in the numbers it just closes the menu, and does nothing.
code:
I tried to make them in cmds, but it's also full of bugs, like it dosen't take out the amount of bmoney that you withdraw, and it gives you like 65k:
When i write in the numbers it just closes the menu, and does nothing.
code:
Код:
if(dialogid == 11) { if(response) { if(listitem == 0) { ShowPlayerDialog(playerid,12,DIALOG_STYLE_INPUT,"Bank","Enter the amout you want to deposit:","Ok","Cancel"); return 1; } if(listitem == 1) { ShowPlayerDialog(playerid,13,DIALOG_STYLE_INPUT,"Bank","Enter the amout you want to withdraw:","Ok","Cancel"); return 1; } if(listitem == 2) { // Add stats return 1; } } } if(dialogid == 12) { if(response) { if(listitem == 0) { new cash = strval(inputtext),string[128]; bmoney[playerid] += cash; if(cash <=0) return SendClientMessage(playerid,COLOUR_RED,"Error: You can't deposit under 1$!"); else if(GetPlayerMoney(playerid) < cash) return SendClientMessage(playerid,COLOUR_RED,"Error: You do not have that much cash"); else { bmoney[playerid] = cash; SetPlayerMoney(playerid,GetPlayerMoney(playerid)+cash); format(string,sizeof(string),"You deposited %s",cash); SendClientMessage(playerid,COLOUR_GREEN,string); return 1; } } } if(dialogid == 13) { if(response) { if(listitem == 0) { new cash2 = strval(inputtext),string[128]; bmoney[playerid] -= cash2; if(cash2 > bmoney[playerid]) return SendClientMessage(playerid,COLOUR_RED,"Error: You can't withdraw that much money"); else if(cash2 <= 0) return SendClientMessage(playerid,COLOUR_RED,"Error: You can't withdraw under 1$!"); else { SetPlayerMoney(playerid,GetPlayerMoney(playerid)+cash2); format(string,sizeof(string),"You withdrawed %s",cash2); SendClientMessage(playerid,COLOUR_GREEN,string); return 1; } } }
Код:
dcmd_withdraw(playerid,params[]) { new withdrawcash,string[256]; bmoney[playerid] -= withdrawcash; if(withdrawcash > bmoney[playerid]) return SendClientMessage(playerid,COLOUR_RED,"Error: You can't withdraw that much money"); else if(sscanf(params,"u",withdrawcash)) return SendClientMessage(playerid,COLOUR_RED,"Usage: /withdraw [money amount]"); else if(withdrawcash <= 0) return SendClientMessage(playerid,COLOUR_RED,"Error: You can't withdraw under 1$!"); else { SetPlayerMoney(playerid,GetPlayerMoney(playerid)+withdrawcash); withdrawcash -= bmoney[playerid]; format(string,sizeof(string),"You withdrawed %i",withdrawcash); SendClientMessage(playerid,COLOUR_GREEN,string); return 1; } } dcmd_deposit(playerid,params[]) { new cash,string[256]; bmoney[playerid] += cash; if(GetPlayerMoney(playerid) < cash) return SendClientMessage(playerid,COLOUR_RED,"Error: You do not have that much cash"); else if(sscanf(params,"u",cash)) return SendClientMessage(playerid,COLOUR_RED,"Usage: /deposit [money amount]"); else if(cash <=0) return SendClientMessage(playerid,COLOUR_RED,"Error: You can't deposit under 1$!"); else { bmoney[playerid] += cash; SetPlayerMoney(playerid,GetPlayerMoney(playerid)+cash); format(string,sizeof(string),"You deposited %i",cash); SendClientMessage(playerid,COLOUR_GREEN,string); return 1; } }