Player Permission System
#1

I have the following piece of code in my script:

pawn Код:
stock StaffRolePerm(id,perm[]){
    return srPerms[id][perm];
}
As far as I can tell, this function should work fine, however, when I attempt to compile I'm faced with this error:
Код:
error 033: array must be indexed (variable "perm")
Any help I could get would be greatly appreciated.. very confused.
Reply
#2

pawn Код:
stock StaffRolePerm(id,perm[]) return srPerms[id][perm];
Try this
Reply
#3

as the error implies..u cannot make string[] as an index of an array or maybe the fault is in the declaration of global variable
pawn Код:
new srPerms[id][perm];
//that should be
new srPerms[id][perm[]];//perm needs an enum
correct me if im wrong

ex: will actually look like if the index is a string
pawn Код:
CMD:example(playerid,params[])
{
    new string[]={a,b,c,d,e};
    StaffRolePerm(playerid,string[]);
    return 1;
}

stock StaffRolePerm(playerid,string[])//subbed already
{
    return srPerms[playerid][{a,b,c,d,e}];//this will give you error because index "perm" is not yet enumed
}
i think you can fix that if u make an enum
pawn Код:
enum perm
{
blah1,
blah2,
blah3,
blah4,
blah5,
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)