09.06.2011, 15:30
(
Последний раз редактировалось *IsBack; 15.07.2011 в 20:57.
Причина: v0.2 released
)
SiJ Bankv0.2
MySQL based bank system
MySQL based bank system
Introduction
I've been scripting for 3 years now, and I've decided to release something too.
This is a Bank System include, that will help advanced scripters to add Bank System to their server (beginner scripters may just need to download a bank system's filterscript).
Currently it contains only 1 ATM (at SF Airport). I didn't have enough time to put more (you should add then yourself)
It uses G-sTyLeZzZ MySQL plugin and pVars.
Functions
Download
Download here! (v0.2)
Pastebin (v0.1) (use the link above to download the .inc file!)
Usage
Place these into your gamemode:
Create a MySQL table (use this query):
Add your own ATMs:
Create an ATM object in your favorite map editor, put it into your script, and add it's coordinates under
stock IsAtATM(playerid) at the include file.
Make ATM available to use
You can make this in many ways. I prefer using /ATM command:
Bugs/Suggestions/Other Info
Changes in 0.2
I've been scripting for 3 years now, and I've decided to release something too.
This is a Bank System include, that will help advanced scripters to add Bank System to their server (beginner scripters may just need to download a bank system's filterscript).
Currently it contains only 1 ATM (at SF Airport). I didn't have enough time to put more (you should add then yourself)
It uses G-sTyLeZzZ MySQL plugin and pVars.
Functions
- SijBankConnect(playerid); - This goes under OnPlayerConnect(..) callback
- SijBankDisconnect(playerid); - This goes under OnPlayerDisconnect(..) callback
- SijBankDialog(playerid,dialogid,response,listitem, inputtext[]); - This goes under OnDialogResponse(..) callback
- CreateBankAccount(playerid,pin[5],money); - Creates a new bank account (1 account per player!)
- GetBankBalance(playerid); - Gets player's bank balance
- SetBankPIN(playerid,PIN[5]); - Changes the bank PIN code (needed to use ATM)
- GetBankPIN(playerid);
- ShowBankDialog(playerid,type); - Shows the ATM dialog
- IsLoggedToBank(playerid); - Checks if player is logged in to the ATM
- LoginToBank(playerid,PIN[5]); - Logins to bank (returns 0 if PIN code is wrong; -1 if PIN code is invalid; 1 on success)
- LogoutFromBank(playerid);
- GiveBankMoney(playerid,amount); - Use this to add money to player's bank account (for online players)
- GiveBankMoneyEx(cname[24],amount); - Use this to add money to player's bank account (for offline players, by using their username)
- TakeBankMoney(playerid,amount);
- TakeBankMoneyEx(cname[24],amount);
- IsAtATM(playerid); - Checks if player is at ATM
Download
Download here! (v0.2)
Pastebin (v0.1) (use the link above to download the .inc file!)
Usage
Place these into your gamemode:
pawn Код:
//At the top:
#include <SiJ_Bank>
//Under OnPlayerConnect(...) callback:
SijBankConnect(playerid);
//Under OnPlayerDisconnect(...):
SijBankDisconnect(playerid);
//Under OnDialogResponse(...):
SijBankDialog(playerid,dialogid,response,listitem,inputtext);
Код:
CREATE TABLE `bank` ( `username` VARCHAR(24) NOT NULL, `pin` INT(4) NOT NULL COMMENT 'May not be longer than 4 digits!', `balance` INT(10) NULL, UNIQUE INDEX `username` (`username`) ) COMMENT='SiJ_Bank include' COLLATE='utf8_general_ci' ENGINE=MyISAM ROW_FORMAT=DEFAULT
Create an ATM object in your favorite map editor, put it into your script, and add it's coordinates under
stock IsAtATM(playerid) at the include file.
Make ATM available to use
You can make this in many ways. I prefer using /ATM command:
pawn Код:
//Under OnPlayerCommandText(...):
if(!strcmp(cmdtext,"/ATM",true))
{
if(IsAtATM(playerid))
{
ShowBankDialog(playerid,1);
}
else SendClientMessage(playerid,COLOR,"You should be near ATM to use this!");
}
Changes in 0.2
- Fixed all the bugs
- Added CreateBankAccount(..) function (forgot to put it to 0.1)