AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   this code not work (https://forums.alliedmods.net/showthread.php?t=223061)

Choose_Your_Destiny 08-09-2013 12:30

this code not work
 
All admin have the ADMIN_LEVEL_H

Admin write "say /weapon".But, this is useless :(

PHP Code:

public item_selected(id)
{
    if(
is_user_alive(id) && get_user_flags(id) & ADMIN_LEVEL_H) {
        
ColorChat(idNORMAL,"^4[Biohazard]:^1 Buy to a ^3Cart Blue^1 gun should be ^4ADMIN^1!!")
        return 
PLUGIN_HANDLED
    
}
    new 
admin_name[32]
    
get_user_name(id,admin_name,31)

    new 
cash cs_get_user_money(id)

    if(
cash >= get_pcvar_num(cvar_cartblue_cash)) {
        
cs_set_user_money(idcash get_pcvar_num(cvar_cartblue_cash))
        
give_cartred(id)
        
ColorChat(id,NORMAL,"^4[Biohazard]:^1 ADMIN: %s You have purchased a ^4Cart Blue^1 gun.",admin_name)
    } else {
        
ColorChat(id,NORMAL,"^4[Biohazard]:^1 ADMIN: %s You don't have enough money! You need: %d $",admin_name,get_pcvar_num(cvar_cartblue_cash))
    }
    return 
PLUGIN_HANDLED



akcaliberg 08-09-2013 13:53

Re: this code not work
 
PHP Code:

public item_selected(id)
{
    if( !(
get_user_flags(id) & ADMIN_LEVEL_H) ) {
        
ColorChat(idNORMAL,"^4[Biohazard]:^1 Buy to a ^3Cart Blue^1 gun should be ^4ADMIN^1!!")
        return 
PLUGIN_HANDLED
    
}
    if( !
is_user_alive(id) ) {
        
ColorChat(idNORMAL,"^4[Biohazard]:^1 You have to be alive!")
        return 
PLUGIN_HANDLED
    
}
    new 
admin_name[32]
    
get_user_name(id,admin_name,31)
    
    new 
cash cs_get_user_money(id)
    
    if(
cash >= get_pcvar_num(cvar_cartblue_cash)) {
        
cs_set_user_money(idcash get_pcvar_num(cvar_cartblue_cash))
        
give_cartred(id)
        
ColorChat(id,NORMAL,"^4[Biohazard]:^1 ADMIN: %s You have purchased a ^4Cart Blue^1 gun.",admin_name)
        } else {
        
ColorChat(id,NORMAL,"^4[Biohazard]:^1 ADMIN: %s You don't have enough money! You need: %d $",admin_name,get_pcvar_num(cvar_cartblue_cash))
    }
    return 
PLUGIN_HANDLED




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

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