As i think these functions work fine, but the problem is with putting in the array.
PHP Code:
#define MAXFLAGS 32
new Vip_flags[MAXFLAGS], access_flags
public _create_vip_flag(plugin, argc) // native
{
new vflag[2], sString[32]
get_string(1, vflag, charsmax(vflag))
if(_flags_are_existed(vflag, sString, charsmax(sString)))
{
log_error(AMX_ERR_PARAMS, "Error couldn't create a vip flag ^"%s^", it's already created!", sString)
return -1
}
Vip_flags[access_flags] = vflag[0]
access_flags ++
return access_flags-1
}
public bool:_flags_are_existed(const vflags[], sflags[], len) // native
{
if(!strlen(Vip_flags))
{
return false;
}
new x, i, fid, feq
new flags[MAXFLAGS], zFlag[2]
for(i = 0; i < strlen(vflags); i++)
{
feq = 0
for(x = 0; x < access_flags; x++)
{
zFlag[0] = Vip_flags[x]
if(zFlag[0] == vflags[i])
{
feq ++;
}
}
if(!feq)
{
flags[fid] = vflags[i]
fid ++;
}
}
if(fid)
{
copy(sflags, len, flags)
return false;
}
return true;
}
when flags a & c
is created by this native >> create_vip_flag(const vflag[])
PHP Code:
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
if(!flags_are_existed("a"))
{
create_vip_flag("a")
}
if(!flags_are_existed("c"))
{
create_vip_flag("c")
}
}
flag c isn't input in the array(Vip_flags)!
IDK why that's what i'm trying to figure it out?!