AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Access to command only on certain flags (https://forums.alliedmods.net/showthread.php?t=298984)

Adryyy 06-28-2017 14:24

Access to command only on certain flags
 
Hi. I would like to make an command accessible only on certain flags

Command amx_test, accesbile just for admins with flags "abcdefg" and "hijklmno"

wickedd 06-28-2017 14:50

Re: Access to command only on certain flags
 
Read this

D3XT3R 06-28-2017 19:22

Re: Access to command only on certain flags
 
just make a flag the plugin has double flags by if get user flag admin_leve_h else admin_level_g ...

Adryyy 06-29-2017 15:54

Re: Access to command only on certain flags
 
No no no
Look, i have this

new const FLAGS[2][]=
{
"abcdefg",//flags 1
"hijklmno"//flags 2
}

In public 1

....
for(new i;i<2;i++)
{
if(get_user_flags(id)==read_flags(FLAGS[i])) return true
}

But it does not work, does not read

tarkan00 06-29-2017 16:59

Re: Access to command only on certain flags
 
Quote:

Originally Posted by Adryyy (Post 2532525)
No no no
Look, i have this

new const FLAGS[2][]=
{
"abcdefg",//flags 1
"hijklmno"//flags 2
}

In public 1

....
for(new i;i<2;i++)
{
if(get_user_flags(id)==read_flags(FLAGS[i])) return true
}

But it does not work, does not read

hey bro you can use this :
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "flags plugin"
#define VERSION "1.0"
#define AUTHOR "tarkan"

new const FLAGS[2][]=
{
"abcdefg",//flags 1
"hijklmno"//flags 2
}

public 
plugin_init() {
register_plugin(PLUGINVERSIONAUTHOR)

register_clcmd("say /test","calis")
}
public 
calis(id)
{
for(new 
0sizeof FLAGSi++){
    if(
get_user_flags(id) == read_flags(FLAGS[i])){
        
///////////////////////    your cmds
        ///////////////////////    your cmds
        ///////////////////////    your cmds
        
    
}
}



Natsheh 06-30-2017 02:27

Re: Access to command only on certain flags
 
Opting in to FlagManager enables the admin privileges to be overwritten
by the end user via the cmdaccess.ini config file.

DjSoftero 06-30-2017 07:38

Re: Access to command only on certain flags
 
Quote:

Originally Posted by tarkan00 (Post 2532532)
hey bro you can use this :
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "flags plugin"
#define VERSION "1.0"
#define AUTHOR "tarkan"

new const FLAGS[2][]=
{
"abcdefg",//flags 1
"hijklmno"//flags 2
}

public 
plugin_init() {
register_plugin(PLUGINVERSIONAUTHOR)

register_clcmd("say /test","calis")
}
public 
calis(id)
{
for(new 
0sizeof FLAGSi++){
    if(
get_user_flags(id) == read_flags(FLAGS[i])){
        
///////////////////////    your cmds
        ///////////////////////    your cmds
        ///////////////////////    your cmds
        
    
}
}



pretty sure you cant compare returned data of get_user_flags(id) wth a string. You would have to do smth like:
PHP Code:

new flags get_user_flags(id)
if(
flags ADMIN_LEVEL_H || flags ADMIN_RCON ){//etc. i`m not very familiar with bitsums, so i might kinda be wrong. but comparing it to string is rly not the way to do it.
        ///////////////////////    your cmds
        ///////////////////////    your cmds
        ///////////////////////    your cmds
        
    



Natsheh 06-30-2017 08:32

Re: Access to command only on certain flags
 
Why not just edit the config file ( cmdaccess)

Adryyy 06-30-2017 09:42

Re: Access to command only on certain flags
 
Quote:

Originally Posted by tarkan00 (Post 2532532)
hey bro you can use this :
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "flags plugin"
#define VERSION "1.0"
#define AUTHOR "tarkan"

new const FLAGS[2][]=
{
"abcdefg",//flags 1
"hijklmno"//flags 2
}

public 
plugin_init() {
register_plugin(PLUGINVERSIONAUTHOR)

register_clcmd("say /test","calis")
}
public 
calis(id)
{
for(new 
0sizeof FLAGSi++){
    if(
get_user_flags(id) == read_flags(FLAGS[i])){
        
///////////////////////    your cmds
        ///////////////////////    your cmds
        ///////////////////////    your cmds
        
    
}
}



Thx. Worked!

tarkan00 06-30-2017 12:08

Re: Access to command only on certain flags
 
y
Quote:

Originally Posted by DjSoftero (Post 2532625)
pretty sure you cant compare returned data of get_user_flags(id) wth a string. You would have to do smth like:
PHP Code:

new flags get_user_flags(id)
if(
flags ADMIN_LEVEL_H || flags ADMIN_RCON ){//etc. i`m not very familiar with bitsums, so i might kinda be wrong. but comparing it to string is rly not the way to do it.
        ///////////////////////    your cmds
        ///////////////////////    your cmds
        ///////////////////////    your cmds
        
    



hey bii tch
are you seeing ?
this is good job
if you don't know a work just quiet cunt

Quote:

Originally Posted by Adryyy (Post 2532649)
Thx. Worked!

your welcome my brother


All times are GMT -4. The time now is 01:31.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.