Player Permission System - 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: Player Permission System (
/showthread.php?tid=540475)
Player Permission System -
jtemple042996 - 05.10.2014
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.
Re: Player Permission System -
Josh_Main - 05.10.2014
pawn Код:
stock StaffRolePerm(id,perm[]) return srPerms[id][perm];
Try this
Re: Player Permission System -
Quickie - 05.10.2014
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,
}