AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   cs 1.6 flag selection (https://forums.alliedmods.net/showthread.php?t=339530)

GGC Theos 09-14-2022 22:08

cs 1.6 flag selection
 
1 Attachment(s)
Hello guys, someone know how to select who will have access in a plugin? and change the flag to me only (creator). Thank you

I gave u the sma file too.

fysiks 09-15-2022 00:20

Re: cs 1.6 flag selection
 
Add a check for access at the beginning of each of the functions to which you want to restrict access:

PHP Code:

    if( !access(idADMIN_LEVEL_A) )
    {
        return 
PLUGIN_HANDLED;
    } 

You'll need to include amxmisc.inc.

GGC Theos 09-15-2022 00:23

Re: cs 1.6 flag selection
 
Thank you. i need to define ADMIN_LEVEL_A too right?

fysiks 09-15-2022 00:41

Re: cs 1.6 flag selection
 
Quote:

Originally Posted by GGC Theos (Post 2788866)
Thank you. i need to define ADMIN_LEVEL_A too right?

No, all of the admin flags are defined in amxconst.inc.

GGC Theos 09-15-2022 00:45

Re: cs 1.6 flag selection
 
Thanks a lot my man!

fysiks 09-15-2022 00:46

Re: cs 1.6 flag selection
 
FYI, I forgot to add the "not" (!) for the access check. I've fixed that above.

GGC Theos 09-20-2022 06:37

Re: cs 1.6 flag selection
 
Quote:

Originally Posted by fysiks (Post 2788869)
FYI, I forgot to add the "not" (!) for the access check. I've fixed that above.


Okay okay thank you mate. i will restrict access for players and admins (only creators will have it)

GGC Theos 09-20-2022 07:08

Re: cs 1.6 flag selection
 
Quote:

Originally Posted by fysiks (Post 2788869)
FYI, I forgot to add the "not" (!) for the access check. I've fixed that above.

It has errors and i cant compile it. i also put the semicolon in return_handled;
but something went wrong

fysiks 09-21-2022 00:50

Re: cs 1.6 flag selection
 
Please attach your edited version so that we can see what your modifications look like. Adding the semicolon after the "return PLUGIN_HANDLED" is required due to the "#pragma semicolon 1;" (I've updated my example above accordingly).


All times are GMT -4. The time now is 15:41.

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