AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to make it simpler? (https://forums.alliedmods.net/showthread.php?t=223402)

Gasior 08-13-2013 04:31

How to make it simpler?
 
I have /funshop and I want ADMIN_FLAG_X to have a price off, I know how to do this but I'm sure it can be simpler.
PHP Code:

         case 4:
         {
         
                new 
usermoney cs_get_user_money(id)
        if(
get_user_flags(id) & ADMIN_FLAG_X) {
            if(
usermoney 4900 ){
                
ColorChat(id,RED,"^3 [FNUSHOP] ^4 Nie stac Cie na to."0
                return 
PLUGIN_HANDLED
                
}
            else {
                if(
get_user_health(id) > 150){
                
ColorChat(id,RED,"^3 [FUNSHOP] ^4 Juz zakupiles ta usluge. "0)
                return 
PLUGIN_HANDLED
                
}
                else{
                    
set_user_health(id, (get_user_health(id) + 100))
                    
cs_set_user_money(idcs_get_user_money(id) - 4900)
                    
ColorChat(id,RED,"^3 [FUNSHOP] ^4 Zakupiles ^3 100 HP ^4!"0
                    return 
PLUGIN_HANDLED
                    
}
                }
            }
        else {
            if(
usermoney 7000 ){
                
ColorChat(id,RED,"^3 [FNUSHOP] ^4 Nie stac Cie na to."0
                return 
PLUGIN_HANDLED
            
}
            else {
                if(
get_user_health(id) > 150){
                
ColorChat(id,RED,"^3 [FUNSHOP] ^4 Juz zakupiles ta usluge. "0)
                return 
PLUGIN_HANDLED
                
}
                else{
                    
set_user_health(id, (get_user_health(id) + 100))
                    
cs_set_user_money(idcs_get_user_money(id) - 7000)
                    
ColorChat(id,RED,"^3 [FUNSHOP] ^4 Zakupiles ^3 100 HP ^4!"0
                    return 
PLUGIN_HANDLED
                    
}
                }
            }
    } 

Is there a way to put (get_user_flags(id) & ADMIN_FLAG_X) into cs_set_user_money(id, cs_get_user_money(id) - 7000) ? It would make my life so much easier.

devilicioux 08-13-2013 04:37

Re: How to make it simpler?
 
Want to give sumthing free to admin with specific flags ?

Gasior 08-13-2013 05:42

Re: How to make it simpler?
 
Just want to give them a lower price, just like on the code above.

I am asking only if someone knows simpler way to do that.

akcaliberg 08-13-2013 10:09

Re: How to make it simpler?
 
you can use this.

PHP Code:

new price access(id,ADMIN_FLAG_X) ? 4900 7000 

if user has ADMIN_FLAG_X, the price will be 4900 otherwise it will be 7000

Gasior 08-15-2013 09:49

Re: How to make it simpler?
 
Thanks, so now I use it like
cs_set_user_money(id, cs_get_user_money(id) - price) ?

akcaliberg 08-15-2013 10:44

Re: How to make it simpler?
 
yes.


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

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