Jump to content
  • 0

Problema comanda withdraw la atm


Sprite_RoPlayers

Question

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;
}

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

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
Link to comment
Share on other sites

  • 0
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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.