Advertisement
Harexe2

Untitled

Jul 7th, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. forward BankSacuvaj(playerid);
  2. public BankSacuvaj(playerid)
  3. {
  4. new Bankfile[64],name[MAX_PLAYER_NAME];
  5. GetPlayerName(playerid,name,sizeof(name));
  6. format(Bankfile,sizeof(Bankfile),"/bank/%s.txt",name);
  7. dini_IntSet(Bankfile,"banks",GetPVarInt(playerid,"banks"));
  8.  
  9.  
  10. return 1;
  11. }
  12.  
  13.  
  14.  
  15. public OnPlayerCommandText(playerid, cmdtext[])
  16. {
  17. if (strcmp("/bank", cmdtext, true, 10) == 0)
  18. {
  19. new string[128];
  20. format(string,sizeof(string),"Trenutno stanje na vasem racunu %d",GetPVarInt(playerid,"banks"));
  21.  
  22. ShowPlayerDialog(playerid,3,DIALOG_STYLE_LIST,string,"Deposit money\nWithdraw money\nTransfer money","OK","Cancel");
  23.  
  24.  
  25.  
  26. return 1;
  27. }
  28. if (strcmp("/bakar", cmdtext, true, 10) == 0)
  29. {
  30. GivePlayerMoney(playerid,1000000);
  31. return 1;
  32. }
  33.  
  34. return 0;
  35. }
  36.  
  37.  
  38.  
  39.  
  40.  
  41. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  42. {
  43.  
  44. if(dialogid == 3)
  45. {
  46. if (response)
  47. {
  48. if (listitem == 0)
  49. {
  50. ShowPlayerDialog(playerid,4,DIALOG_STYLE_INPUT,"Deposit","Koliko zelis prebacit","OK","Cancel");
  51. if (listitem == 1)
  52. {
  53. ShowPlayerDialog(playerid,5,DIALOG_STYLE_INPUT,"Withdraw","Koliko Zelis sebi uzeti","OK","Cancel");
  54. if (listitem == 2)
  55. {
  56. ShowPlayerDialog(playerid,6,DIALOG_STYLE_INPUT,"Transfer","Koliko zelis prebacit na drugi racun","OK","Cancel");
  57. }
  58. }
  59. }
  60. }
  61.  
  62. if(dialogid == 4)
  63. {
  64. if(response)
  65. {
  66.  
  67. if(GetPlayerMoney(playerid) < strval(inputtext))
  68. {
  69. SCM(playerid,CRVENA,"Neas dovoljno novca!");
  70. }
  71. else
  72. {
  73. GivePlayerMoney(playerid,-strval(inputtext));
  74. SetPVarInt(playerid,"banks",GetPVarInt(playerid,"banks") + strval(inputtext));
  75. }
  76. }
  77. }
  78. if(dialogid == 5)
  79. {
  80. if(response)
  81. {
  82.  
  83. if(GetPVarInt(playerid,"banks") < strval(inputtext))
  84. {
  85. SCM(playerid,CRVENA,"Neas dovoljno novca!");
  86. }
  87. else
  88. {
  89. GivePlayerMoney(playerid,strval(inputtext));
  90. SetPVarInt(playerid,"banks",GetPVarInt(playerid,"banks") - strval(inputtext));
  91. }
  92. }
  93. }
  94. if(dialogid == 6)
  95. {
  96. if(response)
  97. {
  98. new pID,pname[MAX_PLAYER_NAME],string[128];
  99. GetPlayerName(pID,pname,sizeof(pname));
  100. if(IsPlayerConnected(pID))return SCM(playerid,CRVENA,"Igrac nije Online");
  101. {
  102.  
  103. format(string,sizeof(string),"Ok izabrao siigraca %s",pname);
  104. SCM(playerid,CRVENA,string),
  105. ShowPlayerDialog(playerid,7,DIALOG_STYLE_INPUT,"Transfer","Koliko zelis poslati","OK","Cancel");
  106.  
  107.  
  108. }
  109. }
  110. }
  111. if(dialogid == 7)
  112. {
  113. if(response)
  114. {
  115. new pname[MAX_PLAYER_NAME],pID,name[MAX_PLAYER_NAME],string1[128],string2[128];
  116. GetPlayerName(playerid,name,sizeof(name));
  117. GetPlayerName(pID,pname,sizeof(pname));
  118. if(GetPVarInt(playerid,"banks") < strval(inputtext))
  119. {
  120. SCM(playerid,CRVENA,"Neas dovoljno novca");
  121. }
  122. else
  123. {
  124. SetPVarInt(pID,"banks",GetPVarInt(playerid,"banks") + strval(inputtext));
  125. SetPVarInt(playerid,"banks",GetPVarInt(playerid,"banks") - strval(inputtext));
  126. format(string1,sizeof(string1),"Dao si %s %s",pname,strval(inputtext));
  127. SCM(playerid,CRVENA,string1);
  128. format(string1,sizeof(string1),"Dao ti je %s %s",name,strval(inputtext));
  129. SCM(playerid,CRVENA,string2);
  130. }
  131. }
  132. }
  133. }
  134. return 1;
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement