array must be indexed (variable "pJob") -
OpticKiller - 23.05.2013
Can someone help me with this error my mate scripted a job. but we both cant fix it.
Код:
error 033: array must be indexed (variable "pJob")
error 033: array must be indexed (variable "pJob")
Код:
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Level",PlayerInfo[playerid][pLevel]);
INI_Int("Job",PlayerInfo[playerid][pJob]); <----- this coming up with array must be indexed error.
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("SecKey",PlayerInfo[playerid][pSecKey]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Float("FacingAngle",PlayerInfo[playerid][pFacingAngle]);
INI_Float("Health",PlayerInfo[playerid][pHealth]);
INI_Float("Armour",PlayerInfo[playerid][pArmour]);
INI_Float("LastX", PlayerInfo[playerid][pLastX]);
INI_Float("LastY", PlayerInfo[playerid][pLastY]);
INI_Float("LastZ", PlayerInfo[playerid][pLastZ]);
return 1;
}
Код:
CMD:Fertalize(playerid, params[])
{
if(PlayerInfo[playerid][pJob] = 5) <--- this coming up with the same error as the top code.
SendClientMessage(playerid, COLOR_WHITE,"SHHHHHHHH");
return 1;
}
Re: array must be indexed (variable "pJob") -
2KY - 23.05.2013
You need to place pJob in your account enum, along with pHealth, pArmour, pLastX, ect.
Re: array must be indexed (variable "pJob") -
OpticKiller - 23.05.2013
i already done that but it was saying its already define
i will try it again.
EDIT: added it and i just removed new this new
pJob[MAX_PLAYERS];
and now coming up with error
Код:
error 028: invalid subscript (not an array or too many subscripts): "pJob"
code
Код:
if(response)
{
switch(dialogid)
{
case 171:// Credit to Sam Dialog Jobs
{
switch(listitem)// Checking which listitem was selected
{
case 0: // Jobless
{
SendClientMessage(playerid,0x33CCFFAA,"Congratulations with your new job, type /jobhelp to see your new command.");
pJob[playerid] = 1;
}
case 1: // Mechanic
{
SendClientMessage(playerid,0x33CCFFAA,"Congratulations with your new job, type /jobhelp to see your new command.");
pJob[playerid] = 2;
}
case 2: // Taxi
{
SendClientMessage(playerid,0x33CCFFAA,"Congratulations with your new job, type /jobhelp to see your new command.");
pJob[playerid] = 3;
}
case 3: // Fedex
{
SendClientMessage(playerid,0x33CCFFAA,"Congratulations with your new job, type /jobhelp to see your new command.");
pJob[playerid] = 4;
}
case 4: // Pizza Delivery
{
SendClientMessage(playerid,0x33CCFFAA,"Congratulations with your new job, type /jobhelp to see your new command.");
pJob[playerid] = 5;
}
}
}
}
}
Showing my player info
Код:
enum pInfo
{
pPass,
pCash,
pSkin,
pLevel,
pJob,
pSeed,
pInt,
pVW,
pAdmin,
pSecKey,
pKills,
pDeaths,
Float:pFacingAngle,
Float:pHealth,
Float:pArmour,
Float:pLastX,
Float:pLastY,
Float:pLastZ
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Re: array must be indexed (variable "pJob") -
2KY - 23.05.2013
pawn Код:
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Level",PlayerInfo[playerid][pLevel]);
INI_Int("Job",pJob[playerid]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("SecKey",PlayerInfo[playerid][pSecKey]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Float("FacingAngle",PlayerInfo[playerid][pFacingAngle]);
INI_Float("Health",PlayerInfo[playerid][pHealth]);
INI_Float("Armour",PlayerInfo[playerid][pArmour]);
INI_Float("LastX", PlayerInfo[playerid][pLastX]);
INI_Float("LastY", PlayerInfo[playerid][pLastY]);
INI_Float("LastZ", PlayerInfo[playerid][pLastZ]);
pawn Код:
CMD:Fertalize(playerid, params[])
{
if(pJob[playerid] == 5)
SendClientMessage(playerid, COLOR_WHITE,"SHHHHHHHH");
return 1;
}
pawn Код:
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Level",PlayerInfo[playerid][pLevel]);
INI_Int("Job",pJob[playerid]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("SecKey",PlayerInfo[playerid][pSecKey]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Float("FacingAngle",PlayerInfo[playerid][pFacingAngle]);
INI_Float("Health",PlayerInfo[playerid][pHealth]);
INI_Float("Armour",PlayerInfo[playerid][pArmour]);
INI_Float("LastX", PlayerInfo[playerid][pLastX]);
INI_Float("LastY", PlayerInfo[playerid][pLastY]);
INI_Float("LastZ", PlayerInfo[playerid][pLastZ]);
return 1;
}
Re: array must be indexed (variable "pJob") -
OpticKiller - 23.05.2013
Thanks man

really helpful.
Re: array must be indexed (variable "pJob") -
2KY - 23.05.2013
Quote:
Originally Posted by OpticKiller
Thanks man  really helpful.
|
Not a problem, hope you learned something!