AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   warning 209 when i definately returned a value (https://forums.alliedmods.net/showthread.php?t=233909)

xPwnage 01-21-2014 21:47

warning 209 when i definately returned a value
 
Im getting this error warning 209: function "@ClassSkipLevel" should return a value even though i scripted it to do so this is what i mean:
Code:

public @ClassSkipLevel ( Client, Level, PowerLevel )
{
if ( Level == 0 )
{
return 2;
}
else
{
return 1;
}
}

Gives me the error, why?
So far the only way it won't give me the warning is when i do this:
Code:

public @ClassSkipLevel ( Client, Level, PowerLevel )
{
return 1;
}

also this will not work same error:
Code:

public @ClassSkipLevel ( Client, Level, PowerLevel )
{
if ( Powerlevel >= 1000000 )
{
switch ( Level )
{
case 0:
{
return 1;
}
}
}
else
{
return 0;
}
}

The game in question is Half-life Mod ESF + ECX and im trying to make a character Ascend past a level when having achieved a high enough powerlevel. The function @ClassSkipLevel will skip you to Level x if achieved powerlevel y.
So basically i should be able to do this not?:
Code:

public @ClassSkipLevel ( Client, Level, PowerLevel )
{
if ( Level == 0 && PowerLevel >= 1000000 )
{
return 2;
}
else if ( Level == 0 && PowerLevel >= 1500000 )
{
return 3;
}
else if ( PowerLevel < 800000 )
{
return 0;
}
else
{
return 1;
}
}

I know theres not many ESF players out there anymore but i figured since its pawn maybe people here could help me see what im missing. why is it giving me the error?
It uses amxx 1.76d and metamod 1.19p31
Quote:

Or is this just ECX's Core Compiler Interface Being a @#$% and should i try to use amxxpc?
stripe that.. CCI uses amxxpc

YamiKaitou 01-21-2014 23:16

Re: warning 209 when i definately returned a value
 
Add a return statement at the end of the function

ConnorMcLeod 01-22-2014 00:53

Re: warning 209 when i definately returned a value
 
PHP Code:

public @ClassSkipLevel ClientLevelPowerLevel )
{
    if ( 
Level == )
    {
        return 
2;
    }
    else
    {
        return 
1;
    }
    return 
1;


or better :

PHP Code:

public @ClassSkipLevel ClientLevelPowerLevel )
{
    if ( !
Level )
    {
        return 
2;
    }

    return 
1;



fysiks 01-22-2014 03:08

Re: warning 209 when i definately returned a value
 
Or shorter yet:

PHP Code:


public @ClassSkipLevel ClientLevelPowerLevel )
{
    return (
Level 2);



xPwnage 01-22-2014 08:52

Re: warning 209 when i definately returned a value
 
OMG it works! You are gods! Thanks ever so much ill get back to here with more trouble later for sure xD
Cheers!


All times are GMT -4. The time now is 10:06.

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