AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Code warning, why? :( (https://forums.alliedmods.net/showthread.php?t=128206)

kikifrh 05-29-2010 21:07

Code warning, why? :(
 
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

drekes 05-29-2010 21:12

Re: Code warning, why? :(
 
you got a bad indention here
Code:

if ( iMoney >= 16000 )



and you need to return on the end of the fucntion

Bugsy 05-29-2010 23:56

Re: Code warning, why? :(
 
Add return PLUGIN_HANDLED at the bottom of the function before the closing bracket.


All times are GMT -4. The time now is 05:21.

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