error 028: invalid subscript (not an array or too many subscripts) - 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 028: invalid subscript (not an array or too many subscripts) (
/showthread.php?tid=352794)
error 028: invalid subscript (not an array or too many subscripts) -
SnG.Scot_MisCuDI - 21.06.2012
Solved
Re: error 028: invalid subscript (not an array or too many subscripts) -
Ironboy - 21.06.2012
Try this
pawn Код:
forward TextTime(playerid);
CMD:text(playerid,params[])
{
if(!IsAdmin(playerid, 1)) return ErrorMsg(playerid);
new announce[41];
if(sscanf(params, "s", announce)) return Usage(playerid, "/text [message]");
format(announce, sizeof(announce), "%s", announce);
TextDrawSetString(Texti, announce);
TextDrawShowForPlayer(playerid, Texti);
SetTimer("TextTime",4000,false);
return 1;}
public TextTime(playerid)
{
TextDrawHideForPlayer(playerid, Texti);
}
Put this under OnGameModeInit callback
pawn Код:
Texti = TextDrawCreate(322.000000, 135.000000, "message");
TextDrawAlignment(Texti, 2);
TextDrawBackgroundColor(Texti, 255);
TextDrawFont(Texti, 3);
TextDrawLetterSize(Texti, 0.670000, 3.099998);
TextDrawColor(Texti, -1);
TextDrawSetOutline(Texti, 1);
TextDrawSetProportional(Texti, 1);
Re: error 028: invalid subscript (not an array or too many subscripts) -
Skaizo - 21.06.2012
you missing [playerid]
pawn Код:
//at top of script
new Text:Text[MAX_PLAYERS];
//zmcd
CMD:text(playerid,params[])
{
Text[playerid] = TextDrawCreate(322.000000, 135.000000, "message");
TextDrawAlignment(Text[playerid], 2);
TextDrawBackgroundColor(Text[playerid], 255);
TextDrawFont(Text[playerid], 3);
TextDrawLetterSize(Text[playerid], 0.670000, 3.099998);
TextDrawColor(Text[playerid], -1);
TextDrawSetOutline(Text[playerid], 1);
TextDrawSetProportional(Text[playerid], 1);
if(!IsAdmin(playerid, 1)) return ErrorMsg(playerid);
new announce[41];
if(sscanf(params, "s", announce)) return Usage(playerid, "/text [message]");
format(announce, sizeof(announce), "%s", announce);
TextDrawSetString(Text[playerid], announce);
TextDrawShowForPlayer(playerid, Text[playerid]);
SetTimer("TextTime",4000,false);
return 1;
}
forward TextTime(playerid);
public TextTime(playerid)
{
TextDrawDestroy(Text[playerid]);
}