AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   code does not works properly (https://forums.alliedmods.net/showthread.php?t=90236)

Emilioneri 04-15-2009 14:21

code does not works properly
 
I wanted to make free admin nades plugin, but code does not works properly.
This should work only for admins with ADMIN_SLAY but it doesn't. It works for everyone. How to make it for admins only :?:

PHP Code:

/* Plugin generated by Emilioneri */

#include <amxmodx>
#include <fakemeta_util>

#define PLUGIN "Free Nades"
#define VERSION "1.0"
#define AUTHOR "Emilioneri"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
    
register_concmd("say /he""cmd_givehe"ADMIN_SLAY"Gives you a free nade")
    
register_concmd("say_team /he""cmd_givehe"ADMIN_SLAY"Gives you a free nade")
    
register_concmd("say /smoke""cmd_givesmoke"ADMIN_SLAY"Gives you a free nade")
    
register_concmd("say_team /smoke""cmd_givesmoke"ADMIN_SLAY"Gives you a free nade")
    
register_concmd("say /flash""cmd_giveflash"ADMIN_SLAY"Gives you a free nade")
    
register_concmd("say_team /flash""cmd_givehe"ADMIN_SLAY"Gives you a free nade")
}

public 
cmd_givehe(id)
{
    if (!
is_user_alive(id))
    {
        
client_print(idprint_chat"You can't get a free He-Grenade, because you are dead!")
    }
    else
    {
        
fm_give_item(id"weapon_hegrenade")
        
client_print(idprint_chat"You got a free He-Grenade")
    }
}

public 
cmd_givesmoke(id)
{
    if (!
is_user_alive(id))
    {
        
client_print(idprint_chat"You can't get a free Smoke-Grenade, because you are dead!")
    }
    else
    {
        
fm_give_item(id"weapon_smokegrenade")
        
client_print(idprint_chat"You got a free Smoke-Grenade")
    }
}

public 
cmd_giveflash(id)
{
    if (!
is_user_alive(id))
    {
        
client_print(idprint_chat"You can't get a free Flashbang, because you are dead!")
    }
    else
    {
        
fm_give_item(id"weapon_flashbang")
        
client_print(idprint_chat"You got a free Flashbang")
    }



Empowers 04-15-2009 15:00

Re: code does not works properly
 
PHP Code:

/* Plugin generated by Emilioneri */ 

#include <amxmodx>
#include <amxmisc>
#include <fakemeta_util> 

#define PLUGIN "Free Nades" 
#define VERSION "1.0" 
#define AUTHOR "Emilioneri" 


public plugin_init() { 
    
register_plugin(PLUGINVERSIONAUTHOR
     
    
// Add your code here... 
    
register_concmd("say /he""cmd_givehe"ADMIN_SLAY"Gives you a free nade"
    
register_concmd("say_team /he""cmd_givehe"ADMIN_SLAY"Gives you a free nade"
    
register_concmd("say /smoke""cmd_givesmoke"ADMIN_SLAY"Gives you a free nade"
    
register_concmd("say_team /smoke""cmd_givesmoke"ADMIN_SLAY"Gives you a free nade"
    
register_concmd("say /flash""cmd_giveflash"ADMIN_SLAY"Gives you a free nade"
    
register_concmd("say_team /flash""cmd_givehe"ADMIN_SLAY"Gives you a free nade"


public 
cmd_givehe(id
{
    if(!
access(id,ADMIN_SLAY))
    return 
PLUGIN_HANDLED;
    
    if (!
is_user_alive(id)) 
    { 
        
client_print(idprint_chat"You can't get a free He-Grenade, because you are dead!"
    } 
    else 
    { 
        
fm_give_item(id"weapon_hegrenade"
        
client_print(idprint_chat"You got a free He-Grenade"
    } 
    
    return 
PLUGIN_CONTINUE;


public 
cmd_givesmoke(id

    if(!
access(id,ADMIN_SLAY))
    return 
PLUGIN_HANDLED;
    
    if (!
is_user_alive(id)) 
    { 
        
client_print(idprint_chat"You can't get a free Smoke-Grenade, because you are dead!"
    } 
    else 
    { 
        
fm_give_item(id"weapon_smokegrenade"
        
client_print(idprint_chat"You got a free Smoke-Grenade"
    } 
    
    return 
PLUGIN_CONTINUE;


public 
cmd_giveflash(id

    if(!
access(id,ADMIN_SLAY))
    return 
PLUGIN_HANDLED;
    
    if (!
is_user_alive(id)) 
    { 
        
client_print(idprint_chat"You can't get a free Flashbang, because you are dead!"
    } 
    else 
    { 
        
fm_give_item(id"weapon_flashbang"
        
client_print(idprint_chat"You got a free Flashbang"
    } 
    
    return 
PLUGIN_CONTINUE;




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

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