SA-MP Forums Archive
error 033: array must be indexed (variable "facname") - 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 "facname") (/showthread.php?tid=508104)



error 033: array must be indexed (variable "facname") - Eth - 20.04.2014

pawn Код:
CMD:clancreate(playerid,params[])
{
new facname[39];
new rfid = random(9999999);

if(pInfo[playerid][Scores] < 5000) return SendClientMessage(playerid,COLOR_RED,"{FF0000}Error:{FFFFFF}You need to have at least 5000 score to make a clan");
if(GetPlayerMoney(playerid) < 1000000) return SendClientMessage(playerid,COLOR_RED,"{FF0000}Error:{FFFFFF}You need to have at least 1m of cash to make a clan");
if(sscanf(params,"ui",facname)) return SendClientMessage(playerid,COLOR_RED,"Usage:/clancreate [clanname]");
GivePlayerMoney(playerid,-1000000);
pInfo[playerid][clanrank] = 5;
pInfo[playerid][clanid] = rfid;
pInfo[playerid][facname] = strval(facname);//this is the error
return 1;
}



Respuesta: error 033: array must be indexed (variable "facname") - Xabi - 20.04.2014

This line:
pawn Код:
if(sscanf(params,"ui",facname)) return SendClientMessage(playerid,COLOR_RED,"Usage:/clancreate [clanname]");
should be replaced by
pawn Код:
if(sscanf(params,"s[39]",facname)) return SendClientMessage(playerid,COLOR_RED,"Usage:/clancreate [clanname]");
And also, the error line:
pawn Код:
format(pInfo[playerid][facname], 39, facname);