please dont link me to
this i know how it works in the coding sence, i want to know how it
really works
Lets start with a snippet:
PHP Code:
#include <amxmodx>
#include <amxmisc>
public plugin_init()
{
register_plugin("flags test", "1.0", "Stewie!");
register_clcmd("say /myflags", "myflags", -1, "Handles the /myflags command");
}
public myflags(id)
{
if(get_user_flags(id) & ADMIN_ADMIN)
{
client_print(id, print_chat, "You are an admin!");
}
else
{
client_print(id, print_chat, "You are not an admin!");
}
}
So clearly, ADMIN_ADMIN and all the other flags are defined as:
PHP Code:
#define ADMIN_ADMIN 1
#define ADMIN_IMMUNITY 2
#define ADMIN_BAN 4
#define ADMIN_KICK 8
etc.
when get_user_flags(id) is called, the function loops through the users.ini file to see if the steamID of who called the func matches an entry
something like this:
PHP Code:
get_user_flags(id)
{
if(file_exists(gUsersIni))
{
new TextLine[33];
new NoOfChars;
new szPlayerAuth[33];
new Lines = file_size(gUsersIni, 1);
new szParse[2][33];
new iValue = 0;
for(new LineToRead; LineToRead < Lines; LineToRead++)
{
read_file(gUsersIni, LineToRead, TextLine, 32, NoOfChars);
if(!TextLine[0] || TextLine[0] == ';' || TextLine[0] == '/' && TextLine[1] == '/')
{
continue;
}
get_user_authid(id, szPlayerAuth, 32);
parse(TextLine, szParse[0], 32, szParse[1], 32);
if(equali(szPlayerAuth, szParse[0]))
{
if(containi(szParse[1], "a"))
{
return ADMIN_IMMUNITY; //This line
}
}
}
}
return 0;
}
but what happens on the lines that ive commented?
Clearly you cannot return more than 1 value so doing this wouldnt work
PHP Code:
if((containi(szParse[1], "a")) && (containi(szParse[1], "b")))
{
return ADMIN_IMMUNITY && ADMIN_BAN;
}
any1 know how it works properly?
__________________