SA-MP Forums Archive
error 033: array must be indexed (variable "raison") - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: error 033: array must be indexed (variable "raison") (/showthread.php?tid=654673)



error 033: array must be indexed (variable "raison") - 3417512908 - 03.06.2018

I try to make something for offline players...
But it have a error;
"error 033: array must be indexed (variable "raison")"
Please tell me how to fix it :d
Код:
CMD:szcz2(playerid, params[])
{
                    new raison[41], cible[MAX_PLAYER_NAME];
                    if(sscanf(params,"s[24]s[40]",cible,raison)) return SendClientMessage(playerid, -1, "/szcz2 [name] [var]");
                    new filename2[50];
           			format(filename2, sizeof(filename2), "/FantasyLandUsers/%s.ini", cible);
           			if(!fexist(filename2)) return ShowPlayerDialog(playerid, 999, DIALOG_STYLE_MSGBOX, "错误", "没有这个玩家的数据", "Okay", "");
           			else
           			{
              			 new INI:File = INI_Open(filename2);
              			 new var = dini_Int(filename2,"Int");
              			 var=var+raison;   //this error
               		  	 INI_SetTag(File, "data");
              			 INI_WriteInt(File, "CZ", var);
               			 INI_Close(File);
           			}
           			return 1;
}



Re: error 033: array must be indexed (variable "raison") - 3417512908 - 03.06.2018

no anyone?


Re: error 033: array must be indexed (variable "raison") - Livity - 03.06.2018

You already assigned something to "var" here "new var = dini_Int(filename2,"Int");" , then y are you assigning something else to var here? var=var+raison; . I think thats the issue , you could try replacing
PHP код:
var=var+raison;
to 
new "variable name"=var+raison
Because variables are containers so it can hold one at a time.

Aren't you trying to save a string? you cant do it like that


Re: error 033: array must be indexed (variable "raison") - GTLS - 03.06.2018

Cant copy strings like that.

Use strins - https://sampwiki.blast.hk/wiki/Strins
or
Use strcat - https://sampwiki.blast.hk/wiki/Strcat