array must be indexed (variable "pJob")
#1

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;
}
Reply
#2

You need to place pJob in your account enum, along with pHealth, pArmour, pLastX, ect.
Reply
#3

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];
Reply
#4

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;
}
Reply
#5

Thanks man really helpful.
Reply
#6

Quote:
Originally Posted by OpticKiller
Посмотреть сообщение
Thanks man really helpful.
Not a problem, hope you learned something!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)