/pay Problem
#1

Код:
CMD:pay(playerid, params[])
{
	new giveplayerid, moneys, string[128];
	if(sscanf(params, "ud"),giveplayerid, moneys) return SyntaxMessage(playerid, "/pay [playerid/name] [amount]");
	if(moneys > 1000 && PlayerInfo[playerid][pLevel] < 3) return SendClientMessage(playerid, GREY, "    You must be level 3 to pay more than $1,000 at a time.");
	if(moneys < 1 || moneys > 150000) return SendClientMessage(playerid, GREY, "    You cannot pay under $1 or more than $150,000 at a time.");
	if(IsPlayerConnected(giveplayerid))
	{
		if(giveplayerid == playerid) return SendClientMessage(playerid, GREY, "    You cannot pay money to yourself.");
		if(giveplayerid != INVALID_PLAYER_ID)
		{
			if(ProxDetectorS(5.0, playerid, giveplayerid))
			{
				new playermoney = PlayerInfo[playerid][pCash];
				if(moneys > 0 && playermoney >= moneys)
				{
					PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-moneys;
					GivePlayerMoney(playerid, (0 - moneys));
					PlayerInfo[giveplayerid][pCash] = PlayerInfo[giveplayerid][pCash]+moneys;
					GivePlayerMoney(giveplayerid, moneys);
					format(string, sizeof(string), "   You have sent %s(player: %d), $%d.", pName(giveplayerid), giveplayerid, moneys);
					SendClientMessage(playerid, GREY1, string);
					format(string, sizeof(string), "   You have recieved $%d from %s(player: %d).", moneys, pName(playerid), playerid);
					SendClientMessage(giveplayerid, GREY1, string);
					if(PlayerInfo[playerid][pMask] == 1) format(string, sizeof(string), "* Stranger takes out some Cash, and hands it to %s.",pName(giveplayerid));
					else format(string, sizeof(string), "* %s takes out some Cash, and hands it to %s.", pName(playerid),pName(giveplayerid));
					ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
					PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
					PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
					new plrIP[16];
					new giveplrIP[16];
					GetPlayerIp(playerid, plrIP, sizeof(plrIP));
					GetPlayerIp(giveplayerid, giveplrIP, sizeof(giveplrIP));
					format(string, sizeof(string), "%s (IP:%s) (Key:%d) (ConTime:%d) has paid $%d to %s (IP:%s) (Key:%d)", pName(playerid),plrIP,PlayerInfo[playerid][pKey], PlayerInfo[playerid][pConnectTime],moneys,pName(giveplayerid),giveplrIP,PlayerInfo[giveplayerid][pKey]);
					PayLog(string);
				}
				else return SendClientMessage(playerid, GREY1, "Invalid transaction amount.");

			}
			else return SendClientMessage(playerid, GREY, "    You are too far away.");
		}
	}
	else { SendClientMessage(playerid, WHITE, "	Not an active player!"); }
	return 1;
Not sure whats up but I am getting this error "You cannot pay under $1 or more than $150,000 at a time". Any help will be rep'd thanks!
Reply
#2

pawn Код:
CMD:pay(playerid, params[])
{
    new giveplayerid, moneys, string[128];
    if(sscanf(params, "ud"),giveplayerid, moneys) return SyntaxMessage(playerid, "/pay [playerid/name] [amount]");
    if(moneys > 1000 && PlayerInfo[playerid][pLevel] < 3) return SendClientMessage(playerid, GREY, "    You must be level 3 to pay more than $1,000 at a time.");
    if(moneys < 1 || moneys > 150000) return SendClientMessage(playerid, GREY, "    You cannot pay under $1 or more than $150,000 at a time.");
    if(IsPlayerConnected(giveplayerid))
    {
        if(giveplayerid == playerid) return SendClientMessage(playerid, GREY, "    You cannot pay money to yourself.");
        if(giveplayerid != INVALID_PLAYER_ID)
        {
            if(ProxDetectorS(5.0, playerid, giveplayerid))
            {
                new playermoney = PlayerInfo[playerid][pCash];
                if(moneys > 0 && playermoney >= moneys)
                {
                    PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-moneys;
                    GivePlayerMoney(playerid, (0 - moneys));
                    PlayerInfo[giveplayerid][pCash] = PlayerInfo[giveplayerid][pCash]+moneys;
                    GivePlayerMoney(giveplayerid, moneys);
                    format(string, sizeof(string), "   You have sent %s(player: %d), $%d.", pName(giveplayerid), giveplayerid, moneys);
                    SendClientMessage(playerid, GREY1, string);
                    format(string, sizeof(string), "   You have recieved $%d from %s(player: %d).", moneys, pName(playerid), playerid);
                    SendClientMessage(giveplayerid, GREY1, string);
                    if(PlayerInfo[playerid][pMask] == 1) format(string, sizeof(string), "* Stranger takes out some Cash, and hands it to %s.",pName(giveplayerid));
                    else format(string, sizeof(string), "* %s takes out some Cash, and hands it to %s.", pName(playerid),pName(giveplayerid));
                    ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
                    new plrIP[16];
                    new giveplrIP[16];
                    GetPlayerIp(playerid, plrIP, sizeof(plrIP));
                    GetPlayerIp(giveplayerid, giveplrIP, sizeof(giveplrIP));
                    format(string, sizeof(string), "%s (IP:%s) (Key:%d) (ConTime:%d) has paid $%d to %s (IP:%s) (Key:%d)", pName(playerid),plrIP,PlayerInfo[playerid][pKey], PlayerInfo[playerid][pConnectTime],moneys,pName(giveplayerid),giveplrIP,PlayerInfo[giveplayerid][pKey]);
                    PayLog(string);
                }
                else return SendClientMessage(playerid, GREY1, "Invalid transaction amount.");

            }
            else return SendClientMessage(playerid, GREY, "    You are too far away.");
        }
    }
    else { SendClientMessage(playerid, WHITE, " Not an active player!"); }
    return 1;
}
pawn Код:
if(moneys < 1 || moneys > 150000) return SendClientMessage(playerid, GREY, "    You cannot pay under $1 or more than $150,000 at a time.");
This code checks if it is between these values. If you want to give any amount, remove this line.
Reply
#3

If I put between the values, It still doesn't give the money.
Reply
#4

Are you sure it gives you the message that it has to be between those amounts when you try? Possibly another error message rather than that?
Reply
#5

Getting this message
Quote:

You cannot pay under $1 or more than $150,000 at a time.

Reply
#6

Bump - it's been 24 hours.
Reply
#7

bump.
Reply
#8

What is the amount of money you are trying to pay?
Reply
#9

It won't allow us to input a variable. Even if we type /pay, that appears.
Reply
#10

pawn Код:
if(sscanf(params, "ud"),giveplayerid, moneys)
should be

pawn Код:
if(sscanf(params, "ud",giveplayerid, moneys))

Look up the syntax of sscanf
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)