Raised This Month: $32 Target: $400
 8% 

error 035: argument type mismatch (argument 2)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
client21
Senior Member
Join Date: Apr 2013
Old 04-24-2013 , 13:28   error 035: argument type mismatch (argument 2)
Reply With Quote #1

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>

public OnPluginStart()
{
    
RegConsoleCmd("test"test);
}

public 
Action:test(clientargs)
{
    if (!(
client <= MaxClients))
        return 
Plugin_Handled;

    
decl player_list[MaxClients]; new players 0;
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && IsPlayerAlive(i)) player_list[players++] = i;
    }
    
Shake_(player_listplayers);

    return 
Plugin_Handled;
}

Shake_(const player_list[], const players)
{
    if (
players 1)
        return;

    new 
Handle:Message StartMessage("Shake"player_listplayers); // error 035: argument type mismatch (argument 2)
    
if (Message != INVALID_HANDLE)
    {
        
// blabla (not important)
    
}

To avoid this error, I must to do this:

PHP Code:
Shake_(const player_list[], const players)
{
    if (
players 1)
        return;

    
decl list[players];
    for (new 
0playersi++)
        list[
i] = player_list[i];

    new 
Handle:Message StartMessage("Shake", list, players);

I do not understand what is wrong in the first variant.
I understand I can do without the function "Shake_"

Last edited by client21; 04-24-2013 at 13:34.
client21 is offline
NinjaSK
Senior Member
Join Date: Sep 2012
Old 04-24-2013 , 14:20   Re: error 035: argument type mismatch (argument 2)
Reply With Quote #2

At what line do you get the error?

Basically, "argument type mismatch" means that you're inserting 1 type of argument into
a function which needs to receive an argument of different type.

For example: you will get this error if you input a integer into a function that requires a string.
NinjaSK is offline
client21
Senior Member
Join Date: Apr 2013
Old 04-24-2013 , 14:40   Re: error 035: argument type mismatch (argument 2)
Reply With Quote #3

Quote:
Originally Posted by NinjaSK View Post
At what line do you get the error?

Basically, "argument type mismatch" means that you're inserting 1 type of argument into
a function which needs to receive an argument of different type.

For example: you will get this error if you input a integer into a function that requires a string.
Be attentive. I pointed to the line with the error:

PHP Code:
new Handle:Message StartMessage("Shake"player_listplayers); // error 035: argument type mismatch (argument 2) 
And here are the same types of arguments.
client21 is offline
MasterOfTheXP
Veteran Member
Join Date: Aug 2011
Location: Cloudbank
Old 04-24-2013 , 15:14   Re: error 035: argument type mismatch (argument 2)
Reply With Quote #4

My only guess would be that you're trying to use a constant (const player_list) in the first one; list isn't a constant, so it works with StartMessage. Pretty picky.
__________________
Plugins / My Steam / TF2 Sandbox (plugin beta testing!)
MasterOfTheXP is offline
client21
Senior Member
Join Date: Apr 2013
Old 04-24-2013 , 15:25   Re: error 035: argument type mismatch (argument 2)
Reply With Quote #5

Yeah, right, if do this: Shake_(player_list[], players) - error disappears (thx).

Last edited by client21; 04-24-2013 at 15:26.
client21 is offline
NinjaSK
Senior Member
Join Date: Sep 2012
Old 04-24-2013 , 16:54   Re: error 035: argument type mismatch (argument 2)
Reply With Quote #6

Sorry, was doing a lot of other stuff at the same time...
NinjaSK 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 18:58.


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