Making a /getsteel command
#1

ok here is what i have so far

Код:
CMD:getsteel(playerid, params[])
{
	if(Arms[playerid] == 1)
	{
		if(IsPlayerInRangeOfPoint(playerid, 4, 245.4962, 1420.4618, 10.5604))
		{
			if(PlayerMats[playerid][steel1] >= 1)
			{
			    PlayerMats[playerid][steel1] = 1;
			    SendClientMessage(playerid, COLOR_YELLOW, "You have now purchased some steel ignots");
			    SendClientMessage(playerid, COLOR_YELLOW, "Please deliver to refinery to make ignots into usable steel.");
			    return 1;
			}
			else
			{
			    SendClientMessage(playerid, COLOR_YELLOW, "You can not hold any more raw materials");
			    return 1;
			}
		}
		else
		{
		    SendClientMessage(playerid, COLOR_YELLOW, "You must first go to the oil refinery to get steel package.");
		    return 1;
		}
	}
	else
	{
	    SendClientMessage(playerid, COLOR_YELLOW, "You must be an Arms Dealer to use that command.");
	}
	return 1;
}
I was wondering how I would add in an if statement that would GetPlayerMoney and if said player was under a givin amount it would send them a message stating they would need more money
Reply
#2

pawn Код:
CMD:getsteel(playerid, params[])
{
    if(Arms[playerid] == 1)
    {
        if(IsPlayerInRangeOfPoint(playerid, 4, 245.4962, 1420.4618, 10.5604))
        {
            if (GetPlayerMoney(playerid) < 1000) // replace 1000 with your amount
            {
                SendClientMessage(playerid, COLOR_YELLOW, "You don't have enough money.");
                return 1;
            }
            if(PlayerMats[playerid][steel1] >= 1)
            {
                PlayerMats[playerid][steel1] = 1;
                SendClientMessage(playerid, COLOR_YELLOW, "You have now purchased some steel ignots");
                SendClientMessage(playerid, COLOR_YELLOW, "Please deliver to refinery to make ignots into usable steel.");
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_YELLOW, "You can not hold any more raw materials");
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_YELLOW, "You must first go to the oil refinery to get steel package.");
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_YELLOW, "You must be an Arms Dealer to use that command.");
    }
    return 1;
}
Reply
#3

Awesome thanks
Reply
#4

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
pawn Код:
CMD:getsteel(playerid, params[])
{
    if(Arms[playerid] == 1)
    {
        if(IsPlayerInRangeOfPoint(playerid, 4, 245.4962, 1420.4618, 10.5604))
        {
            if (GetPlayerMoney(playerid) < 1000) // replace 1000 with your amount
            {
                SendClientMessage(playerid, COLOR_YELLOW, "You don't have enough money.");
                return 1;
            }
            if(PlayerMats[playerid][steel1] >= 1)
            {
                PlayerMats[playerid][steel1] = 1;
                SendClientMessage(playerid, COLOR_YELLOW, "You have now purchased some steel ignots");
                SendClientMessage(playerid, COLOR_YELLOW, "Please deliver to refinery to make ignots into usable steel.");
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_YELLOW, "You can not hold any more raw materials");
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_YELLOW, "You must first go to the oil refinery to get steel package.");
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_YELLOW, "You must be an Arms Dealer to use that command.");
    }
    return 1;
}
where is the GivePlayerMoney(playerid,-1000);
Reply
#5

Does this look better guys?

Код:
CMD:getsteel(playerid, params[])
{
	if(Arms[playerid] == 1)
	{
	    if(IsPlayerInRangeOfPoint(playerid, 4, 245.4962, 1420.4618, 10.5604))
	    {
	        if(PlayerMats[playerid][steel1] >= 1)
	        {
	            if(GetPlayerMoney(playerid) >= 150)
	            {
	                PlayerMats[playerid][steel1] = 1;
	                SendClientMessage(playerid, COLOR_YELLOW, "You have purchased some raw steel ignot");
	                SendClientMessage(playerid, COLOR_YELLOW, "Take to refinery to get usable steel");
	                GivePlayerMoney(playerid, -150);
	                return 1;
	            }
	            else
	            {
	                SendClientMessage(playerid, COLOR_YELLOW, "You can not afford $150");
	                return 1;
				}
	        }
	        else
	        {
	            SendClientMessage(playerid, COLOR_YELLOW, "You can not carry anymore raw materials.");
	            return 1;
	        }
	    }
	    else
	    {
	        SendClientMessage(playerid, COLOR_YELLOW, "You must go to the oil refinery to get steel ignot.");
	        return 1;
	    }
	}
	else
	{
	    SendClientMessage(playerid, COLOR_YELLOW, "You must be an Arms Dealer to use that commnad.");
	}
	return 1;
}
Reply
#6

You do it right!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)