Guest User

Untitled

a guest
May 18th, 2018
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. Hello, I am making an Bank System, but I need help in something to finish it.
  2. I have tried almost everything but I can't get the Bank Username to check OnPlayerDisconnect callback if the dini exists.
  3.  
  4. pawn Code:
  5.  
  6. // OnDialogResponse
  7. case DIALOG_BANKCREATE: // Create Bank Username
  8. {
  9. if(!response) return ShowPlayerDialog(playerid, DIALOG_BANKMAIN, DIALOG_STYLE_LIST, "{FFFF00}Bank Account", "Create Bank Account\nLogin Bank Account", "Select", "Cancel");
  10. if(response) {
  11. new Rstr[128], Name[MAX_PLAYER_NAME];
  12. GetPlayerName(playerid, Name, sizeof(Name));
  13. format(Rstr, sizeof(Rstr), BankFile, inputtext);
  14. 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");
  15. SetPVarString(playerid, "Username", Rstr);
  16. dini_Create(Rstr);
  17. dini_Set(Rstr, "Name", Name);
  18. dini_IntSet(Rstr, "Registered", 1);
  19. dini_IntSet(Rstr, "Money", 0);
  20. return ShowPlayerDialog(playerid, DIALOG_BANKCREATEPASS, DIALOG_STYLE_INPUT, "{FFFF00}Bank Account", "Create Account Password:", "Ok", "Back");
  21. }
  22. }
  23. case DIALOG_BANKCREATEPASS: // Create Bank Password
  24. {
  25. if(!response) return ShowPlayerDialog(playerid, DIALOG_BANKCREATE, DIALOG_STYLE_INPUT, "{FFFF00}Bank Account", "Create Account Username:", "Ok", "Back");
  26. if(response) {
  27. new name[64], buf[129];
  28. GetPVarString(playerid, "Username", name, sizeof(name));
  29. WP_Hash(buf, sizeof(buf), inputtext);
  30. dini_Set(name, "Password", buf);
  31. BankSettings[playerid][BANK_REGISTERED] = 1;
  32. return ShowPlayerDialog(playerid, DIALOG_BANKSETTINGS, DIALOG_STYLE_LIST, "{FFFF00}Account Settings", "Balance\nWithdraw\nDeposit\nTransfer\nChange Account Password\nDelete Account", "Ok", "Back");
  33. }
  34. }
  35. Players are able to create a Bank Username and a Bank Password.
  36. I have set PVar to Get the Bank Username on the Dialog about Password.
  37. The username is totally different with Player's Name.
  38.  
  39. pawn Code:
  40.  
  41. // OnPlayerDisconnect
  42. // ** Save Bank Account's Money ** //
  43. format(str, sizeof(str), "Admin/BankAccount/%s.ini", GetPVarString(playerid, "Username", str, sizeof(str)));
  44. if(dini_Exists(str)) {
  45. dini_IntSet(str, "Money", BankSettings[playerid][BANK_MONEY]);
  46. }
  47. I have tried to get the Bank Usernamefrom the PVar I set it before and check if the file exists on the File Location.
  48. But it's doesn't work. It doesn't save the money.
  49. 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