Deposit and Withdraw
#1

So i set coordinates to two bank interiors so you can deposit and withdraw money in both but it says You are not in bank
Code
PHP код:
CMD:withdraw(playeridparams[])
{
    if(!
IsPlayerInRangeOfPoint(playerid15.02308.7346, -11.013426.7422) && !IsPlayerInRangeOfPoint(playerid15.0322.2671109.35511003.2194))
    {
        
SendClientMessageEx(playeridCOLOR_GREY"You are not at the bank!");
        return 
1;
    }
    if(
PlayerInfo[playerid][pFreezeBank] == 1) return SendClientMessageEx(playeridCOLOR_GREY"Your bank is currently frozen");
    new 
string[128], amount;
    if(
sscanf(params"d"amount))
    {
        
SendClientMessageEx(playeridCOLOR_GRAD2"USAGE: /withdraw [amount]");
        
format(stringsizeof(string), "  You have $%d in your account."PlayerInfo[playerid][pAccount]);
        
SendClientMessageEx(playeridCOLOR_GRAD3string);
        return 
1;
    }
    if (
amount PlayerInfo[playerid][pAccount] || amount 1)
    {
        
SendClientMessageEx(playeridCOLOR_GRAD2"   You don't have that much!");
        return 
1;
    }
    
GivePlayerCash(playerid,amount);
    
PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-amount;
    
format(stringsizeof(string), "  You have withdrawn $%d from your account. Current balance: $%d "amount,PlayerInfo[playerid][pAccount]);
    
SendClientMessageEx(playeridCOLOR_YELLOWstring);
    return 
1;
}
CMD:deposit(playeridparams[])
{
    if(!
IsPlayerInRangeOfPoint(playerid15.02315.952880,-1.618174,26.742187) && !IsPlayerInRangeOfPoint(playerid15.0322.2671109.35511003.2194))
    {
        
SendClientMessageEx(playeridCOLOR_GREY"You are not at the bank!");
        return 
1;
    }
    if(
PlayerInfo[playerid][pFreezeBank] == 1) return SendClientMessageEx(playeridCOLOR_GREY"Your bank is currently frozen");
    new 
string[128], amount;
    if(
sscanf(params"d"amount))
    {
        
SendClientMessageEx(playeridCOLOR_WHITE"USAGE: /deposit [amount]");
        
format(stringsizeof(string), "  You have $%d in your account."PlayerInfo[playerid][pAccount]);
        
SendClientMessageEx(playeridCOLOR_GRAD3string);
        return 
1;
    }
    if (
amount GetPlayerCash(playerid) || amount 1)
    {
        
SendClientMessageEx(playeridCOLOR_GRAD2"   You don't have that much.");
        return 
1;
    }
    
GivePlayerCash(playerid,-amount);
    new 
curfunds PlayerInfo[playerid][pAccount];
    
PlayerInfo[playerid][pAccount]=amount+PlayerInfo[playerid][pAccount];
    
SendClientMessageEx(playeridCOLOR_WHITE"|___ BANK STATMENT ___|");
    
format(stringsizeof(string), "  Old Balance: $%d"curfunds);
    
SendClientMessageEx(playeridCOLOR_GRAD2string);
    
format(stringsizeof(string), "  Deposit: $%d",amount);
    
SendClientMessageEx(playeridCOLOR_GRAD4string);
    
SendClientMessageEx(playeridCOLOR_GRAD6"|-----------------------------------------|");
    
format(stringsizeof(string), "  New Balance: $%d"PlayerInfo[playerid][pAccount]);
    
SendClientMessageEx(playeridCOLOR_WHITEstring);
    return 
1;
}
CMD:balance(playeridparams[])
{
    new 
string[128];
    if(!
IsPlayerInRangeOfPoint(playerid15.02315.952880,-1.618174,26.742187) && !IsPlayerInRangeOfPoint(playerid15.0322.2671109.35511003.2194))
    {
        
SendClientMessageEx(playeridCOLOR_GREY"You are not at the bank!");
        return 
1;
    }
    if(
PlayerInfo[playerid][pFreezeBank] == 1) return SendClientMessageEx(playeridCOLOR_GREY"Your bank is currently frozen");
    
format(stringsizeof(string), "You have $%d in your account.",PlayerInfo[playerid][pAccount]);
    
SendClientMessageEx(playeridCOLOR_YELLOWstring);
    return 
1;
}
CMD:wiretransfer(playeridparams[])
{
    if(
PlayerInfo[playerid][pLevel] < 3)
    {
        
SendClientMessageEx(playeridCOLOR_GRAD1"   You must be at least level 3!");
        return 
1;
    }
    if(!
IsPlayerInRangeOfPoint(playerid15.02315.952880,-1.618174,26.742187) && !IsPlayerInRangeOfPoint(playerid15.0322.2671109.35511003.2194))
    {
        
SendClientMessageEx(playeridCOLOR_GREY"You are not at the bank!");
        return 
1;
    }
    if(
PlayerInfo[playerid][pFreezeBank] == 1) return SendClientMessageEx(playeridCOLOR_GREY"Your bank is currently frozen");
    new 
string[128], giveplayeridamount;
    if(
sscanf(params"id"giveplayeridamount)) return SendClientMessageEx(playeridCOLOR_WHITE"USAGE: /transfer [playerid] [amount]");
    if (
IsPlayerConnected(giveplayerid))
    {
        if(
giveplayerid != INVALID_PLAYER_ID)
        {
            new 
playermoney PlayerInfo[playerid][pAccount] ;
            if (
amount && playermoney >= amount)
            {
                
PlayerInfo[playerid][pAccount] -= amount;
                
PlayerInfo[giveplayerid][pAccount] += amount;
                
format(stringsizeof(string), "   You have transferred $%d to %s's account."amountGetPlayerNameEx(giveplayerid),giveplayerid);
                
PlayerPlaySound(playerid10520.00.00.0);
                
SendClientMessageEx(playeridCOLOR_GRAD1string);
                
format(stringsizeof(string), "   You have recieved $%d to into your account from %s."amountGetPlayerNameEx(playerid), playerid);
                
SendClientMessageEx(giveplayeridCOLOR_GRAD1string);
                new 
ip[32], ipex[32];
                
GetPlayerIp(playeridipsizeof(ip));
                
GetPlayerIp(giveplayeridipexsizeof(ipex));
                
format(stringsizeof(string), "[BANK] %s (IP:%s) has transferred $%d to %s (IP:%s)."GetPlayerNameEx(playerid), ipamountGetPlayerNameEx(giveplayerid), ipex);
                if(
amount >= 500000)
                {
                    
ABroadCast(COLOR_YELLOW,string,2);
                }
                
Log("logs/pay.log"string);
                
PlayerPlaySound(giveplayerid10520.00.00.0);
            }
            else
            {
                
SendClientMessageEx(playeridCOLOR_GRAD1"   Invalid transaction amount.");
            }
        }
    }
    else 
SendClientMessageEx(playeridCOLOR_GRAD1"Invalid player specified.");
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)