Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Hello, I am making an Bank System, but I need help in something to finish it.
- I have tried almost everything but I can't get the Bank Username to check OnPlayerDisconnect callback if the dini exists.
- pawn Code:
- // OnDialogResponse
- case DIALOG_BANKCREATE: // Create Bank Username
- {
- if(!response) return ShowPlayerDialog(playerid, DIALOG_BANKMAIN, DIALOG_STYLE_LIST, "{FFFF00}Bank Account", "Create Bank Account\nLogin Bank Account", "Select", "Cancel");
- if(response) {
- new Rstr[128], Name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Name, sizeof(Name));
- format(Rstr, sizeof(Rstr), BankFile, inputtext);
- if(dini_Exists(Rstr)) return SendClientMessage(playerid, COLOR_RED, "This Bank Username is already registered. Please try with another Username!") && ShowPlayerDialog(playerid, DIALOG_BANKCREATE, DIALOG_STYLE_INPUT, "{FFFF00}Bank Account", "Create Account Username:", "Ok", "Back");
- SetPVarString(playerid, "Username", Rstr);
- dini_Create(Rstr);
- dini_Set(Rstr, "Name", Name);
- dini_IntSet(Rstr, "Registered", 1);
- dini_IntSet(Rstr, "Money", 0);
- return ShowPlayerDialog(playerid, DIALOG_BANKCREATEPASS, DIALOG_STYLE_INPUT, "{FFFF00}Bank Account", "Create Account Password:", "Ok", "Back");
- }
- }
- case DIALOG_BANKCREATEPASS: // Create Bank Password
- {
- if(!response) return ShowPlayerDialog(playerid, DIALOG_BANKCREATE, DIALOG_STYLE_INPUT, "{FFFF00}Bank Account", "Create Account Username:", "Ok", "Back");
- if(response) {
- new name[64], buf[129];
- GetPVarString(playerid, "Username", name, sizeof(name));
- WP_Hash(buf, sizeof(buf), inputtext);
- dini_Set(name, "Password", buf);
- BankSettings[playerid][BANK_REGISTERED] = 1;
- return ShowPlayerDialog(playerid, DIALOG_BANKSETTINGS, DIALOG_STYLE_LIST, "{FFFF00}Account Settings", "Balance\nWithdraw\nDeposit\nTransfer\nChange Account Password\nDelete Account", "Ok", "Back");
- }
- }
- Players are able to create a Bank Username and a Bank Password.
- I have set PVar to Get the Bank Username on the Dialog about Password.
- The username is totally different with Player's Name.
- pawn Code:
- // OnPlayerDisconnect
- // ** Save Bank Account's Money ** //
- format(str, sizeof(str), "Admin/BankAccount/%s.ini", GetPVarString(playerid, "Username", str, sizeof(str)));
- if(dini_Exists(str)) {
- dini_IntSet(str, "Money", BankSettings[playerid][BANK_MONEY]);
- }
- I have tried to get the Bank Usernamefrom the PVar I set it before and check if the file exists on the File Location.
- But it's doesn't work. It doesn't save the money.
- How can I get the Bank Username and set it OnPlayerDisconnect to check if the file exists, to continue by saving the money.
Add Comment
Please, Sign In to add comment