if(strcmp(cmd, "/withdraw", true) == 0) { if(IsPlayerConnected(playerid)) { if(BizzInfo[PlayerInfo[playerid][InBusiness]][bType] == 8 || IsPlayerNearBank(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /withdraw [Amount]"); format(string, sizeof(string), " You have $%d in your bank account.", PlayerInfo[playerid][pAccount]); SendClientMessage(playerid, COLOR_GRAD3, string); return 1; } new cashdeposit = strvalEx(tmp); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /withdraw [Amount]"); format(string, sizeof(string), " You have $%d in your bank account.", PlayerInfo[playerid][pAccount]); SendClientMessage(playerid, COLOR_GRAD3, string); return 1; } if(cashdeposit > PlayerInfo[playerid][pAccount] || cashdeposit < 1) { SendClientMessage(playerid, COLOR_GRAD2, " You don't have that much!"); return 1; } if(cashdeposit < 20) { SendClientMessage(playerid, COLOR_GREY, "You can only withdraw a minimum of $20!"); return 1; } PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+cashdeposit; GivePlayerMoney(playerid,cashdeposit); PlayerInfo[playerid][pAccount] = PlayerInfo[playerid][pAccount]-cashdeposit; format(string, sizeof(string), " You have withdrawn $%d from your bank account, Total: $%d ", cashdeposit,PlayerInfo[playerid][pAccount]); SendClientMessage(playerid, COLOR_YELLOW, string); return 1; } } return 1; }
if(strcmp(cmd, "/transfer", true) == 0 || strcmp(cmd, "/wiretransfer", true) == 0) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pLevel] < 3) { SendClientMessage(playerid, COLOR_GRAD1, " You must be level 3!"); return 1; } if(BizzInfo[PlayerInfo[playerid][InBusiness]][bType] != 8) { SendClientMessage(playerid, COLOR_GREY, " You are not at the bank!"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /transfer [PlayerID/PartOfName] [amount]"); return 1; } giveplayerid = ReturnUser(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /transfer [PlayerID/PartOfName] [amount]"); return 1; } moneys = strvalEx(tmp); if(IsPlayerConnected(giveplayerid)) { if(gPlayerLogged[giveplayerid] == 0) { SendClientMessage(playerid, COLOR_GREY, " That player has not logged in!"); return 1; } if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, " You can't transfer money to yourself!"); return 1; } if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); new playermoney = PlayerInfo[playerid][pAccount] ; if(moneys > 0 && playermoney >= moneys) { PlayerInfo[playerid][pAccount] -= moneys; PlayerInfo[giveplayerid][pAccount] += moneys; format(string, sizeof(string), " You have transferred $%d to %s's account.", moneys, giveplayer,giveplayerid); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); SendClientMessage(playerid, COLOR_GRAD1, string); format(string, sizeof(string), " You have recieved $%d to into your account from %s", moneys, sendername, playerid); SendClientMessage(giveplayerid, COLOR_GRAD1, string); format(string, sizeof(string), "%s transferred $%d to %s", sendername, moneys, giveplayer); if(moneys >= 500000) { ABroadCast(COLOR_YELLOW,string,1); } PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0); PayLog(string); } else { SendClientMessage(playerid, COLOR_GRAD1, " Invalid transaction amount!"); } } } else { format(string, sizeof(string), " %d is not an active player !", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } return 1; } if(strcmp(cmd,"/bankpercent",true)==0) { if(IsPlayerConnected(playerid)) { if(BizzInfo[PlayerInfo[playerid][InBusiness]][bType] != 8) { SendClientMessage(playerid, COLOR_GREY, " You are not in a bank!"); return 1; } format(string, sizeof(string), "* The Bank Tax is currently %d percent.", BizzInfo[PlayerInfo[playerid][InBusiness]][bPercent]); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); } return 1; }
if(strcmp(cmd, "/deposit", true) == 0) { if(IsPlayerConnected(playerid)) { if(BizzInfo[PlayerInfo[playerid][InBusiness]][bType] == 8 || IsPlayerNearBank(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /deposit [Amount]"); format(string, sizeof(string), "You currently have $%d in your Bank Account.", PlayerInfo[playerid][pAccount]); SendClientMessage(playerid, COLOR_YELLOW, string); return 1; } new cashdeposit = strvalEx(tmp); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /deposit [Amount]"); format(string, sizeof(string), "You currently have $%d in your Bank Account.", PlayerInfo[playerid][pAccount]); SendClientMessage(playerid, COLOR_YELLOW, string); return 1; } if(cashdeposit > PlayerInfo[playerid][pCash] || cashdeposit < 1) { SendClientMessage(playerid, COLOR_GREY, "You don't have that much Money on you."); return 1; } if(cashdeposit < 20) { SendClientMessage(playerid, COLOR_GREY, "You can only deposit a minimum of $20!"); return 1; } new curfunds = PlayerInfo[playerid][pAccount]; new percent = BizzInfo[PlayerInfo[playerid][InBusiness]][bPercent]; PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-cashdeposit; GivePlayerMoney(playerid,-cashdeposit); PlayerInfo[playerid][pAccount] = PlayerInfo[playerid][pAccount]-cashdeposit*percent/100; new fee = cashdeposit*percent/100; PlayerInfo[playerid][pAccount] = cashdeposit+PlayerInfo[playerid][pAccount]; BizzInfo[PlayerInfo[playerid][InBusiness]][bTill] += fee; SendClientMessage(playerid, COLOR_WHITE, "|___ BANK STATEMENT ___|"); format(string, sizeof(string), " Old Balance: $%d", curfunds); SendClientMessage(playerid, COLOR_GRAD2, string); format(string, sizeof(string), " Percent Fee: $%d",fee); SendClientMessage(playerid, COLOR_GRAD4, string); format(string, sizeof(string), " Deposit: $%d",cashdeposit); SendClientMessage(playerid, COLOR_GRAD5, string); SendClientMessage(playerid, COLOR_GRAD6, "|------------------------------------------|"); format(string, sizeof(string), " New Balance: $%d", PlayerInfo[playerid][pAccount]); SendClientMessage(playerid, COLOR_WHITE, string); return 1; } } return 1; }
Show,
1) IsPlayerNearBank function 2) Any data associated with bank locations 3) Where you load the bank locations |
IsPlayerNearBank(playerid) { for (new i = 1; i < MAX_DYNAMIC_PICKUPS; i += 1) { if (IsPlayerInRangeOfPoint(playerid, 3.0, PickupInfo[i][PickupX], PickupInfo[i][PickupY], PickupInfo[i][PickupZ]) && GetPlayerVirtualWorld(playerid) == PickupInfo[i][PickupVirtual]) { if (PickupInfo[i][PickupType] == 27) return i; } } return -1; }
public PrintBizInfo(playerid,targetid) { if(IsPlayerConnected(playerid)) { new coordsstring[128]; new lock[128]; new businesstype[128]; if(BizzInfo[targetid][bType] == 8) { businesstype = "International/Local Bank"; } else if(BizzInfo[targetid][bType] == 8) { SendClientMessage(playerid, COLOR_GREEN,"_______________________________________"); format(coordsstring, sizeof(coordsstring),"*** %s ***",BizzInfo[targetid][bMessage]); SendClientMessage(playerid, COLOR_WHITE,coordsstring); format(coordsstring, sizeof(coordsstring), "[%s] | Locked: [%s] | Entrance Fee: [$%d] | Percent: [%d] | Bank: [$%d]", businesstype, lock, BizzInfo[targetid][bEntranceCost], BizzInfo[targetid][bPercent], BizzInfo[targetid][bTill]); SendClientMessage(playerid, COLOR_GRAD1,coordsstring); SendClientMessage(playerid, COLOR_GREEN,"_______________________________________"); } }
if(BizzInfo[PlayerInfo[playerid][InBusiness]][bType] == 8 || IsPlayerNearBank(playerid))
if(BizzInfo[PlayerInfo[playerid][InBusiness]][bType] == 8 || IsPlayerNearBank(playerid) != -1)