AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [how] instead of (id, level, cid) (https://forums.alliedmods.net/showthread.php?t=156027)

avril-lavigne 04-29-2011 23:46

[how] instead of (id, level, cid)
 
in this function
public HandleBanhammer(id, level, cid) {
if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED;

it checks an admin access

how to make it
public HandleBanhammer(id)


but with similar check.

if (get_user_flags == ?

kNowo 04-29-2011 23:54

Re: [how] instead of (id, level, cid)
 
yes, AFAIK

Code:

public BanHammer(id)
{
    if(!(get_user_flags(id) & ADMIN_ACCESS_HERE))
        return PLUGIN_HANDLED

    //code here//
    ...


avril-lavigne 04-30-2011 00:06

Re: [how] instead of (id, level, cid)
 
if (get_user_flags(id) & ADMIN_LEVEL_B) return PLUGIN_HANDLED;

ok found

fysiks 04-30-2011 00:08

Re: [how] instead of (id, level, cid)
 
Why do you not want to use it that way?

You should at least do something like this:

Code:


public cmd_function(id, level)
{
    if( !(get_user_flags(id) & level) )
    {
        return PLUGIN_HANDLED
    }
}

This will let you change the access level in cmdaccess.ini so that it's not entirely hard coded.

reinert 04-30-2011 03:40

Re: [how] instead of (id, level, cid)
 
also you should use

~get_user_flags(id) & level

instead

!(get_user_flags(id) & level)

ConnorMcLeod 04-30-2011 04:37

Re: [how] instead of (id, level, cid)
 
Stick with cmd_access.

Exolent[jNr] 04-30-2011 17:02

Re: [how] instead of (id, level, cid)
 
Quote:

Originally Posted by reinert (Post 1460516)
also you should use

~get_user_flags(id) & level

instead

!(get_user_flags(id) & level)

It's the same thing.


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

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