Raised This Month: $ Target: $400
 0% 

code does not works properly


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Emilioneri
Senior Member
Join Date: Feb 2009
Location: Georgia, Tbilisi
Old 04-15-2009 , 14:21   code does not works properly
Reply With Quote #1

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")
    }

__________________
Emilioneri is offline
Send a message via Skype™ to Emilioneri
Empowers
BANNED
Join Date: Feb 2009
Location: Ukraine
Old 04-15-2009 , 15:00   Re: code does not works properly
Reply With Quote #2

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;

Empowers is offline
Send a message via ICQ to Empowers
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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