AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Accessibility . (https://forums.alliedmods.net/showthread.php?t=147579)

ImXinR 01-11-2011 03:55

Accessibility .
 
Can someone tell me how do I make a plugin That only , Example , Only admin with flag "b" Which is ADMIN_RESERVATION , Can access to this a certain "menu" , the person who can do the things while other flags cant do .

DarkGod 01-11-2011 05:01

Re: Accessibility .
 
Code:
if(!(get_user_flags(index) & ADMIN_RESERVATION)   ) {    //User does not have flag 'b' }

or

Code:
if(get_user_flags(index) & ADMIN_RESERVATION) {    //User has flag 'b' }

reinert 01-11-2011 05:03

Re: Accessibility .
 
Quote:

Originally Posted by DarkGod (Post 1391152)
Code:
if(!(get_user_flags(index) & ADMIN_RESERVATION) ) { //User does not have flag 'b' }

->
PHP Code:

if( ~get_user_flags(index) & ADMIN_RESERVATION )
{
   
//User does not have flag 'b'



DarkGod 01-11-2011 05:15

Re: Accessibility .
 
Quote:

Originally Posted by reinert (Post 1391153)
->
PHP Code:

if( ~get_user_flags(index) & ADMIN_RESERVATION )
{
   
//User does not have flag 'b'



Mine works, either way.

ImXinR 01-11-2011 06:01

Re: Accessibility .
 
Oh Ok Thanks but what if its this plugin ? How to edit it and put the following code in here? :O
Quote:

#include <amxmodx>
#include <engine>
#include <amxmisc>

#define PLUGIN "ANTI SPRAY"
#define VERSION "1.0"
#define AUTHOR "29th ID"

#define SPRAY 201
#define SPRAYS ADMIN_RESERVATION

new g_pCvarEnabled

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)

g_pCvarEnabled = register_cvar("amx_blocksprays", "1")
}

// Fakemeta way would be Hooking the forward FM_CmdStart.
// An example of how to block certain command using FM_CmdStart
// http://forums.alliedmods.net/showthr...823#post351823

public client_impulse(id, impulse)
{
if(get_pcvar_num(g_pCvarEnabled) && impulse == SPRAY)
{
client_print(id, print_chat, "[AMXX] You are not allowed to spray. DUDE!");
return PLUGIN_HANDLED;
}

return PLUGIN_CONTINUE;

}


All times are GMT -4. The time now is 02:12.

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