All pastes #2070584 Raw Edit

bfe

public text v1 · immutable
#2070584 ·published 2011-05-27 20:16 UTC
rendered paste body
//----------------------------------[Bank System]-----------------------------------------------
    if(strcmp(cmd, "/withdraw", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(PlayerInfo[playerid][pLocal] == 103 || PlayerToPoint(1.5, playerid, 1346.5016,-1758.7649,13.5156) || PlayerToPoint(1.5, playerid, 1592.7152,-2335.3748,13.5400) || PlayerToPoint(1.5, playerid, 2308.4612,-1634.4176,14.8270) || PlayerToPoint(1.5, playerid, 2865.9014,-1415.4203,11.0061) || PlayerToPoint(1.5, playerid, 2404.5913,-1229.8973,23.8301) || PlayerToPoint(1.5, playerid, 1172.5912,-1328.4365,15.4034) || PlayerToPoint(40.0, playerid, 288.745971,169.350997,1007.171875))
	        {
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /withdraw [amount]");
					format(string, sizeof(string), "  You Have $%d in your account.", PlayerInfo[playerid][pAccount]);
					SendClientMessage(playerid, COLOR_GRAD3, string);
					return 1;
				}
				new cashdeposit = strval(tmp);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /withdraw [amount]");
					format(string, sizeof(string), "  You Have $%d in your account.", PlayerInfo[playerid][pAccount]);
					SendClientMessage(playerid, COLOR_GRAD3, string);
					return 1;
				}
				if (cashdeposit > PlayerInfo[playerid][pAccount] || cashdeposit < 1)
				{
					SendClientMessage(playerid, COLOR_GRAD2, "   You dont have that much !");
					return 1;
				}
		    	//ConsumingMoney[playerid] = 1;
				SafeGivePlayerMoney(playerid,cashdeposit);
				PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-cashdeposit;
				format(string, sizeof(string), "  You Have Withdrawn $%d from your account Total: $%d ", cashdeposit,PlayerInfo[playerid][pAccount]);
				SendClientMessage(playerid, COLOR_YELLOW, string);
				return 1;
			}
			else
			{
   				SendClientMessage(playerid, COLOR_GREY, "   You are not at the Bank !");
	            return 1;
			}
		}
		return 1;
	}
	if(strcmp(cmd, "/bank", true) == 0 || strcmp(cmd, "/deposit", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(PlayerInfo[playerid][pLocal] != 103)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   You are not at the Bank !");
	            return 1;
	        }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /bank [amount]");
				format(string, sizeof(string), "  You Have $%d in your account.", PlayerInfo[playerid][pAccount]);
				SendClientMessage(playerid, COLOR_GRAD3, string);
				return 1;
			}
			new cashdeposit = strval(tmp);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /bank [amount]");
				format(string, sizeof(string), "  You Have $%d in your account.", PlayerInfo[playerid][pAccount]);
				SendClientMessage(playerid, COLOR_GRAD3, string);
				return 1;
			}
			if (cashdeposit > GetPlayerMoney(playerid) || cashdeposit < 1)
			{
				SendClientMessage(playerid, COLOR_GRAD2, "   You dont have that much");
				return 1;
			}
			SafeGivePlayerMoney(playerid,-cashdeposit);
			new curfunds = PlayerInfo[playerid][pAccount];
			PlayerInfo[playerid][pAccount]=cashdeposit+PlayerInfo[playerid][pAccount];
			SendClientMessage(playerid, COLOR_WHITE, "|___ BANK STATMENT ___|");
			format(string, sizeof(string), "  Old Balance: $%d", curfunds);
			SendClientMessage(playerid, COLOR_GRAD2, string);
			format(string, sizeof(string), "  Deposit: $%d",cashdeposit);
			SendClientMessage(playerid, COLOR_GRAD4, string);
			SendClientMessage(playerid, COLOR_GRAD6, "|-----------------------------------------|");
			format(string, sizeof(string), "  New Balance: $%d", PlayerInfo[playerid][pAccount]);
			SendClientMessage(playerid, COLOR_WHITE, string);
			return 1;
		}
		return 1;
	}