AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Argument type mismatch (https://forums.alliedmods.net/showthread.php?t=309724)

PurposeLessx 08-05-2018 05:56

Argument type mismatch
 
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;



shauli 08-05-2018 06:02

Re: Argument type mismatch
 
Remove the const from the 'name' parameter in client_connectex or add const to the 'name' parameter in is_blocked_name, both will work.

PurposeLessx 08-05-2018 06:06

Re: Argument type mismatch
 
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 :)


All times are GMT -4. The time now is 12:34.

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