SHOW:
|
|
- or go back to the newest paste.
| 1 | - | //Credits goto Blademaster680 |
| 1 | + | //Credits goto Blademaster680 |
| 2 | ||
| 3 | #include <a_samp> | |
| 4 | ||
| 5 | #define FILTERSCRIPT | |
| 6 | ||
| 7 | #if defined FILTERSCRIPT | |
| 8 | ||
| 9 | #define DIALOG_BANK 34 | |
| 10 | #define DIALOG_DEPOSIT 35 | |
| 11 | #define DIALOG_WITHDRAW 36 | |
| 12 | #define DIALOG_TRANSFER1 37 | |
| 13 | #define DIALOG_TRANSFER2 38 | |
| 14 | #define DIALOG_BALANCE 39 | |
| 15 | ||
| 16 | ||
| 17 | public OnFilterScriptInit() | |
| 18 | {
| |
| 19 | print("\n--------------------------------------");
| |
| 20 | print(" Bank System by Blademaster680 loaded successfully");
| |
| 21 | print("--------------------------------------\n");
| |
| 22 | return 1; | |
| 23 | } | |
| 24 | ||
| 25 | public OnFilterScriptExit() | |
| 26 | {
| |
| 27 | return 1; | |
| 28 | } | |
| 29 | ||
| 30 | ||
| 31 | public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) | |
| 32 | {
| |
| 33 | switch( dialogid ) | |
| 34 | {
| |
| 35 | case DIALOG_BANK: | |
| 36 | {
| |
| 37 | if(!response) return 0; | |
| 38 | if(response) | |
| 39 | {
| |
| 40 | if(listitem == 0) | |
| 41 | {
| |
| 42 | new str[128]; | |
| 43 | format(str,sizeof(str),"Your Curret Balance Is : $%d\nEnter The Amount You Want To Deposit Below :",PlayerInfo[playerid][pBank]); | |
| 44 | ShowPlayerDialog(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit",str, "Deposit", "Back"); | |
| 45 | } | |
| 46 | if(listitem == 1) | |
| 47 | {
| |
| 48 | new str[128]; | |
| 49 | format(str,sizeof(str),"Your Curret Balance Is : $%d\nEnter The Amount You Want To Withdraw Below :",PlayerInfo[playerid][pBank]); | |
| 50 | ShowPlayerDialog(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Withdraw",str, "Withdraw", "Back"); | |
| 51 | } | |
| 52 | if(listitem == 2) | |
| 53 | {
| |
| 54 | new str[128]; | |
| 55 | format(str,sizeof(str),"Your Current Balance Is : $%d\nEnter The Player ID You Want To Transfer To Below :",PlayerInfo[playerid][pBank]); | |
| 56 | ShowPlayerDialog(playerid,DIALOG_TRANSFER1,DIALOG_STYLE_INPUT,"Transfer",str,"Next","Back"); | |
| 57 | } | |
| 58 | if(listitem == 3) | |
| 59 | {
| |
| 60 | new str[128]; | |
| 61 | format(str, sizeof(str), "Your current bank balance is: $%d", PlayerInfo[playerid][pBank]); | |
| 62 | ShowPlayerDialog(playerid, DIALOG_BALANCE, DIALOG_STYLE_MSGBOX, "Bank account", str, "Back", ""); | |
| 63 | } | |
| 64 | } | |
| 65 | } | |
| 66 | case DIALOG_DEPOSIT: | |
| 67 | {
| |
| 68 | if(!response) return ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel");
| |
| 69 | else if(strval(inputtext) > GetPlayerMoney(playerid)) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount!"); | |
| 70 | else if(!IsNumeric(inputtext)) | |
| 71 | {
| |
| 72 | new str[128]; | |
| 73 | format(str,sizeof(str),"Your Curret Balance Is : $%d\nEnter The Amount You Want To Deposit Below :",PlayerInfo[playerid][pBank]); | |
| 74 | ShowPlayerDialog(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit",str, "Deposit", "Back"); | |
| 75 | SendClientMessage(playerid,COLOR_RED,"Please Use Numbers"); | |
| 76 | } | |
| 77 | else | |
| 78 | {
| |
| 79 | new str[128]; | |
| 80 | new inputext = strval(inputtext); | |
| 81 | PlayerInfo[playerid][pBank] += inputext; | |
| 82 | PlayerInfo[playerid][pCash] -= inputext; | |
| 83 | format(str, sizeof(str), "You have deposited $%d into your account. New balance: $%d", inputext, PlayerInfo[playerid][pBank]); | |
| 84 | SendClientMessage(playerid, 0x008000FF, str); | |
| 85 | } | |
| 86 | } | |
| 87 | case DIALOG_WITHDRAW: | |
| 88 | {
| |
| 89 | if(!response) return ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel");
| |
| 90 | else if(strval(inputtext) > PlayerInfo[playerid][pBank]) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount in your bank"); | |
| 91 | else if(!IsNumeric(inputtext)) | |
| 92 | {
| |
| 93 | new str[128]; | |
| 94 | format(str,sizeof(str),"Your Curret Balance Is : $%d\nEnter The Amount You Want To Withdraw Below :",PlayerInfo[playerid][pBank]); | |
| 95 | ShowPlayerDialog(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Withdraw",str, "Withdraw", "Back"); | |
| 96 | SendClientMessage(playerid,COLOR_RED,"Please Use Numbers"); | |
| 97 | } | |
| 98 | else | |
| 99 | {
| |
| 100 | new str[128]; | |
| 101 | new inputext = strval(inputtext); | |
| 102 | PlayerInfo[playerid][pBank] -= inputext; | |
| 103 | PlayerInfo[playerid][pCash] += inputext; | |
| 104 | format(str, sizeof(str), "You have withdrawn $%d out of your account. New balance: $%d", inputext, PlayerInfo[playerid][pBank]); | |
| 105 | SendClientMessage(playerid, 0x008000FF, str); | |
| 106 | } | |
| 107 | } | |
| 108 | case DIALOG_TRANSFER1: | |
| 109 | {
| |
| 110 | if(!response) return ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel");
| |
| 111 | else if(strval(inputtext) == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"Player Not Online"); | |
| 112 | else if(!IsNumeric(inputtext)) | |
| 113 | {
| |
| 114 | new str[128]; | |
| 115 | format(str,sizeof(str),"Your Current Balance Is : $%d\nEnter The Player ID You Want To Transfer To Below :", PlayerInfo[playerid][pBank]); | |
| 116 | ShowPlayerDialog(playerid,1130,DIALOG_STYLE_INPUT,"Transfer",str,"Next","Back"); | |
| 117 | SendClientMessage(playerid,COLOR_RED,"Please Use ID Not Name"); | |
| 118 | } | |
| 119 | else | |
| 120 | {
| |
| 121 | chosenpid = strval(inputtext); | |
| 122 | new str[128]; | |
| 123 | format(str,sizeof(str),"Balance : %d\nChosen Player ID : %d\nNow Enter The Amount You Want To Transfer",PlayerInfo[playerid][pBank],chosenpid); | |
| 124 | ShowPlayerDialog(playerid,DIALOG_TRANSFER2,DIALOG_STYLE_INPUT,"Transfer",str,"Transfer","Back"); | |
| 125 | } | |
| 126 | } | |
| 127 | case DIALOG_TRANSFER2: | |
| 128 | {
| |
| 129 | if(!response) return ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel");
| |
| 130 | else if(strval(inputtext) > PlayerInfo[playerid][pBank]) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount In Bank To Transfer"); | |
| 131 | else if(!IsNumeric(inputtext)) | |
| 132 | {
| |
| 133 | new str[128]; | |
| 134 | format(str,sizeof(str),"Chosen Player ID : %d\nNow Enter The Amount You Want To Transfer",chosenpid); | |
| 135 | ShowPlayerDialog(playerid,1131,DIALOG_STYLE_INPUT,"Transfer",str,"Transfer","Back"); | |
| 136 | SendClientMessage(playerid,COLOR_RED,"Please Use Numbers"); | |
| 137 | } | |
| 138 | else | |
| 139 | {
| |
| 140 | PlayerInfo[playerid][pBank] -= strval(inputtext); | |
| 141 | PlayerInfo[chosenpid][pBank] += strval(inputtext); | |
| 142 | new str[128]; | |
| 143 | format(str,sizeof(str),"You Transfered $%d To ID %d's Bank Account",strval(inputtext),chosenpid); | |
| 144 | SendClientMessage(playerid, 0x008000FF, str); | |
| 145 | new str2[128]; | |
| 146 | format(str2,128,"Your New Balance Is : $%d",PlayerInfo[playerid][pBank]); | |
| 147 | SendClientMessage(playerid,0x008000FF,str2); | |
| 148 | new str3[128]; | |
| 149 | format(str3,128,"ID : %d Transfered $%d To Your Bank Account",playerid,strval(inputtext)); | |
| 150 | SendClientMessage(chosenpid,0x008000FF,str3); | |
| 151 | new str4[128]; | |
| 152 | format(str4, 128, "Your New Balance : $%d", PlayerInfo[chosenpid][pBank]); | |
| 153 | SendClientMessage(chosenpid, 0x008000FF, str4); | |
| 154 | ShowPlayerDialog(playerid,1125,DIALOG_STYLE_LIST,"Bank","Deposit\nWithdraw\nBalance\nTransfer","Select","Cancel"); | |
| 155 | } | |
| 156 | } | |
| 157 | case DIALOG_BALANCE: | |
| 158 | {
| |
| 159 | if(response) | |
| 160 | {
| |
| 161 | ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel");
| |
| 162 | ||
| 163 | } | |
| 164 | } | |
| 165 | ||
| 166 | } | |
| 167 | ||
| 168 | } | |
| 169 | ||
| 170 | CMD:bank(playerid, params[]) | |
| 171 | {
| |
| 172 | if(!IsPlayerInRangeOfPoint(playerid, 60, 2315.952880,-1.618174,26.742187)) | |
| 173 | {
| |
| 174 | SendClientMessage(playerid,COLOR_RED,"You Have To Be In The Bank"); | |
| 175 | } | |
| 176 | else | |
| 177 | {
| |
| 178 | ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Transfer \n Balance", "Select", "Cancel");
| |
| 179 | } | |
| 180 | return 1; | |
| 181 | } |