Jump to content

Question

Posted

Salut nu inteles cand pun cordonatele la atm unde se afla nu mai merge comanda.

CMD:withdraw(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
	if(IsPlayerConnected(playerid))
	{
     	if(IsAtBank(playerid))
		{
			new money,string[100];
			if(sscanf(params, "i", money))
			{
				SendClientMessage(playerid, COLOR_GREY, "Syntax:{FFFFFF} /withdraw [amount]");
				format(string, sizeof(string), "You have $%s in your account.", FormatNumber(PlayerInfo[playerid][pAccount]));
				SendClientMessage(playerid, COLOR_YELLOW, string);
				return 1;
			}
			if(money < 1) return SendClientMessage(playerid, COLOR_GREY, "Invalid amount specified.");
			if (money > PlayerInfo[playerid][pAccount]) return SendClientMessage(playerid, COLOR_WHITE, "You don't have that amount of money.");
		    ConsumingMoney[playerid] = 1;
			GivePlayerCash(playerid, money);
			PlayerInfo[playerid][pAccount] = PlayerInfo[playerid][pAccount] - money;
			format(string, sizeof(string), "You have withdrawn $%s from your bank account. Your account balance is now $%s.", FormatNumber(money), FormatNumber(PlayerInfo[playerid][pAccount]));
			SendClientMessage(playerid, COLOR_DCHAT, string);
    		Update(playerid, pBank);
			Update(playerid, pCashx);
			return 1;
		}
		else return SendClientMessage(playerid, COLOR_WHITE, "You are not at the bank!");
	}
	return 1;
}
public IsAtBank(playerid)
{
	if(IsPlayerConnected(playerid))
	{
	    if(IsPlayerInRangeOfPoint(playerid, 50.0, 2306.5564,-16.3045,26.7496))
	    {//BANK LS
	        return 1;
	    }
		if(IsPlayerInRangeOfPoint(playerid, 50.0, X,Y,Z))
	    {//SPAWN ATM
	        return 1;
	    }
	}
	return 0;
}

 

2 answers to this question

Recommended Posts

  • 0
Posted (edited)

Ai doua variante, fie mai faci o functie isAtATM si o apelezi si pe aceea la comenzile de la banca, fie modifici functia isAtBank in felul urmator.

 

forward isAtBank(playerid);
public isAtBank(playerid){
	if(IsPlayerConnected(playerid)){ // mai poti face si alte verificari
		if(IsPlayerInRangeOfPoint(playerid, 50.0, X1, Y1, Z1) || IsPlayerInRangeOfPoint(playerid, 50.0, X2, Y2, Z2)) // and so on...
			return 1;
	}
	return 0;
}

Si folosesti operatorul de disjunctie in loc sa faci mai multe verificari iar X1, Y1, Z1 reprezinta primul set de coordonate, X2, Y2, Z2 al doilea si tot asa.

Edited by andrei9971
  • 0
Posted
Acum 31 minute, andrei9971 a spus:

Ai doua variante, fie mai faci o functie isAtATM si o apelezi si pe aceea la comenzile de la banca, fie modifici functia isAtBank in felul urmator.

 


forward isAtBank(playerid);
public isAtBank(playerid){
	if(IsPlayerConnected(playerid)){ // mai poti face si alte verificari
		if(IsPlayerInRangeOfPoint(playerid, 50.0, X1, Y1, Z1) || IsPlayerInRangeOfPoint(playerid, 50.0, X2, Y2, Z2)) // and so on...
			return 1;
	}
	return 0;
}

Si folosesti operatorul de disjunctie in loc sa faci mai multe verificari iar X1, Y1, Z1 reprezinta primul set de coordonate, X2, Y2, Z2 al doilea si tot asa.

ms

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.