SS Wehrmacht Posted July 26, 2016 Share Posted July 26, 2016 (edited) Astazi va prezint un mic system mai exact un Bank System, ce include: Creearea unui cont bancar Fiecare cont are o parola setata de player Puteti sa achizitionati si un card Si cateva comenzi specifice #include <a_samp> #include <dini> #include <sscanf2> #include <zcmd> //--------------- #define COLOR_WHITE 0xFFFFFFFF #define COLOR_GREY 0x999999FF #define COLOR_YELLOW 0xFFFF00FF #define FILTERSCRIPT #define BANK_FILE "Bank/%s.ini" #define PRESSED(%0) \ (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) //--------------- enum pInfo { BankAcc, Bcash, Cash, BankPass, BankOpen, Card } new PlayerInfo[MAX_PLAYERS][pInfo]; public OnFilterScriptInit() { printf("\n======================="); printf("Bank System 1.0 by James_Carter"); printf(">> Status: LOADED !"); printf("=======================\n"); return 1; } public OnFilterScriptExit() { printf("\n======================="); printf("Bank System 1.0 by James_Carter"); printf(">> Status: UNLOADED !"); printf("=======================\n"); return 1; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(PRESSED(KEY_SECONDARY_ATTACK)) { if(IsPlayerInRangeOfPoint(playerid, 4.0,1464.1750,-1011.3233,26.8438))//BANK EXTERIOR { SetPlayerPos(playerid,2315.952880,-1.618174,26.742187); SetPlayerInterior(playerid,0); if(PlayerInfo[playerid][bankAcc] == 0) { SendClientMessage(playerid,COLOR_YELLOW,"[bank]: You can create a bank account for free using /bankaccount !"); } if(PlayerInfo[playerid][Card] == 0) { SendClientMessage(playerid,COLOR_YELLOW,"[bank]: You can buy for 25.000$ your card using /card !"); } } else if(IsPlayerInRangeOfPoint(playerid, 2.0,2315.952880,-1.618174,26.742187))//BANK INTERIOR { SetPlayerPos(playerid,1464.1750,-1011.3233,26.8438); PlayerInfo[playerid][bankOpen] = 0; SetPlayerInterior(playerid,0); } } return 1; } public OnPlayerConnect(playerid) { new name[MAX_PLAYER_NAME],file[128]; GetPlayerName(playerid,name,sizeof(name)); format(file,sizeof(file),BANK_FILE,name); if(!dini_Exists(file)) { dini_Create(file); dini_IntSet(file,"BankAcc",PlayerInfo[playerid][bankAcc] = 0); dini_IntSet(file,"BankCash",PlayerInfo[playerid][bcash] = 0); dini_IntSet(file,"Money",PlayerInfo[playerid][Cash] = 25000); dini_IntSet(file,"BankPassword",PlayerInfo[playerid][bankPass] = -1); dini_IntSet(file,"AccountOpen",PlayerInfo[playerid][bankOpen] = 0); dini_IntSet(file,"Card",PlayerInfo[playerid][Card] = 0); } else { PlayerInfo[playerid][bankAcc] = dini_Int(file,"BankAcc"); PlayerInfo[playerid][bcash] = dini_Int(file,"BankCash"); PlayerInfo[playerid][Cash] = dini_Int(file,"Cash"); PlayerInfo[playerid][bankPass] = dini_Int(file,"BankPassword"); PlayerInfo[playerid][bankOpen] = dini_Int(file,"AccountOpen"); PlayerInfo[playerid][Card] = dini_Int(file,"Card"); } return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 1) { if(PlayerInfo[playerid][bankAcc] == 0) { if(strval(inputtext) > 9999 || strval(inputtext) < 999) return ShowPlayerDialog(playerid,4,DIALOG_STYLE_INPUT,"Bank Account","Your password must contain only numbers and must have 4 characters !","Create","Cancel"); else { PlayerInfo[playerid][bankAcc] = 1; PlayerInfo[playerid][bankOpen] = 1; PlayerInfo[playerid][bankPass] = strval(inputtext); SendClientMessage(playerid,COLOR_YELLOW,"[info]: Bank account succesfully created !"); SendClientMessage(playerid,COLOR_YELLOW,"Now you can withdraw or deposit money in the bank !"); } } else return ShowPlayerDialog(playerid,5,DIALOG_STYLE_INPUT,"Bank Account","Please type your bank account password","Login","Cancel"); } if(dialogid == 2) { if(!response) { PlayerInfo[playerid][bankOpen] = 0; } else { new file[128],tmp,name[MAX_PLAYER_NAME],str[128]; GetPlayerName(playerid,name,sizeof(name)); format(file,sizeof(file),BANK_FILE,name); tmp = dini_Int(file, "BankPassword"); if(tmp != strval(inputtext)) return ShowPlayerDialog(playerid,5,DIALOG_STYLE_INPUT,"Bank Account","The password you entered is not correct !","Login","Cancel"); else if(!response) { PlayerInfo[playerid][bankOpen] = 0; } else if(tmp == strval(inputtext)) { format(str,sizeof(str),"[info]: Password match,welcome dear {ff0000}%s{ffff00} at L.S. Central Bank.",name); SendClientMessage(playerid,COLOR_YELLOW,str); PlayerInfo[playerid][bankOpen] = 1; } } } if(dialogid == 3) { if(response) { if(listitem == 1) { if(GetPlayerMoney(playerid) >= 25000) { PlayerInfo[playerid][Card] = 1; new oldcash = GetPlayerMoney(playerid); ResetPlayerMoney(playerid); GivePlayerMoney(playerid,oldcash-25000); SendClientMessage(playerid,COLOR_YELLOW,"[info]: You have succesfully bought the card !"); } else{SendClientMessage(playerid,COLOR_GREY,"You don't have enough money !");} } if(listitem == 2) { if(PlayerInfo[playerid][bcash] >= 25000) { PlayerInfo[playerid][Card] = 1; PlayerInfo[playerid][bcash] -= 25000; SendClientMessage(playerid,COLOR_YELLOW,"[info]: You have succesfully bought the A.T.M. card !"); } else{SendClientMessage(playerid,COLOR_GREY,"You don't have enough money !");} } } else if(!response) return SendClientMessage(playerid,COLOR_GREY,"[bank]: You can come back everytime to get your card !"); } return 1; } //---------------[bank CMD's]--------------------------- CMD:withdraw(playerid,params[]) { new cash,bank; new string[128],name[MAX_PLAYER_NAME]; if(PlayerInfo[playerid][bankAcc] == 1) { if(IsPlayerInRangeOfPoint(playerid,5.0,2316.6194,-9.9600,26.7422)) { if(PlayerInfo[playerid][bankOpen] == 1) { if(sscanf(params,"i",bank)) return SendClientMessage(playerid,COLOR_GREY,"Syntax: /withdraw [Amount]"); else if(bank <= 0) return SendClientMessage(playerid,COLOR_GREY,"The minimun amount is 1$ !"); else if(PlayerInfo[playerid][bcash] < bank) return SendClientMessage(playerid,COLOR_GREY,"You don't have enough money !"); else { GetPlayerName(playerid,name,sizeof(name)); PlayerInfo[playerid][bcash] -= bank; PlayerInfo[playerid][Cash] += bank; cash = GetPlayerMoney(playerid); ResetPlayerMoney(playerid); GivePlayerMoney(playerid, cash+bank); format(string,sizeof(string),"[info]:{FFFFFF} You have taken from your bank account {FFFF00}%d{009900}${FFFFFF}.",bank); SendClientMessage(playerid,COLOR_YELLOW,string); } } else{SendClientMessage(playerid,COLOR_GREY,"First request permission to withdraw money from bank account desk office by typing your bank password !");} } else{SendClientMessage(playerid,COLOR_GREY,"You must be inside the bank at withdraw desk office !");} } else{SendClientMessage(playerid,COLOR_GREY,"You don't have a bank account !");SendClientMessage(playerid,COLOR_GREY,"Go to {FFFF00}Los Santos Central Bank{B5B1B0} and create one.");} return 1; } CMD:deposit(playerid,params[]) { new cash,bank; new string[128],name[MAX_PLAYER_NAME]; if(PlayerInfo[playerid][bankAcc] == 1) { if(IsPlayerInRangeOfPoint(playerid,5.0,2316.6208,-12.7549,26.7422)) { if(PlayerInfo[playerid][bankOpen] == 1) { if(sscanf(params,"i",bank)) return SendClientMessage(playerid,COLOR_GREY,"Syntax: /deposit [Amount]"); else if(bank <= 0) return SendClientMessage(playerid,COLOR_GREY,"The minimun amount is 1$ !"); else if(PlayerInfo[playerid][Cash] < bank) return SendClientMessage(playerid,COLOR_GREY,"You don't have enough money !"); else { GetPlayerName(playerid,name,sizeof(name)); PlayerInfo[playerid][bcash] += bank; PlayerInfo[playerid][Cash] -= bank; cash = GetPlayerMoney(playerid); ResetPlayerMoney(playerid); GivePlayerMoney(playerid, cash-bank); format(string,sizeof(string),"[info]:{FFFFFF} You have put in your bank account {FFFF00}%d{009900}${FFFFFF}.",bank); SendClientMessage(playerid,COLOR_YELLOW,string); } } else{SendClientMessage(playerid,COLOR_GREY,"First request permission to withdraw money from bank account desk office by typing your bank password !");} } else{SendClientMessage(playerid,COLOR_GREY,"You must be inside the bank at deposit desk office !");} } else{SendClientMessage(playerid,COLOR_GREY,"You don't have a bank account !");SendClientMessage(playerid,COLOR_GREY,"Go to {ffff00}Los Santos Central Bank{B5B1B0} and create one.");} return 1; } CMD:bankaccount(playerid,params[]) { if(IsPlayerInRangeOfPoint(playerid,5.0,2309.0051,-2.3579,26.7422)) { if(PlayerInfo[playerid][bankAcc] == 0) { ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Bank Account","Create your bank account by typing a password, and don't forget your password !","Create","Cancel"); } else if(PlayerInfo[playerid][bankAcc] == 1) { ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Bank Account","Please type your bank account password","Login","Cancel"); } } else{SendClientMessage(playerid,COLOR_GREY,"You must be inside the bank at {ffff00}bank account desk office{B5B1B0} !");} return 1; } CMD:balance(playerid,params[]) { new string[128]; if(IsPlayerInRangeOfPoint(playerid,5.0,2308.8706,-13.2487,26.7422)) { if(PlayerInfo[playerid][bankOpen] == 1) { SendClientMessage(playerid,COLOR_YELLOW,"|__________[Account Info]__________|"); format(string,sizeof(string),"Money: {ffff00}%d{009900}$",PlayerInfo[playerid][bcash]); SendClientMessage(playerid,COLOR_WHITE,string); } else{SendClientMessage(playerid,COLOR_GREY,"First request permission to check your account from {ffff00}bank account desk office{B5B1B0} by typing your bank {ffff00}password{B5B1B0} !");} } else{SendClientMessage(playerid,COLOR_GREY,"You must be inside the bank at {ffff00}balance computer{B5B1B0} !");} return 1; } CMD:card(playerid,params[]) { if(IsPlayerInRangeOfPoint(playerid,5.0,2309.1914,-8.4871,26.7422)) { if(PlayerInfo[playerid][bankAcc] == 1) { if(PlayerInfo[playerid][Card] == 0) { ShowPlayerDialog(playerid,6,DIALOG_STYLE_LIST,"Bank Account [Card]]","|-----------------------------------[How do you will pay ?]-----------------------------------|\nBy cash\nBy bank account","Select","Cancel"); } else{SendClientMessage(playerid,COLOR_GREY,"You already have the card !");} } else{SendClientMessage(playerid,COLOR_GREY,"You don't have a bank account !");} } else{SendClientMessage(playerid,COLOR_GREY,"You must be inside the bank at {ffff00}card desk office{b5b1b0} !");} return 1; } Edited July 26, 2016 by Max ZEW 1 Link to comment Share on other sites More sharing options...
ALexu Posted July 28, 2016 Share Posted July 28, 2016 (edited) , ai la dispoziție 24 de ore să faci ca acest topic să arate ca un tutorial, altfel topicul va fii șters. Nu ai făcut decât să dai copy - paste la un filterscript, nimic altceva. Edited July 28, 2016 by ALexu Link to comment Share on other sites More sharing options...
Mentosan Posted August 7, 2016 Share Posted August 7, 2016 Topic închis. Topicul este mai vechi de 3 zile. Link to comment Share on other sites More sharing options...
Recommended Posts