Array Must Be Indexed?
#1

Not sure what this means..

Код:
(1029) : error 033: array must be indexed (variable "inputtext")
(1030) : error 033: array must be indexed (variable "inputtext")
(1031) : error 035: argument type mismatch (argument 2)
(1032) : error 033: array must be indexed (variable "inputtext")
(1045) : error 033: array must be indexed (variable "inputtext")
(1046) : error 033: array must be indexed (variable "inputtext")
(1047) : error 035: argument type mismatch (argument 2)
(1048) : error 033: array must be indexed (variable "inputtext")
Код:
		case 8:
		{
		    if(response)
		    {
		        if(!isnum(inputtext)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You must enter a number!");
		        if(inputtext <= 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: You must enter more then 1 dollar!");
		        if(GetPlayerMoney(playerid) < inputtext) return SendClientMessage(playerid, COLOR_RED, "ERROR: You don't have that much cash!");
				GivePlayerMoney(playerid, -inputtext);
				new pBank = GetPVarInt(playerid, "Bank")+inputtext;
				SetPVarInt(playerid, "Bank", pBank);
				new string[64];
				format(string, sizeof(string), "You have put %d into your account, your new balance is: %d",inputtext,GetPVarInt(playerid, "Bank"));
				SendClientMessage(playerid, COLOR_GREEN, string);
		        
			}
		}
		case 9:
		{
		    if(response)
		    {
		        if(!isnum(inputtext)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You must enter a number!");
		        if(inputtext <= 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: You must enter more then 1 dollar!");
		        if(GetPVarInt(playerid, "Bank") < inputtext) return SendClientMessage(playerid, COLOR_RED, "ERROR: You don't have that much cash in your account!");
				GivePlayerMoney(playerid, inputtext);
				new pBank = GetPVarInt(playerid, "Bank")-inputtext;
				new string[64];
				SetPVarInt(playerid, "Bank", pBank);
				format(string, sizeof(string), "You have withdrawn %d from your account, your new balance is: %d",inputtext,GetPVarInt(playerid, "Bank"));
				SendClientMessage(playerid, COLOR_GREEN, string);
			}
		}
Reply
#2

you can't add a string to an integer like that, you need to use strval to find out the value of the string and then add them
Reply
#3

Worked like a charm, thanks a lot!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)