AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   I want Only admins can use this plugin but I can't help pls (https://forums.alliedmods.net/showthread.php?t=243299)

lugat2001 07-02-2014 12:53

I want Only admins can use this plugin but I can't help pls
 
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <engine>
#include <fun>
#include <amxmodx>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /100le","can")


}
public can(player) {

if(is_user_connected( player ) && is_user_alive( player ) && get_user_team( player ) == 1)

set_user_health(1,100)


}


I want Only admins can use this plugin but I can't help pls

Flick3rR 07-02-2014 13:09

Re: I want Only admins can use this plugin but I can't help pls
 
Change the flag from this line:
PHP Code:

#define FLAG ADMIN_KICK 

The code:
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

#define FLAG ADMIN_KICK

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /100le","can")
}

public 
can(player) {
    if(
is_user_aliveplayer ) && get_user_team(player) == && get_user_flags(player) & FLAG)

        
set_user_health(player100)


Just have to add a check for the flag via "get_user_flags(player)"

lugat2001 07-02-2014 13:19

Re: I want Only admins can use this plugin but I can't help pls
 
no I don't want only admins healing
I want all terorist healing
but I want only admins can use /100le command

Porta0123 07-02-2014 13:34

Re: I want Only admins can use this plugin but I can't help pls
 
Code:
#include <amxmodx> #include <fun> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "author" #define FLAG ADMIN_KICK new pnum new players[32], tempid; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /100le","can") } public can(player) {     if(get_user_flags(player) & FLAG)     {     get_players(players, pnum);         for(new i = 0; i < pnum; i++)     {           tempid = players[i];         if(get_user_team(tempid) == 1 && is_user_alive( tempid ))         {              set_user_health(tempid, 100)         }     }     } }
this heal all tt players

lugat2001 07-02-2014 14:16

Re: I want Only admins can use this plugin but I can't help pls
 
Quote:

Originally Posted by Porta0123 (Post 2160940)
Code:
#include <amxmodx> #include <fun> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "author" #define FLAG ADMIN_KICK new pnum new players[32], tempid; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /100le","can") } public can(player) {     if(get_user_flags(player) & FLAG)     {     get_players(players, pnum);         for(new i = 0; i < pnum; i++)     {           tempid = players[i];         if(get_user_team(tempid) == 1 && is_user_alive( tempid ))         {              set_user_health(tempid, 100)         }     }     } }
this heal all tt players

ty can I publish this on my blog?

Porta0123 07-02-2014 14:35

Re: I want Only admins can use this plugin but I can't help pls
 
why not? xd

lugat2001 07-02-2014 14:38

Re: I want Only admins can use this plugin but I can't help pls
 
ty :)

mottzi 07-02-2014 17:37

Re: I want Only admins can use this plugin but I can't help pls
 
PHP Code:

public can(player) {
    if(
get_user_flags(player) & FLAG)
    {
        
get_players(playerspnum);
    
        for(new 
0pnumi++)
        {   
            
tempid players[i];
            if(
get_user_team(tempid) == && is_user_alivetempid ))
            {
                
set_user_health(tempid100)
            }
        }
    }


:arrow:
PHP Code:

public can(player) {
    if(
get_user_flags(player) & FLAG)
    {
        
get_players(playerspnum"ae""TERRORIST");
    
        for(new 
0pnumi++)
        {   
            
tempid players[i];
            
set_user_health(tempid100)
        }
    }



devilicioux 07-03-2014 04:31

Re: I want Only admins can use this plugin but I can't help pls
 
Why no one is using this way of setting levels of commands ?

PHP Code:

register_clcmd("say /something","cmdSomething",ADMIN_KICK,"- displays Something menu"

PHP Code:

public cmdSomething(id,level,cid) {
if (!
cmd_access(id,level,cid,1))
    return 
PLUGIN_HANDLED //Block if no access 
 
//Do the work if player has access



mottzi 07-03-2014 05:54

Re: I want Only admins can use this plugin but I can't help pls
 
In the end it comes to the same.
I find the cmd_acess() way less readable than checking with flags manualy...


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

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