PDA

View Full Version : [Include] [INC] pBank |0.2 Released|


Pixels^
17/09/2008, 12:23 AM
pBank [Extensive Banking System]

Details:

Unlike most other bank scripts which are in filterscripts and can't really be controlled by the scripter, pBank is inside an include and can be very extensive when used properly. It contains the basic bank functions, then there are special ones such as the loan system. This system is in it's beta mode is more and more features should pop up soon.


Function Info:

pBank_CreateBankAccount(Owner[],Balance,AccountPass[])
Allows you to create a bank account with a starting balance and an account password. The owner can be a gang group, an individual, or a security force. Whatever comes to mind! See Example.pwn inside RAR for an example on how it works and how it is used.


pBank_GetBankBalance(Owner[])
Lets you get the bank balance of the specified owner. See Example.pwn inside RAR for an example on how it works and how it is used.


pBank_SetBankBalance(Owner[],Amount)
Lets you set the bank balance of the specified owner. See Example.pwn inside RAR for an example on how it works and how it is used.


pBank_LoginPlayerToBank(Owner[],AccountPass[])
Can/Should be used inside a login command. Logins the player to his account. If AccountPass[] does not match with the one that is inside the bank file, then the player can't login. See Example.pwn inside RAR for an example on how it works and how it is used.


pBank_DepositMoney(Owner[],Amount)
The basic deposit function. Let's you deposit money from your pocket to the bank account. See Example.pwn inside RAR for an example on how it works and how it is used.


pBank_WithdrawMoney(Owner[],Amount)
The basic withdraw function. Let's you withdraw money from your bank account. See Example.pwn inside RAR for an example on how it works and how it is used.


pBank_DeleteBankAccount(Owner[])
Allows you to delete your bank account. See Example.pwn inside RAR for an example on how it works and how it is used.


pBank_PlayerGetLoan(Player[],Amount)
Allows you to get a loan from the bank of any amount. That loan is placed in your bank file which you can pay off whenever you want. There is no security on this function on how much you can take from the bank or when you have to pay. That is up to the scripter to decide. I decided to leave the security out so that the scripter can expand his system without the security's limitation. See Example.pwn inside RAR for an example on how it works and how it is used.


pBank_PlayerPaymentOnLoan(Player[],PartialPayment)
Let's you pay any amount to the loan you have on your account. If you owe the bank $100, and you pay $150, the $50 left over is then deposited to your account. See Example.pwn inside RAR for an example on how it works and how it is used.


pBank_WireTransfer(Sender[],Receiver[],Amount)
Let's you transfer funds from your account to somebody elses. See Example.pwn inside RAR for an example on how it works and how it is used.


pBank_PlayerDisconnect(Player[])
This function must be used! Place it at the OnPlayerDisconnect callback. If not used, the player won't be logged out, his pocket money won't be saved, and the next person with his same id, will be able to use his account! See Example.pwn inside RAR for an example on how it works and how it is used.



Credits/Notes:


Credits to DracoBlue for his dini! I plan on using djSon in the next versions, but only when I get the hang of it.


To modify or redistribute you need my permission.

If you have a suggestion, please post it. I would love to add more features into this script. Also report any bugs you find. Have trouble? I will be more than happy to help you resolve it, just don't PM me the question!


Download:
See below for 0.2 download.

__________________________________________________ ________________________________________

0.2 Update [pBank]

0.2 Update:

Update 0.2 contains a new feature and due to this new feature, is not backwards compatible with pBank 0.1. The new added feature are adjustable interest rates for each account and an adjustable interest interval(default=1hr).



0.2 New Functions:

pBank_GameModeInit()
Without using this function in your OnGameModeInit callback, the interest feature will not work! See Example.pwn inside RAR for an example on how it works and how it is used.


pBank_SetInterestRate(Owner[],Percent)
Allows you to set the interest rate for a person's bank account. See Example.pwn inside RAR for an example on how it works and how it is used.


pBank_RemoveInterest(Owner[])
Removes a set interest rate from a person's bank account. See Example.pwn inside RAR for an example on how it works and how it is used.


pBank_SetInterestInterval(time)
Sets the interval when each interest is deposited into the applicable accounts. Setting to 0 will disable, default is 1 hour. See Example.pwn inside RAR for an example on how it works and how it is used.



0.2 Download:

http://rapidshare.com/files/146463498/pBank__Pixels__.rar.html
http://www.sendspace.com/file/pdag37

webflashing
17/09/2008, 12:37 AM
Really nice Pixels^!. I will try this for sure!.

I really like your scripts :mrgreen:

Cheers,
Web

Pixels^
17/09/2008, 12:44 AM
I'm not Seif! >:( :'(

webflashing
17/09/2008, 12:48 AM
God.. i ALWAYS do the same thing with both of you...

Although i wrote Seif, i wanted to say Pixels^ :mrgreen:

You both are the best ones around here so i mix up things :P

Sorry :D

Cheers,
Web

Pixels^
17/09/2008, 12:53 AM
Damn you.
http://icanhascheezburger.files.wordpress.com/2008/09/funny-pictures-cat-is-suspicious-of-your-intentions.jpg

[Jay]
17/09/2008, 01:48 AM
Wow, very interesting. What if somone already has a banking system in there script? will it still take effect? or create a huge bug? XD

EDIT: pBank_WireTransfer(Sender[],Receiver[],Amount)

Do the people gotta be online? Cuz if not they can easily send the money to there other account, and get richer bit by bit.

Pixels^
17/09/2008, 01:53 AM
This is not a filterscript! It is an include! It doesn't automatically run, the scripter that uses the include decides what can happen, when it can happen, and how it can happen.

Rome101
17/09/2008, 04:46 PM
Awesome, absolutely awesome. Mind if I change it a bit on a server I'm planning? Of course credits remains completley yours.

Pixels^
17/09/2008, 08:43 PM
Awesome, absolutely awesome. Mind if I change it a bit on a server I'm planning? Of course credits remains completley yours.
Why not.

sebihunter
18/09/2008, 02:28 PM
thats very nice, gonna maybe use the inc for my gamemode

Antironix
18/09/2008, 02:51 PM
I have a suggestion, add adjustable interest to the banks ;)

Donuts
18/09/2008, 03:12 PM
This is a great work, this will very helpfull to all, :arrow: great work.

Pixels^
18/09/2008, 08:54 PM
I have a suggestion, add adjustable interest to the banks ;)
Very nice. I will add it for 0.2.

Edit: 0.2 Released. Check first post!

romeotheboss
19/09/2008, 01:10 PM
coool very nice indeed :P












RESPECT ;)

gijs_min
15/11/2008, 11:54 AM
can anyone help me here to script a createbank command?

(i ask it in scripting discussions and they say i ask it here)

x-cutter
15/11/2008, 03:38 PM
can anyone help me here to script a createbank command?

(i ask it in scripting discussions and they say i ask it here)


Check Example.pwn..


Nice script, I'm gonna use it for sure!

('ve been searching for a good, Easily customisable bank scriptz for yearz!)

Thanks

gijs_min
16/11/2008, 11:26 AM
can any one help me
i will the bank accounts not in the script files folder
if you think i'm stupid try it :roll:

MenaceX^
16/11/2008, 11:28 AM
Oh you came here to double posting too? Just wait for an answer..

Pixels^
16/11/2008, 05:37 PM
They are saved in scriptfiles folder.

x-cutter
07/12/2008, 12:48 AM
whenever I include the .inc, it gives me an error

stock ReturnModeratorCmd(playerid,reqlvl) // By X_Cutter
{
new remcmd[50]; // This line returns the error
format(remcmd,sizeof(remcmd),"Only moderators level %d+ can use this command!",reqlvl);
return SendClientMessage(playerid,Green,remcmd);
}

ERROR:
[...]\pawno\include\pBank.inc(231) : error 001: expected token: ";", but found "-identifier-"

Donuts
07/12/2008, 12:51 AM
The error is not on your script! It's on the include include\pBank.inc(231)

Check the line 231 of the file 'pBank.inc'

x-cutter
07/12/2008, 01:05 AM
The error is not on your script! It's on the include include\pBank.inc(231)

Check the line 231 of the file 'pBank.inc'


Thanks ;)

There was a missing ;

LightFight™
07/12/2008, 01:43 AM
Very Useful ! ;)

x-cutter
07/12/2008, 01:55 AM
[list] pBank_WireTransfer(Sender[],Receiver[],Amount)
Let's you transfer funds from your account to somebody elses. See Example.pwn inside RAR for an example on how it works and how it is used.


in the Example.pwn there is no example on how to use WireTransfer... You should edit it/pos an example here plz.
BTW this script is god-like! I have made some /bankregister, /banklogin, /balance, /deposit, /withdraw, /bankquit commands with no problem! I have even made it so you can only use /banklogin, /balance, /deposit and /withdraw in 24/7s or in the federal government building and you can only use /bankregister and /bankquit in the federal government building.

This script is fuly customisable, I like it much. It helped alot my RP server...

Thanks again,

Cutter

x-cutter
07/12/2008, 01:25 PM
I am having problems with this script.
Here is my code:
if(strcmp(cmd,"/bankregister",true)==0)
{
new tmp[256];
new playername[256];
new string[256];
tmp=strtok(cmdtext,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,DarkGreen,"USAGE : /bankregister [password]");
return 1;
}
if(!PlayerToPoint(3.0,playerid,2316.6160,-7.5284,26.7422)) return SendClientMessage(playerid,AdminRed,"Must be near the bank counter!");
if(PlayerStats[playerid][BankLogged]==1) return SendClientMessage(playerid,AdminRed,"You're already logged in!");
GetPlayerName(playerid,playername,sizeof(playernam e));
new fstring[50];
format(fstring,50,"%s.xcu",udb_encode(playername));
new create=pBank_CreateBankAccount(fstring,-100,tmp);
if(create == -1)
{
SendClientMessage(playerid,DarkGreen,"You have already registered a bank account under this name!");
SendClientMessage(playerid,DarkGreen,"Use /banklogin [password] to login into your bank account!");
return 1;
}
format(string,sizeof(string),"You are now bankregistered under playername %s and password %s!",playername,tmp);
SendClientMessage(playerid,DarkGreen,string);
printf("%s registered a bank account with password %s",playername,tmp);
return 1;
}
if(strcmp(cmd,"/banklogin",true)==0)
{
new tmp[256];
new playername[256];
tmp=strtok(cmdtext,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,DarkGreen,"USAGE : /banklogin [password]");
return 1;
}
if(!PlayerToPoint(3.0,playerid,2316.6160,-7.5284,26.7422)) return SendClientMessage(playerid,AdminRed,"Must be near the bank counter!");
if(PlayerStats[playerid][BankLogged]==1) return SendClientMessage(playerid,AdminRed,"You're already logged in!");
GetPlayerName(playerid,playername,sizeof(playernam e));
new fstring[50];
format(fstring,50,"%s.xcu",udb_encode(playername));
new login=pBank_LoginPlayerToBank(fstring,tmp);
if(login==-1)
{
SendClientMessage(playerid,DarkGreen,"Invalid Password!");
return 1;
}
if(login==0)
{
SendClientMessage(playerid,DarkGreen,"You have not registered a bank account yet under this name!");
SendClientMessage(playerid,DarkGreen,"Use /bankregister [password] to create a bank account!");
return 1;
}
PlayerStats[playerid][BankLogged]=1;
SendClientMessage(playerid,DarkGreen,"You have successfully logged in into your bank account!");
return 1;
}

/bankregister works, but after I use the command it says SERVER : Unknown Command
/banklogin doesn't work, it keeps saying invalid password...

Help?

This is an freakin annoying bug.. thx for helping

NOTE : This is not my script's identation... lol

SuperS0nic
24/01/2009, 07:37 PM
how do i fix line 231?
dini_IntSet(tmp,"AccountBalance",total);

Fish
26/06/2009, 12:03 PM
It's a good script but I wanted something simialer of a bank..

You login from ordinary command and then you have access to your account... It's not like people will hack your account to get your server cash... (Understand this may cater for roleplay)


Do you think you could make a much more freeroamish one? were there isnt such restrictions as making a pass for bank ?? :C

But thanks anyways for the release ;) :D

[ProX]BlueFire
31/03/2011, 02:53 PM
it doesnt work...
can u upload it to solidfiles?

Medal Of Honor team
31/03/2011, 02:54 PM
I will definitely use it

[ProX]BlueFire
02/04/2011, 07:23 PM
i saw thet:
public OnPlayerDisconnect(playerid, reason)
{
pBank_PlayerDisconnect("Pixels");
//if your name isn't Pixels, too bad :D
return 1;
}
in ur example script...
do i have to put the name of the player in the ("") ???

[ProX]BlueFire
02/04/2011, 07:27 PM
The error is not on your script! It's on the include

Check the line 231 of the file 'pBank.inc'

i have fixed it for him :D
download it from here::
click here to download (http://solidfiles.com/d/c85d7/)