Raised This Month: $51 Target: $400
 12% 

209 error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 12-19-2013 , 14:05   209 error
Reply With Quote #1

Hey all,

Trying to help somebody in the request and got a 209 return error. I have a return plugin_handled in there but is it in the incorrect place? I am still pretty new to scripting.

PHP Code:
 #include < amxmodx > 
#include < amxmisc > 
#include < cstrike > 

public plugin_init( ) { 
    
register_plugin"All to Spec""1.0""joshknifer" ); 
     
    
register_concmd"amx_allspec""CmdAllSpec"ADMIN_KICK ); 


public 
CmdAllSpecidiLeveliCid ) { 
    if( !
cmd_accessidiLeveliCid) ) 
        return 
PLUGIN_HANDLED
     
    new 
iPlayers32 ], iNum
    
get_playersiPlayersiNum ); 
     
    for( new 
iiNumi++ ) { 
        
id iPlayers]; 
        
cs_set_user_team(idCS_TEAM_SPECTATOR);    //Set team
        
user_kill(id1); // Kill user
        
cs_set_user_deaths(idget_user_deaths(id) - 1)    // user_kill adds 1 to deaths, recalc it if you want.  
        
}  
return 
PLUGIN_HANDLED;

__________________

Last edited by joshknifer; 12-19-2013 at 14:29.
joshknifer is offline
Send a message via Skype™ to joshknifer
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-19-2013 , 14:08   Re: 209 error
Reply With Quote #2

I thought you were not able to change player teams in a for loop. I think there is a thread in the Code Snippets/Tutorials about changing teams for everybody.

Also, if you are going to post about an error, post the error output (all of it).
__________________
fysiks is offline
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 12-19-2013 , 14:10   Re: 209 error
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
I thought you were not able to change player teams in a for loop. I think there is a thread in the Code Snippets/Tutorials about changing teams for everybody.

Also, if you are going to post about an error, post the error output (all of it).
Not sure about that first part but I will search for that thread. If there is a more efficient method let me know for sure.
Edit: Found this where Claud uses a switch, but there are not multiple teams and it is still with in a for loop. Let me know if you find the one you were talking about. All the examples I found are within a for loop.

Here are the details:

Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/tmp/textTJPBWN.sma(26) : warning 209: function "CmdAllSpec" should return a value
Header size:            424 bytes
Code size:             1648 bytes
Data size:              336 bytes
Stack/heap size:      16384 bytes; estimated max. usage=781 cells (3124 bytes)
Total requirements:   18792 bytes

1 Warning.
Done.
__________________

Last edited by joshknifer; 12-19-2013 at 14:22.
joshknifer is offline
Send a message via Skype™ to joshknifer
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-19-2013 , 14:16   Re: 209 error
Reply With Quote #4

. . . a "warning" is not an error. The warning is saying that if you return a value explicitly in any part of the function, you must then make sure to return a value explicitly for every possible execution of the code. This usually requires returning at the end of the function but it can also be an indication of a bad formulation for the function.

Also, I just noticed that you are returning inside the loop so it will stop the function after the first execution of the loop.
__________________

Last edited by fysiks; 12-19-2013 at 14:18.
fysiks is offline
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 12-19-2013 , 14:24   Re: 209 error
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
. . . a "warning" is not an error. The warning is saying that if you return a value explicitly in any part of the function, you must then make sure to return a value explicitly for every possible execution of the code. This usually requires returning at the end of the function but it can also be an indication of a bad formulation for the function.

Also, I just noticed that you are returning inside the loop so it will stop the function after the first execution of the loop.
Ahh that was it! Moving the return fixed the warning. (edited above) Good catch.
__________________

Last edited by joshknifer; 12-19-2013 at 14:29.
joshknifer is offline
Send a message via Skype™ to joshknifer
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 15:33.


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