Raised This Month: $319 Target: $400
 79%   Almost there!

warning 209: function


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
szogun
Senior Member
Join Date: Apr 2016
Old 02-10-2018 , 06:25   warning 209: function
Reply With Quote #1

PHP Code:
#include <sourcemod>
#include <cstrike>
#include <sdktools>
 
new HandleTeam
 
public OnPluginStart( ) {
    
Team CreateConVar"sm_join_team""1""Do not edit this" )
    
AddCommandListener(CmdListener_Changeteam"jointeam");
    
AddCommandListener(CmdListener_Changeteam"changeteam");
    
HookEvent"player_connect_full"Event_OnFullConnectEventHookMode_Post )
}
 
public 
Event_OnFullConnectHandle:event, const String:name[ ], bool:dontBroadcast ) {
    new 
client GetClientOfUserIdGetEventIntevent"userid" ) )
   
    if( 
client != && IsClientInGameclient ) && !IsFakeClientclient ) && !bIsAdminRoot(client)) {
        
CreateTimer0.5AssignTeamclient )
    }
}
 
public 
ActionAssignTeamHandletimeranyclient ) {
    if( 
IsClientInGameclient ) ) {
        
int iCvar GetConVarIntTeam )
       
        switch( 
iCvar ) {
            case 
: {
                return 
Plugin_Handled
            
}
            case 
: {
                new 
iRediBlue;
                for(new 
1<= MaxClientsi++)
                {
                    if(!
IsClientInGame(i))
                        continue;
 
                    new 
iTeam GetClientTeam(i);
                    if(
iTeam == CS_TEAM_T)
                        
iRed++;
                    else if(
iTeam == CS_TEAM_CT)
                        
iBlue++;
                }
                if( 
iRed iBlue )
                {
                    
ChangeClientTeamclient)
                }
                else
                if( 
iRed iBlue )
                {
                    
ChangeClientTeamclient)
                }
                else
                if( 
iRed == iBlue )
                {
                    
ChangeClientTeamclient)
                }
                
CS_RespawnPlayer(client);
                           
            }
           
            case 
: {
                
ChangeClientTeamclient)
            }
           
            case 
: {
                
ChangeClientTeamclient)
            }
        }
    }
 
    return 
Plugin_Continue
}
public 
Action CmdListener_Changeteam(int client, const char[] commandint args)
{
    if(
bIsAdminRoot(client))
        return 
Plugin_Continue;
    
    if(
client && IsClientInGame(client) && GetClientTeam(client) > && !IsFakeClient(client))
        return 
Plugin_Handled;
}
 
bool bIsAdminRoot(int client)
{
    if(
GetUserFlagBits(client) & ADMFLAG_ROOT ADMFLAG_GENERIC
        return 
true;
    return 
false;

    } 
Where did I make a mistake?

Code:
warning 209: function "CmdListener_Changeteam" should retur
n a value
szogun is offline
pride95
Senior Member
Join Date: Aug 2015
Old 02-10-2018 , 06:32   Re: warning 209: function
Reply With Quote #2

PHP Code:

public Action CmdListener_Changeteam(int client, const char[] commandint args

    if(
bIsAdminRoot(client)) 
        return 
Plugin_Continue
     
    if(
client && IsClientInGame(client) && GetClientTeam(client) > && !IsFakeClient(client)) 
        return 
Plugin_Handled;

    return 
Plugin_Handled;

you return a value in if, but the function doesn't return a value if the both if are false.

Last edited by pride95; 02-10-2018 at 06:32.
pride95 is offline
szogun
Senior Member
Join Date: Apr 2016
Old 02-10-2018 , 06:59   Re: warning 209: function
Reply With Quote #3

I did it this way
Only now does not block the team change
PHP Code:
public Action CmdListener_Changeteam(int client, const char[] commandint args)
{
    if(
bIsAdminRoot(client))
        return 
Plugin_Continue;
    
    if(
client && IsClientInGame(client) && GetClientTeam(client) > && !IsFakeClient(client))
        return 
Plugin_Handled
    return 
Plugin_Handled


Last edited by szogun; 02-10-2018 at 06:59.
szogun is offline
pride95
Senior Member
Join Date: Aug 2015
Old 02-10-2018 , 07:48   Re: warning 209: function
Reply With Quote #4

Quote:
Originally Posted by szogun View Post
PHP Code:
public Action CmdListener_Changeteam(int client, const char[] commandint args)
{
    if(
bIsAdminRoot(client))
        return 
Plugin_Continue;
    
    if(
client && IsClientInGame(client) && GetClientTeam(client) > && !IsFakeClient(client))
        return 
Plugin_Handled
    return 
Plugin_Continue

return Plugin_Continue;
pride95 is offline
szogun
Senior Member
Join Date: Apr 2016
Old 02-10-2018 , 08:15   Re: warning 209: function
Reply With Quote #5

Unfortunately, the plugin still allows for a change of team
szogun is offline
pride95
Senior Member
Join Date: Aug 2015
Old 02-10-2018 , 08:21   Re: warning 209: function
Reply With Quote #6

PHP Code:
    if(bIsAdminRoot(client)) 
        return 
Plugin_Continue
maybe this function returns true for all players. or you have root admin and it returns true for you, so you can change your team.

PHP Code:
public Action CmdListener_Changeteam(int client, const char[] commandint args

    if(
bIsAdminRoot(client)) 
        return 
Plugin_Continue
     
     return 
Plugin_Handled;  

an you should use this. that verification of client > 0 etc its useless.

Last edited by pride95; 02-10-2018 at 08:21.
pride95 is offline
szogun
Senior Member
Join Date: Apr 2016
Old 02-10-2018 , 08:30   Re: warning 209: function
Reply With Quote #7

I do not have root on the server I'm testing
I changed what you gave but you can still change the team
It seems to me that the problem must be there

PHP Code:
if(bIsAdminRoot(client)) 
        return 
Plugin_Continue

Last edited by szogun; 02-10-2018 at 08:31.
szogun is offline
pride95
Senior Member
Join Date: Aug 2015
Old 02-10-2018 , 08:44   Re: warning 209: function
Reply With Quote #8

Quote:
Originally Posted by szogun View Post
I do not have root on the server I'm testing
I changed what you gave but you can still change the team
It seems to me that the problem must be there

PHP Code:
if(bIsAdminRoot(client)) 
        return 
Plugin_Continue
use
PHP Code:
if(GetAdminFlag(GetUserAdmin(client), Admin_Root)) 
pride95 is offline
szogun
Senior Member
Join Date: Apr 2016
Old 02-10-2018 , 09:59   Re: warning 209: function
Reply With Quote #9

The code given above also works correctly, your method also works.
The problem arises when firing another plugin that triggers conflict.
Thanks for the help
szogun is offline
Reply


Thread Tools
Display Modes

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 08:38.


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