AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   add access flags (https://forums.alliedmods.net/showthread.php?t=324921)

itoxicreal 06-01-2020 01:18

add access flags
 
Hey does anyone know how to add flags for a plugin ,Basically someone needs a certin flag to use this command.

Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

new const PLUGIN[] = "Reset Death"
new const VERSION[] = "0.1"
new const AUTHOR[] = "Mr Miss"


public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /rs","cmd_rs");

}
public cmd_rs(id)
{
cs_set_user_deaths(id,0);
client_print_color(id,id,"^4|^3| ^4Reset Score ^3|^4| ^4YOUR DEATHS ^1HAVE BEEN SET TO ^4[0]");
return PLUGIN_HANDLED;
}


MagNNusS 06-01-2020 08:28

Re: add access flags
 
Check if user has those 'certin' flags with get_user_flags

OciXCrom 06-01-2020 09:15

Re: add access flags
 
Add the flag as the third parameter in register_clcmd() and use cmd_access() in the callback function.

supertrio17 06-01-2020 21:34

Re: add access flags
 
You can do something like this

PHP Code:

public cmd_rs(id)
{
    if (
has_flag(idt)) //you change your flag here, t for example
    
{
        
cs_set_user_deaths(id,0);
        
client_print_color(id,id,"^4|^3| ^4Reset Score ^3|^4| ^4YOUR DEATHS ^1HAVE BEEN SET TO ^4[0]");
        return 
PLUGIN_HANDLED;
    }




All times are GMT -4. The time now is 10:07.

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