Raised This Month: $ Target: $400
 0% 

Argument type mismatch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 08-05-2018 , 05:56   Argument type mismatch
Reply With Quote #1

Hey friends, I made a plugin but the plugin throws an error.
How can I fix it?

Code:
Error: Argument type mismatch (argument 1) on line 5
PHP Code:
#include <amxmodx>

public client_connectex(id, const name[], const ip[], reason[128])
{
    if(
is_blocked_name(name))
    {
        
formatex(reasoncharsmax(reason), "Change nickname");
        return 
1;
    }
    return 
0;
}

bool:is_blocked_name(name[])
{
    new 
len strlen(name);

    return (
len 5) ? true:false;

__________________
A plugin that is needed for every server.
PHP Code:
public client_connect(id)
{
    if(
get_user_iq(id) < 80)
    {
        
server_cmd("kick #%d 'You have kicked from the server because your IQ is not high enough'"get_user_userid(id));
    }

PurposeLessx is offline
shauli
Member
Join Date: Jun 2018
Old 08-05-2018 , 06:02   Re: Argument type mismatch
Reply With Quote #2

Remove the const from the 'name' parameter in client_connectex or add const to the 'name' parameter in is_blocked_name, both will work.
shauli is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 08-05-2018 , 06:06   Re: Argument type mismatch
Reply With Quote #3

If I remove const from client_connectex, throws an error.

Code:
Error: Function heading differs from prototype on line 23
But If I add const to the name parameter in is_blocked_name, works. Thanks
__________________
A plugin that is needed for every server.
PHP Code:
public client_connect(id)
{
    if(
get_user_iq(id) < 80)
    {
        
server_cmd("kick #%d 'You have kicked from the server because your IQ is not high enough'"get_user_userid(id));
    }

PurposeLessx is offline
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 08:48.


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