Raised This Month: $ Target: $400
 0% 

Code warning, why? :(


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kikifrh
Senior Member
Join Date: May 2009
Old 05-29-2010 , 21:07   Code warning, why? :(
Reply With Quote #1

well guys I made an code but I get errors
here is the code:
Code:
GiveMoney(id)
{
    new iMoney = cs_get_user_money(id);

      if ( iMoney >= 16000 )
    {
        return PLUGIN_HANDLED;
    } 
    
    else if ( iMoney < 16000 || iMoney > 11000 )
    {
        cs_set_user_money(id, 16000);
    }

    else if ( get_user_team(id) == 3 )
    {
        set_hudmessage(40, 60, 150, -1.0, 0.84, 0, 0.50, 0.50, 0.50, 0.50, 2);
        show_hudmessage(id, "Spectators can't use this fuction");
    }

    else if ( is_user_alive(id) && !GiveMoney[id] && get_user_team(id) == 1 )
    {
        cs_set_user_money(id, cs_get_user_money (id) + 5000);
        GiveMoney[id] = true;
    }

    else if ( GiveMoney[id] )
    {
        set_hudmessage(40, 60, 150, -1.0, 0.84, 0, 0.50, 0.50, 0.50, 0.50, 2);
        show_hudmessage(id, "You already got you money on this map");
    }
}
this is my warning:
warning 209: function "GiveMoney" should return a value
how can I fix? Thx
P.S: The only way of making givemoney = false is on change map.
P.S2: I just started getting errors after adding the red letters code
kikifrh is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-29-2010 , 21:12   Re: Code warning, why? :(
Reply With Quote #2

you got a bad indention here
Code:
 if ( iMoney >= 16000 )


and you need to return on the end of the fucntion
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-29-2010 , 23:56   Re: Code warning, why? :(
Reply With Quote #3

Add return PLUGIN_HANDLED at the bottom of the function before the closing bracket.
__________________
Bugsy is offline
Reply



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 05:21.


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