Raised This Month: $ Target: $400
 0% 

How to make it simpler?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Gasior
Member
Join Date: Mar 2012
Old 08-13-2013 , 04:31   How to make it simpler?
Reply With Quote #1

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.
Gasior is offline
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 08-13-2013 , 04:37   Re: How to make it simpler?
Reply With Quote #2

Want to give sumthing free to admin with specific flags ?
__________________
You keep bringing ANTICHRISTUS down .. He will rise again and kick asses !

#RespectList ANTICHRISTUS fysiks Bugsy

Most Common Errors You Can Encounter Every Now and Then
devilicioux is offline
Gasior
Member
Join Date: Mar 2012
Old 08-13-2013 , 05:42   Re: How to make it simpler?
Reply With Quote #3

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.
Gasior is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 08-13-2013 , 10:09   Re: How to make it simpler?
Reply With Quote #4

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
akcaliberg is offline
Gasior
Member
Join Date: Mar 2012
Old 08-15-2013 , 09:49   Re: How to make it simpler?
Reply With Quote #5

Thanks, so now I use it like
cs_set_user_money(id, cs_get_user_money(id) - price) ?
Gasior is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 08-15-2013 , 10:44   Re: How to make it simpler?
Reply With Quote #6

yes.
akcaliberg is offline
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 15:54.


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