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

[HELP] ERROR: function prototypes do not match


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
einsfuhrer
Member
Join Date: Jun 2019
Old 07-10-2019 , 11:46   [HELP] ERROR: function prototypes do not match
Reply With Quote #1

Hay, got another error on the plugin I'm making and help is appreciated.

So I get this error when I compile:
Code:
(34) : error 100: function prototypes do not match
This is my RegAdminCmd part:
PHP Code:
RegAdminCmd("sm_hidetag"Command_hidetagADMFLAG_KICK); 
And here is my callback function:
PHP Code:
public Action Command_hidetag(const char[] sCommandint iClientint sArgs)
{
    if (
StrEqual(sCommand"say"))
    {
        
int iTeam GetClientTeam(iClient);
        
        if (
iTeam 0)
        {
            if (
IsClientInGame(iClient))
            {
                if(
IsPlayerAlive(iClient)) 
                {   
                    if (
CheckCommandAccess(iClient"chattag"ADMFLAG_ROOT))
                    {
                        if (
GetClientTeam(iClient) == 3)
                            
PrintToChatAll(" \x0AHIDEROLE \x01| \x0B%N \x08» \x01%s"iClientsArgs);
                                
                        if (
GetClientTeam(iClient) == 2)
                            
PrintToChatAll(" \x0AHIDEROLE \x01| \x09%N \x08» \x01%s"iClientsArgs);

                        else if (
GetClientTeam(iClient) == 1)
                            
PrintToChatAll(" \x0AHIDEROLE \x01| \x03%N \x08» \x01%s"iClientsArgs);
                    }
                    else if (
CheckCommandAccess(iClient"chattag"ADMFLAG_RCON))
                    {
                        if (
GetClientTeam(iClient) == 3)
                            
PrintToChatAll(" \x04MANAGER \x01| \x0B%N \x08» \x01%s"iClientsArgs);
                                
                        if (
GetClientTeam(iClient) == 2)
                            
PrintToChatAll(" \x04MANAGER \x01| \x09%N \x08» \x01%s"iClientsArgs);

                        else if (
GetClientTeam(iClient) == 1)
                            
PrintToChatAll(" \x04MANAGER \x01| \x03%N \x08» \x01%s"iClientsArgs);
                    }
                    else
                    {
                        if (
GetClientTeam(iClient) == 3)
                            
PrintToChatAll(" \x08\x01\x0B%N \x08» \x01%s"iClientsArgs);
                                
                        if (
GetClientTeam(iClient) == 2)
                            
PrintToChatAll(" \x08\x01\x09%N \x08» \x01%s"iClientsArgs);

                        else if (
GetClientTeam(iClient) == 1)
                            
PrintToChatAll(" \x08\x01\x03%N \x08» \x01%s"iClientsArgs);
                    }
                }
                else
                {
                    if (
CheckCommandAccess(iClient"chattag"ADMFLAG_ROOT))
                {
                    if (
GetClientTeam(iClient) == 3)
                        
PrintToChatAll(" \x0FDEAD \x01| \x0AHIDEROLE \x01| \x0B%N \x08» \x01%s"iClientsArgs);
                            
                    if (
GetClientTeam(iClient) == 2)
                        
PrintToChatAll(" \x0FDEAD \x01|  \x0AHIDEROLE \x01| \x09%N \x08» \x01%s"iClientsArgs);

                    else if (
GetClientTeam(iClient) == 1)
                        
PrintToChatAll(" \x0FDEAD \x01|  \x0AHIDEROLE \x01| \x03%N \x08» \x01%s"iClientsArgs);
                }
                else if (
CheckCommandAccess(iClient"chattag"ADMFLAG_RCON))
                {
                    if (
GetClientTeam(iClient) == 3)
                        
PrintToChatAll(" \x0FDEAD \x01|  \x04MANAGER \x01| \x0B%N \x08» \x01%s"iClientsArgs);
                            
                    if (
GetClientTeam(iClient) == 2)
                        
PrintToChatAll(" \x0FDEAD \x01|  \x04MANAGER \x01| \x09%N \x08» \x01%s"iClientsArgs);

                    else if (
GetClientTeam(iClient) == 1)
                        
PrintToChatAll(" \x0FDEAD \x01|  \x04MANAGER \x01| \x03%N \x08» \x01%s"iClientsArgs);
                }
                else
                {
                    if (
GetClientTeam(iClient) == 3)
                        
PrintToChatAll(" \x0FDEAD \x01|  \x08\x01\x0B%N \x08» \x01%s"iClientsArgs);
                            
                    if (
GetClientTeam(iClient) == 2)
                        
PrintToChatAll(" \x0FDEAD \x01|  \x08\x01\x09%N \x08» \x01%s"iClientsArgs);

                    else if (
GetClientTeam(iClient) == 1)
                        
PrintToChatAll(" \x0FDEAD \x01|  \x08\x01\x03%N \x08» \x01%s"iClientsArgs);
                }
                }
            }
        }
    }

einsfuhrer is offline
Whai
Senior Member
Join Date: Jul 2018
Old 07-10-2019 , 12:29   Re: [HELP] ERROR: function prototypes do not match
Reply With Quote #2

From console.inc :

PHP Code:
/**
 * Called when a generic console command is invoked.
 *
 * @param client        Index of the client, or 0 from the server.
 * @param args            Number of arguments that were in the argument string.
 * @return                An Action value.  Not handling the command
 *                        means that Source will report it as "not found."
 */
typedef ConCmd = function Action (int clientint args); 
so your
PHP Code:
public Action Command_hidetag(const char[] sCommandint iClientint sArgs
does not match.
__________________

Last edited by Whai; 07-10-2019 at 12:29.
Whai is offline
einsfuhrer
Member
Join Date: Jun 2019
Old 07-10-2019 , 13:01   Re: [HELP] ERROR: function prototypes do not match
Reply With Quote #3

Quote:
Originally Posted by Whai View Post
From console.inc :

PHP Code:
/**
 * Called when a generic console command is invoked.
 *
 * @param client        Index of the client, or 0 from the server.
 * @param args            Number of arguments that were in the argument string.
 * @return                An Action value.  Not handling the command
 *                        means that Source will report it as "not found."
 */
typedef ConCmd = function Action (int clientint args); 
so your
PHP Code:
public Action Command_hidetag(const char[] sCommandint iClientint sArgs
does not match.
It fixed that problem but made another one:

Code:
(393) : error 017: undefined symbol "sCommand"
Part of code:
PHP Code:
public Action Command_hidetag(int iClientint sArgs)
{
    if (
StrEqual(sCommand"say"))
    {
        
int iTeam GetClientTeam(iClient);
        
        if (
iTeam 0)
        {
            if (
IsClientInGame(iClient))
            {
                if(
IsPlayerAlive(iClient)) 
                {   
                    if (
CheckCommandAccess(iClient"chattag"ADMFLAG_ROOT))
                    {
                        if (
GetClientTeam(iClient) == 3)
                            
PrintToChatAll(" \x0AHIDEROLE \x01| \x0B%N \x08» \x01%s"iClientsArgs);
                                
                        if (
GetClientTeam(iClient) == 2)
                            
PrintToChatAll(" \x0AHIDEROLE \x01| \x09%N \x08» \x01%s"iClientsArgs);

                        else if (
GetClientTeam(iClient) == 1)
                            
PrintToChatAll(" \x0AHIDEROLE \x01| \x03%N \x08» \x01%s"iClientsArgs);
                    }
                    else if (
CheckCommandAccess(iClient"chattag"ADMFLAG_RCON))
                    {
                        if (
GetClientTeam(iClient) == 3)
                            
PrintToChatAll(" \x04MANAGER \x01| \x0B%N \x08» \x01%s"iClientsArgs);
                                
                        if (
GetClientTeam(iClient) == 2)
                            
PrintToChatAll(" \x04MANAGER \x01| \x09%N \x08» \x01%s"iClientsArgs);

                        else if (
GetClientTeam(iClient) == 1)
                            
PrintToChatAll(" \x04MANAGER \x01| \x03%N \x08» \x01%s"iClientsArgs);
                    }
                    else
                    {
                        if (
GetClientTeam(iClient) == 3)
                            
PrintToChatAll(" \x08\x01\x0B%N \x08» \x01%s"iClientsArgs);
                                
                        if (
GetClientTeam(iClient) == 2)
                            
PrintToChatAll(" \x08\x01\x09%N \x08» \x01%s"iClientsArgs);

                        else if (
GetClientTeam(iClient) == 1)
                            
PrintToChatAll(" \x08\x01\x03%N \x08» \x01%s"iClientsArgs);
                    }
                }
                else
                {
                    if (
CheckCommandAccess(iClient"chattag"ADMFLAG_ROOT))
                {
                    if (
GetClientTeam(iClient) == 3)
                        
PrintToChatAll(" \x0FDEAD \x01| \x0AHIDEROLE \x01| \x0B%N \x08» \x01%s"iClientsArgs);
                            
                    if (
GetClientTeam(iClient) == 2)
                        
PrintToChatAll(" \x0FDEAD \x01|  \x0AHIDEROLE \x01| \x09%N \x08» \x01%s"iClientsArgs);

                    else if (
GetClientTeam(iClient) == 1)
                        
PrintToChatAll(" \x0FDEAD \x01|  \x0AHIDEROLE \x01| \x03%N \x08» \x01%s"iClientsArgs);
                }
                else if (
CheckCommandAccess(iClient"chattag"ADMFLAG_RCON))
                {
                    if (
GetClientTeam(iClient) == 3)
                        
PrintToChatAll(" \x0FDEAD \x01|  \x04MANAGER \x01| \x0B%N \x08» \x01%s"iClientsArgs);
                            
                    if (
GetClientTeam(iClient) == 2)
                        
PrintToChatAll(" \x0FDEAD \x01|  \x04MANAGER \x01| \x09%N \x08» \x01%s"iClientsArgs);

                    else if (
GetClientTeam(iClient) == 1)
                        
PrintToChatAll(" \x0FDEAD \x01|  \x04MANAGER \x01| \x03%N \x08» \x01%s"iClientsArgs);
                }
                else
                {
                    if (
GetClientTeam(iClient) == 3)
                        
PrintToChatAll(" \x0FDEAD \x01|  \x08\x01\x0B%N \x08» \x01%s"iClientsArgs);
                            
                    if (
GetClientTeam(iClient) == 2)
                        
PrintToChatAll(" \x0FDEAD \x01|  \x08\x01\x09%N \x08» \x01%s"iClientsArgs);

                    else if (
GetClientTeam(iClient) == 1)
                        
PrintToChatAll(" \x0FDEAD \x01|  \x08\x01\x03%N \x08» \x01%s"iClientsArgs);
                }
                }
            }
        }
    }

This is another function in the code that works, there is sCommand in the function parentheses but when I put sCommand in the RegAdminCmd it will give the recent error:

PHP Code:
public Action OnClientSayCommand(int iClient, const char[] sCommand, const char[] sArgs)
{
    
int iTimeiYeariMonthiDayiHouriMinuteiSecond;
    
    
iTime GetTime();
    
    
UnixToTime(iTimeiYeariMonthiDayiHouriMinuteiSecondiTimezone);
    
    if (
StrEqual(sCommand"say"))
    {
        
int iTeam GetClientTeam(iClient);
        
        if (
iTeam 0)
        {
            if (
IsClientInGame(iClient))
            { 
What should I do to get the sCommand to get defined?

Last edited by einsfuhrer; 07-10-2019 at 13:02.
einsfuhrer is offline
Whai
Senior Member
Join Date: Jul 2018
Old 07-10-2019 , 13:07   Re: [HELP] ERROR: function prototypes do not match
Reply With Quote #4

Why do you need
Code:
if (StrEqual(sCommand, "say"))
on Command_hidetag callback and OnClientSayCommand forward ?

that is useless, just remove it because :
_ OnClientSayCommand is triggered when a player wrote in chat
_ Command_hidetag is the callback of
Code:
RegAdminCmd("sm_hidetag", Command_hidetag, ADMFLAG_KICK);
that creates the command sm_hidetag for the console and !hidetag, /hidetag, !sm_hidetag and /sm_hidetag for the chat.
__________________

Last edited by Whai; 07-10-2019 at 13:08.
Whai is offline
einsfuhrer
Member
Join Date: Jun 2019
Old 07-10-2019 , 13:14   Re: [HELP] ERROR: function prototypes do not match
Reply With Quote #5

Because when I send the !hidetag I want the OWNER tag to disappear (right now I'm just having "Hiderole" to see if it works). But when I removed the "if (StrEqual(sCommand, "say"))" it just sends a empty message: https://gyazo.com/42b8c815272ad6c5c1d8d04f06338ebc

I want to send the command and all messages after that should be with no tag and if i type !hidetag again it will take the tag back.
einsfuhrer is offline
Whai
Senior Member
Join Date: Jul 2018
Old 07-10-2019 , 13:36   Re: [HELP] ERROR: function prototypes do not match
Reply With Quote #6

Ok, now I understand what you're looking for, but you still don't need "if (StrEqual(sCommand, "say"))" for the same reason I said above.

Use instead :
Code:
if (StrEqual(sArgs, "!hidetag") || StrEqual(sArgs, "/hidetag"))
after that, at the end of the block code : write "return Plugin_Handled" to block the message you did "/hidetag" or "!hidetag"
__________________
Whai is offline
einsfuhrer
Member
Join Date: Jun 2019
Old 07-10-2019 , 13:47   Re: [HELP] ERROR: function prototypes do not match
Reply With Quote #7

Quote:
Originally Posted by Whai View Post
Ok, now I understand what you're looking for, but you still don't need "if (StrEqual(sCommand, "say"))" for the same reason I said above.

Use instead :
Code:
if (StrEqual(sArgs, "!hidetag") || StrEqual(sArgs, "/hidetag"))
after that, at the end of the block code : write "return Plugin_Handled" to block the message you did "/hidetag" or "!hidetag"
Thanks but that gives a error on the line where "if (StrEqual(...":
Code:
error 035: argument type mismatch (argument 1)
Code:
PHP Code:
public Action Command_hidetag(int iClientint sArgs)
{
    if (
StrEqual(sArgs"!hidetag") || StrEqual(sArgs"/hidetag"))
    { 
This is the code where I put the return "Plugin_Handled;":
PHP Code:
                }
            }
        }
    }
    return 
Plugin_Handled;

einsfuhrer is offline
Whai
Senior Member
Join Date: Jul 2018
Old 07-10-2019 , 14:34   Re: [HELP] ERROR: function prototypes do not match
Reply With Quote #8

You do not need to put in
Code:
public Action Command_hidetag(int iClient, int sArgs)
just put in
Code:
public Action OnClientSayCommand(int iClient, const char[] sCommand, const char[] sArgs)
it will do the work, don't forget the return Plugin_Handled
__________________
Whai is offline
einsfuhrer
Member
Join Date: Jun 2019
Old 07-10-2019 , 15:21   Re: [HELP] ERROR: function prototypes do not match
Reply With Quote #9

Quote:
Originally Posted by Whai View Post
You do not need to put in
Code:
public Action Command_hidetag(int iClient, int sArgs)
just put in
Code:
public Action OnClientSayCommand(int iClient, const char[] sCommand, const char[] sArgs)
it will do the work, don't forget the return Plugin_Handled
I want to toggle that my tag isnt showing. Like this:

You are Admin on a server and then you want to sneak on players and see if they are breaking rules or something so you want to hide your chattag. Then you type /hidetag and then all messages you write will not show your tag, and when you want your tag again you just type /hidetag again and it will come back.

Right now it just changes the tag only on the message when I type !hidetag.
einsfuhrer is offline
Whai
Senior Member
Join Date: Jul 2018
Old 07-10-2019 , 16:01   Re: [HELP] ERROR: function prototypes do not match
Reply With Quote #10

Ok, now I know what you want,
  • Create a global array bool variable (name whatever you want like for exemple : "g_bTagHid") with the sizeof MAXPLAYERS + 1
  • On "public Action Command_hidetag(int iClient, int sArgs)" remove all and write :
    Spoiler
  • On "public Action OnClientSayCommand(int iClient, const char[] sCommand, const char[] sArgs)", just check if g_bTagHidden[iClient] is true to block the message that would display then do the "PrintToChatAll" thing
__________________
Whai 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 22:07.


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