View Single Post
Author Message
kikifrh
Senior Member
Join Date: May 2009
Old 06-15-2010 , 17:06   Plugin value 3 selected, bug!
Reply With Quote #1

Hi guys, I have a donate plugin (by wrecked_) that Im trying to edit, but I always donate 3. My changes were:
I added
client_cmd(id, "messagemode Donate_Amount"); and then it goes to CMD_Say. It was supposed to be called with say(_team).
Somehow I always donate 3, even if I type 1,2,3...1000.
How do I fix?
Code:
public CMD_Say( id )
{
    if( b_TypeAmount[id] )
    {
        b_TypeAmount[id] = false
        
        new said[128]
        read_argv( 1, said, 127 )
        remove_quotes( said )
        trim( said )
        if( !is_str_num( said ) )
        {
            ChatColor( id, "%s Invalid value!", prefix )
            
            return PLUGIN_HANDLED_MAIN;
        }
        
        new iDonation = str_to_num( said )
        
        if( iDonation <= 0 )
        {            
            return PLUGIN_HANDLED_MAIN;
        }
        
        new iMoney = cs_get_user_money( id )
        
        if( iMoney < iDonation )
        {
            ChatColor( id, "%s You don't have $%i!", prefix, iDonation )
            
            return PLUGIN_HANDLED_MAIN;
        }
        
        new idname[64]
        get_user_name( id, idname, 63 )
        
        new donatename[64]
        new donateid
        GET_Donation_Info( id, donatename, charsmax( donatename ), donateid ) // whut?! byref!?
        
        cs_set_user_money( id, iMoney - iDonation )
        cs_set_user_money( donateid, cs_get_user_money( donateid ) + iDonation )
        
        ChatColor( id, "%s You have just donated $%i to %s!", prefix, iDonation, donatename )
        ChatColor( donateid, "%s You just received a donation of $%i from %s!", prefix, iDonation, idname )
        
        RESET_Donations( id )
        RESET_Donations( donateid )
        
        return PLUGIN_HANDLED_MAIN;
    }
    
    return PLUGIN_CONTINUE;
}
Thx
kikifrh is offline