AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   protection and info (https://forums.alliedmods.net/showthread.php?t=20078)

cTn 11-01-2005 04:43

protection and info
 
Code:

if (!(get_user_flags(id)&ADMIN_LEVEL_A)) {
               
                return PLUGIN_HANDLED
        }

if i add this to a plugin ... admin with level A can use them but m question is if someone another users Z flag and another admins .. how can i add message somethin like "u dont have acces to that command" ? pls help me

[ --<-@ ] Black Rose 11-01-2005 06:30

Code:
if (!(get_user_flags(id)&ADMIN_LEVEL_A)) {     client_print(id, print_console, "You have no acess to this command")     return PLUGIN_HANDLED }
or
Code:
if (!cmd_access(id,level,cid))
i think this returns the same msg...

cTn 11-01-2005 07:34

u dont understand me i need to show this message to people who dont have admin level A

Hawk552 11-01-2005 07:35

I think you mean

Code:
// ... public whatever_func(id,level,cid) // ...

Code:
//... #define ARGS 1 // ... // If the person does not type in only 1 arg (ARGS) (incl. command) it'll stop.     if(!cmd_access(id,level,cid,ARGS))         return 0; // ...

v3x 11-01-2005 07:42

If you don't get whole # of args thing, look @ this:
http://ghw-amxx.biz/images/args.gif
:wink:

Hawk552 11-01-2005 07:47

For things like read_argv(), 1 is the first argument, not the command itself. (although you can read 0, which is the command itself)

For cmd_access(), args is the total amount of arguments, including the command.

Yeah it makes no sense, but changing it would break backward compatibility I guess.

cTn 11-01-2005 08:10

i still dont understand anything ... haha i am the best newbie ever :D

Xanimos 11-01-2005 10:11

Here, I'll be nice and give you a full example.
Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {     register_plugin("blah" , "1.0" , "Suicid3")     register_concmd("amx_test" , "FuncTest" , ADMIN_LEVEL_A , "This is a test") } public FuncTest( id , level , cid) {     if(!cmd_access( id , level , cid , 1)) //meaning no arguments.        return PLUGIN_HANDLED     console_print( id , "[AMXX] You have access!!!!!!")     return PLUGIN_HANDLED }

just try this out and you will see.

v3x 11-01-2005 11:49

You forgot quotes at the end of the version portion, thus making everything red :D


All times are GMT -4. The time now is 23:39.

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