error 028: invalid subscript (not an array or too many subscripts): "pInfo" [ please help ] -
SpikY_ - 02.08.2014
my gamemode have admin system and it dnt have much admin commands so i was putting other admin system cmds .. after tht i have put 2 cmds /(un)freeze and when i compile it , it gives me errors see the codes below and fix it plz
Freeze Command Codes and Errors.
Код:
CMD:freeze(playerid, params[], help)
{
if (PlayerInfo[playerid][Admin] < 1) return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You are not authorized to use this command!");
{
new id, time = 0, reason[50];
if(isnull(params)) return SendClientMessage(playerid, YELLOW, "Usage: /freeze <Player ID> <Minutes> <Reason>");
sscanf(params, "uis[50]", id, time, reason);
if(IsPlayerConnected(id))
{
4042: if(pInfo[id][Frozen] == 1) return SendClientMessage(playerid,red,"This player is already frozen. see /frozen");
if(pInfo[playerid][pLevel] < pInfo[id][pLevel]) return ShowMessage(playerid, red, 6);
if(!isnull(reason) && time == 0)
format(Jstring,sizeof(Jstring),"Administrator %s has frozen player '%s' | Reason: %s",GetName(playerid),GetName(id),reason);
else if(!isnull(reason) && time >= 1) format(Jstring,sizeof(Jstring),"Administrator %s has frozen '%s' for %d minutes (reason: %s)",GetName(playerid),GetName(id), time, reason);
else if(isnull(reason) && time >= 1) format(Jstring,sizeof(Jstring),"Administrator %s has frozen '%s' for %d minutes",GetName(playerid),GetName(id), time);
else format(Jstring,sizeof(Jstring),"Administrator %s has frozen '%s'",GetName(playerid),GetName(id));
SendClientMessageToAll(red,Jstring);
pInfo[id][Frozen] = 1;
TogglePlayerControllable(id, false);
if(time >= 1)
{
Ftimer[id] = SetTimerEx("Unfreeze",time*1000*60,0,"u",id);
}
CommandToAdmins(playerid,"freeze");
return 1;
}
else return ShowMessage(playerid, red, 2);
}
else return ShowMessage(playerid, red, 1);
}
Код:
D:\server\gamemodes\usfMain.pwn(4038) : error 035: argument type mismatch (argument 2)
D:\server\gamemodes\usfMain.pwn(4042) : error 028: invalid subscript (not an array or too many subscripts): "pInfo"
D:\server\gamemodes\usfMain.pwn(4042) : warning 215: expression has no effect
D:\server\gamemodes\usfMain.pwn(4042) : error 001: expected token: ";", but found "]"
D:\server\gamemodes\usfMain.pwn(4042) : error 029: invalid expression, assumed zero
D:\server\gamemodes\usfMain.pwn(4042) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
5 Errors.
================================================== =====
================================================== =====
UnFreeze Command Codes and Errors.
Код:
CMD:unfreeze(playerid, params[])
{
if(pInfo[playerid][pLevel] >= 2)
{
new id, reason[50];
if(isnull(params)) return SendClientMessage(playerid, yellow, "Usage: /unfreeze <Player ID/Part of Name> <Reason>");
sscanf(params, "us[50]", id, reason);
if(IsPlayerConnected(id))
{
if(pInfo[id][Frozen] == 0) return SendClientMessage(playerid,red,"This player is not frozen!");
if(!isnull(reason))
format(Jstring,sizeof(Jstring),"You have been unfrozen by admin '%s' | Reason: %s",GetName(playerid),reason);
else format(Jstring,sizeof(Jstring),"You have been unfrozen by admin '%s'",GetName(playerid));
SendClientMessage(id,yellow,Jstring);
CommandToAdmins(playerid,"unfreeze");
format(Jstring,sizeof(Jstring),"You have unfrozen '%s'",GetName(id));
SendClientMessage(playerid,yellow,Jstring);
pInfo[id][Frozen] = 0;
TogglePlayerControllable(id, true);
KillTimer(Ftimer[id]);
return 1;
}
else return ShowMessage(playerid, red, 2);
}
else return ShowMessage(playerid, red, 1);
}
Код:
D:\server\gamemodes\usfMain.pwn(4037) : error 028: invalid subscript (not an array or too many subscripts): "pInfo"
D:\server\gamemodes\usfMain.pwn(4037) : warning 215: expression has no effect
D:\server\gamemodes\usfMain.pwn(4037) : error 001: expected token: ";", but found "]"
D:\server\gamemodes\usfMain.pwn(4037) : error 029: invalid expression, assumed zero
D:\server\gamemodes\usfMain.pwn(4037) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
THANKS FOR HELPING IN ADVANCE!
Re: error 028: invalid subscript (not an array or too many subscripts): "pInfo" [ please help ] -
SpikY_ - 02.08.2014
plz help me .. dnt have time to wait
Re: error 028: invalid subscript (not an array or too many subscripts): "pInfo" [ please help ] -
SlimDkhili - 02.08.2014
what is line 4037
and can you show us the "enum pinfo"
Re: error 028: invalid subscript (not an array or too many subscripts): "pInfo" [ please help ] -
IceBilizard - 02.08.2014
show the error lines
Re: error 028: invalid subscript (not an array or too many subscripts): "pInfo" [ please help ] -
SpikY_ - 02.08.2014
Код:
4037: new id, time = 0, reason[50];
Enum
Код:
enum pInfo
{
Password[129],
// RegID,
Admin,
VIP,
AltName[26],
RegOn[20],
Cash,
Score,
Spawned,
LoginFail,
LoggedIn,
Goto,
isAFK,
inDM,
inMini,
inDMZone,
Float:POS_X,
Float:POS_Y,
Float:POS_Z,
Skin,
Color,
WeaponSet,
DisablePMs,
Muted,
Kills,
Deaths,
Hours,
Minutes,
BanExpire,
GodEnabled,
Helmet,
pSpawnVehicle,
BanReason[32],
BanPerm,
BanAdmin[26]
}
Re: error 028: invalid subscript (not an array or too many subscripts): "pInfo" [ please help ] -
SpikY_ - 02.08.2014
line 4038
Код:
if(isnull(params)) return SendClientMessage(playerid, YELLOW, "Usage: /freeze <Player ID> <Minutes> <Reason>");
line 4042
Код:
if(pInfo[id][Frozen] == 1) return SendClientMessage(playerid,red,"This player is already frozen. see /frozen");
these are the error lines
Re: error 028: invalid subscript (not an array or too many subscripts): "pInfo" [ please help ] -
SpikY_ - 02.08.2014
Ice and Slim plz reply me fast plz.
Re: error 028: invalid subscript (not an array or too many subscripts): "pInfo" [ please help ] -
SpikY_ - 02.08.2014
anyone else plz help
Re: error 028: invalid subscript (not an array or too many subscripts): "pInfo" [ please help ] -
IceBilizard - 02.08.2014
change
pawn Код:
enum pInfo
{
Password[129],
// RegID,
Admin,
VIP,
AltName[26],
RegOn[20],
Cash,
Score,
Spawned,
LoginFail,
LoggedIn,
Goto,
isAFK,
inDM,
inMini,
inDMZone,
Float:POS_X,
Float:POS_Y,
Float:POS_Z,
Skin,
Color,
WeaponSet,
DisablePMs,
Muted,
Kills,
Deaths,
Hours,
Minutes,
BanExpire,
GodEnabled,
Helmet,
pSpawnVehicle,
BanReason[32],
BanPerm,
BanAdmin[26]
}
to
pawn Код:
enum PlayerData
{
Password[129],
// RegID,
Admin,
VIP,
AltName[26],
RegOn[20],
Cash,
Score,
Spawned,
LoginFail,
LoggedIn,
Goto,
isAFK,
inDM,
inMini,
inDMZone,
Float:POS_X,
Float:POS_Y,
Float:POS_Z,
Skin,
Color,
WeaponSet,
DisablePMs,
Muted,
Kills,
Deaths,
Hours,
Minutes,
BanExpire,
GodEnabled,
Helmet,
pSpawnVehicle,
BanReason[32],
BanPerm,
BanAdmin[26]
}
Add
pawn Код:
new pInfo[MAX_PLAYERS][PlayerData];
Re: error 028: invalid subscript (not an array or too many subscripts): "pInfo" [ please help ] -
iFarbod - 02.08.2014
Maybe that's because of your color defines.
'YELLOW' Seem to be something like this in your script :
pawn Код:
#define YELLOW "{FFFF00}"
It must be in Hex or int.
like this:
pawn Код:
#define YELLOW 0xFFFF00FF