View Single Post
Author Message
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-24-2015 , 11:40   Orpheu strange invalid param count error
Reply With Quote #1

My signature file:
Code:
{
    "name"        : "Spawn",
    "class"       : "CWeaponBox",
    "library"     : "mod",
    "identifiers" :
    [
        {
            "os"    : "windows",
            "mod"   : "cstrike",
            "value" : [0x56,0x8B,0xF1,0x8B,0x06,0xFF,0x50,0x04,0x8B,0x4E,0x04,"*","*","*","*","*","*","*","*","*","*",0xC7,0x81,0x08,0x01,0x00,0x00,0x06,0x00,0x00,0x00,0x8B]
        },
        {
            "os"    : "linux",
            "mod"   : "cstrike",
            "value" : "Spawn__10CWeaponBox"
        }
    ]
}
The log:
Code:
Parsing file "Spawn" started
	Function is updated
Parsing file "Spawn" ended
The call:
PHP Code:
WeaponBox OrpheuCall(CWeaponBox_Spawn
The error:
Code:
L 01/24/2015 - 08:33:54: [ORPHEU] Invalid parameters count. Expected [2]. Got [1]
L 01/24/2015 - 08:33:54: [AMXX] Displaying debug trace (plugin "test2.amxx")
L 01/24/2015 - 08:33:54: [AMXX] Run time error 10: native error (native "OrpheuCall")
L 01/24/2015 - 08:33:54: [AMXX]    [0] Untitled.sma::create (line 48)
Registering the func:
PHP Code:
CWeaponBox_Spawn OrpheuGetFunction("Spawn""CWeaponBox")
//OrpheuRegisterHook(CWeaponBox_Spawn,"CWeaponBoxSpawn",OrpheuHookPre) 
Why it says that the native expect two params ? I the signature the arguments field is empty since the function has void into the header.

I'm thinking that OrpheuCall need at least one argument(one arg + function index = two params), but:

PHP Code:
unsigned int paramsCount params[0] / sizeof(cell);

    Function* function = Global::
FunctionManagerObj->getFunction(params[1]);

    if (function)
    {
        
unsigned int expectedParamsCount + function->getArgumentsCount() + function->getIfReturnByRefParamsCount();

        if (
paramsCount == expectedParamsCount)
        {
            function->
blockHooks();
            return function->
call(amx, &params[2]);
        }
        else
        {
            
MF_LogError(amxAMX_ERR_NATIVE"Invalid parameters count. Expected [%d]. Got [%d]"expectedParamsCountparamsCount);
        }
    }
    else
    {
        
MF_LogError(amxAMX_ERR_NATIVE"Invalid function [%d]"params[1]);
    }

    return 
0
I see that here it does some calculation to determinate the needed param count, maybe there is something wrong ?

Any ideeas why this error apper when the function has no arguments ?
__________________

Last edited by HamletEagle; 01-24-2015 at 11:42.
HamletEagle is offline