29.01.2013, 08:56
Edited your code a bit, changed it into two functions so it should be a little easier to debug if you have problems.
UNTESTED:
UNTESTED:
pawn Код:
stock SetAdminCommand(command[], ...)
{
new idx = 0;
for(new level = 1; level < numargs(); level++)
{
if( ( idx = getarg(level) ) )//if level is more than zero
{
Group_SetGlobalCommand(Command_GetID(command), false);
//you appeared to use the admin level as an index in your code.
//You should add bounds checks to make sure you don't access elements OOB
Group_SetCommand(SerwerData[E_SERWER_GROUP_ADMINS][ idx ], Command_GetID(command), true);
}
else
{
Group_SetGlobalCommand(Command_GetID(command), true);
}
}
}
stock UnSetAdminCommand(command[], ...)
{
new idx = 0;
for(new level = 1; level < numargs(); level++)
{
if( ( idx = getarg(level) ) )
{
Group_SetGlobalCommand(Command_GetID(command), true);
//You should add bounds checks to make sure you don't access elements OOB
Group_SetCommand(SerwerData[E_SERWER_GROUP_ADMINS][ idx ], Command_GetID(command), false);
}
else
{
Group_SetGlobalCommand(Command_GetID(command), false);
}
}
}