error 028: invalid subscript - 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 (
/showthread.php?tid=538135)
error 001: expected token: ";", but found "if" -
Team_PRO - 20.09.2014
pawn Код:
CMD:afk(playerid, params[])
{
new str[300];
AFKTime[playerid] = 1
if(afkalready[playerid] == 0)
{
format(str,sizeof(str), "» %s(%d) is now AFK (Away From Keyboard)!",GetPName(playerid),playerid);
SendClientMessageToAll(green,str);
SendClientMessage(playerid,green, ""lyellow"[NOTICE]"lwhite": just type again /afk to UN-AFK!");
afkalready[playerid] = 1;
TogglePlayerControllable(playerid, 0);
SetPlayerArmour(playerid, 99999.0);
SetPlayerHealth(playerid, 99999.0);
}
else if(afkalready[playerid] == 1)
{
AFKTime[playerid] = 0;
IsPlayerAFK[playerid] = false;
SetPlayerArmour(playerid, 0);
SetPlayerHealth(playerid, 99.0);
ResetPlayerWeapons(playerid);
format(str,sizeof(str),"» %s(%d) is now Back(Welcome Back)!",GetPName(playerid),playerid);
SendClientMessageToAll(green,str);
TogglePlayerControllable(playerid, 1);
afkalready[playerid] = 0;
}
return 1;
}
Код:
C:\Users\Matt\Desktop\SA-MP Files\PHT\gamemodes\ets.pwn(7107) : error 001: expected token: ";", but found "if"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Re: error 028: invalid subscript -
Jack_Leslie - 20.09.2014
pawn Код:
new Text:VersionNumberTextDraw[MAX_PLAYERS];
Also if it's saying undefined symbol 'playerid' then you obviously don't have the code under a call with playerid.
Re: error 028: invalid subscript -
Team_PRO - 20.09.2014
thanks solved
Re: error 028: invalid subscript -
Team_PRO - 20.09.2014
Delete Look Main Post
Re: error 028: invalid subscript -
PMH - 20.09.2014
AFKTime[playerid] = 1;
This line will make afktime to 0 everytime, to add one each time someone types afk replace this line by
AFKTime ++;
Re: error 028: invalid subscript -
Team_PRO - 20.09.2014
ah yes i forgot that one lol sorry for bothering