Errors; I really don't understand why.
#1

Код:
command(ccpay, playerid, params[])
{
	new CardNo[, Amount;
	if(sscanf(params, "dd", CardNo, Amount))
	{
		SendClientMessage(playerid, WHITE, "SYNTAX: /ccpay [CardNo] [Amount]");
	}
	else
	{
		if(Amount < 1)
		{
		}
		else
		{
			if(Player[playerid][PhoneN] >= 1)
				{
					if(Player[playerid][BankStatus] == 1)
					{
						SendClientMessage(playerid, RED, "The authorities have suspended your bank account.");
					}
					else
					{
						if(Player[playerid][BankMoney] >= Amount)
						{
							for(new i = 0; i < MAX_PLAYERS; i++)
							{
								if(Player[i][CreditCard] == CardNo)
								{
									new str1[256], str2[256], str3[256];
									Player[playerid][BankMoney] -= Amount;
									Player[i][BankMoney] += Amount;
									format(str1, sizeof(str1), "You have paid Credit Card: %s for the amount of %s.", CardNo, Amount);
									SendClientMessage(playerid, NICESKY, str1);
									format(str2, sizeof(str2), "You have received %s from %s, this has been added to your bank account.", Amount, GetName(playerid));
									SendClientMessage(i, NICESKY, str2);
									format(str3, sizeof(str3), "Player %s[%s] has paid %s[%s] a sum of $%s.", GetName(playerid), GetPlayerIp(playerid), GetName(i), GetPlayerIp(i), Amount);
									SendToAdmins(ADMINORANGE, str3, 0);
								}
								else 
								{
									SendClientMessage(playerid, WHITE, "The credit card you are attempting to pay is currently unavailable((May be offline))");
								}
							}
						}
					}
				}
			}
		}
	}
	return 1;
}
Код:
Vortex.pwn(36051) : error 033: array must be indexed (variable "CardNo")
Vortex.pwn(36060) : warning 202: number of arguments does not match definition
Vortex.pwn(36060) : warning 202: number of arguments does not match definition
Vortex.pwn(36060) : warning 202: number of arguments does not match definition
Vortex.pwn(36060) : warning 202: number of arguments does not match definition
Vortex.pwn(36078) : error 010: invalid function or declaration
Reply
#2

pawn Код:
new CardNo[, Amount; //remove the "[" after CardNo.
Repost any errors when you fix that.
Reply
#3

Код:
Vortex.pwn(36060) : warning 202: number of arguments does not match definition
Vortex.pwn(36060) : warning 202: number of arguments does not match definition
Vortex.pwn(36060) : warning 202: number of arguments does not match definition
Vortex.pwn(36060) : warning 202: number of arguments does not match definition
Vortex.pwn(36074) : error 010: invalid function or declaration
Reply
#4

Show us lines '36060 & 36074' or mark them on your script.
Reply
#5

Line 36060 - format(str3, sizeof(str3), "Player %s[%s] has paid %s[%s] a sum of $%s.", GetName(playerid), GetPlayerIp(playerid), GetName(i), GetPlayerIp(i), Amount);
Line 36074 - return 1;
Reply
#6

Fixed the error; still 4 warnings
Reply
#7

the format is correct but check these

GetName(playerid),
GetPlayerIp(playerid),
GetName(i),
GetPlayerIp(i)

functions. you're missing parameters in some or one of them,
as compiler said:
number of arguments does not match definition
Reply
#8

Thanks guys! +rep each.
Fixed it simply by;
new str1[256], str2[256], str3[256];
new PayerIP[16], RecieverIP[16], Name1[124], Name2[124];
GetPlayerIp(playerid, PayerIP, sizeof(PayerIP));
GetPlayerIp(i, RecieverIP, sizeof(RecieverIP));
GetPlayerName(playerid, Name1, sizeof(Name1));
GetPlayerName(i, Name2, sizeof(Name2));
Player[playerid][BankMoney] -= Amount;
Player[i][BankMoney] += Amount;
format(str1, sizeof(str1), "You have paid Credit Card: %s for the amount of %s.", CardNo, Amount);
SendClientMessage(playerid, NICESKY, str1);
format(str2, sizeof(str2), "You have received %s from %s, this has been added to your bank account.", Amount, GetName(playerid));
SendClientMessage(i, NICESKY, str2);
format(str3, sizeof(str3), "Player %s[%s] has paid %s[%s] a sum of $%s.", Name1, PayerIP, Name2, RecieverIP, Amount);
SendToAdmins(ADMINORANGE, str3, 0);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)