Performing a check before giving the player a gun.
#1

Here is my command.

Код:
			if(strcmp(cmd, "/buyspas", true) == 0)
			{
		    if(IsPlayerInRangeOfPoint(playerid, 2, 2497.49,-1703.31,1014.74))
		    {
				GivePlayerWeapon(playerid, 27, 25000);
  			GivePlayerMoney(playerid, -40000);
  			SendClientMessage(playerid, 0xF0F8FFAA, "You bought a spas for $40,000.");
			  }
			  	if(GetPlayerMoney(playerid) < 40000)
				{
				SendClientMessage(playerid, 0xF0F8FFAA, "You do not have enough money to purchase this gun.");
				}
  					if(!IsPlayerInRangeOfPoint(playerid, 2, 2497.49,-1703.31,1014.74))
		    {
				SendClientMessage(playerid, 0xF0F8FFAA, "You can not purchase a weapon from here.");
			  }
			return 1;
		}
It works but for some reason, when I do /buyspas it gives me a gun, takes away $40,000 and puts me into the NEGATIVES, and also sends the message "You do not have enough money to purchase this gun". I don't want it to give them the gun if it will put them into the negatives. I don't know why my check does not work.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)