AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Orpheu] Invalid parameter count (https://forums.alliedmods.net/showthread.php?t=168011)

drekes 09-23-2011 09:23

[Orpheu] Invalid parameter count
 
I've been playing around with orpheu and i got this error that i don't understand.

Code:

L 09/23/2011 - 15:19:07: [ORPHEU] Invalid parameters count. Expected [5]. Got [4]
L 09/23/2011 - 15:19:07: [AMXX] Displaying debug trace (plugin "test.amxx")
L 09/23/2011 - 15:19:07: [AMXX] Run time error 10: native error (native "OrpheuCall")
L 09/23/2011 - 15:19:07: [AMXX]    [0] test.sma::CmdGib (line 24)

According to the hlsdk & the linux binaries in IDA pro it only has 3 parameters:

Code:

void CGib :: SpawnStickyGibs( entvars_t *pevVictim, Vector vecOrigin, int cGibs )
{
        int i;

        if ( g_Language == LANGUAGE_GERMAN )
        {
                // no sticky gibs in germany right now!
                return;
        }

        for ( i = 0 ; i < cGibs ; i++ )
        {
                CGib *pGib = GetClassPtr( (CGib *)NULL );

                pGib->Spawn( "models/stickygib.mdl" );
                pGib->pev->body = RANDOM_LONG(0,2);

                if ( pevVictim )
                {
                        pGib->pev->origin.x = vecOrigin.x + RANDOM_FLOAT( -3, 3 );
                        pGib->pev->origin.y = vecOrigin.y + RANDOM_FLOAT( -3, 3 );
                        pGib->pev->origin.z = vecOrigin.z + RANDOM_FLOAT( -3, 3 );

                        /*
                        pGib->pev->origin.x = pevVictim->absmin.x + pevVictim->size.x * (RANDOM_FLOAT ( 0 , 1 ) );
                        pGib->pev->origin.y = pevVictim->absmin.y + pevVictim->size.y * (RANDOM_FLOAT ( 0 , 1 ) );
                        pGib->pev->origin.z = pevVictim->absmin.z + pevVictim->size.z * (RANDOM_FLOAT ( 0 , 1 ) );
                        */

                        // make the gib fly away from the attack vector
                        pGib->pev->velocity = g_vecAttackDir * -1;

                        // mix in some noise
                        pGib->pev->velocity.x += RANDOM_FLOAT ( -0.15, 0.15 );
                        pGib->pev->velocity.y += RANDOM_FLOAT ( -0.15, 0.15 );
                        pGib->pev->velocity.z += RANDOM_FLOAT ( -0.15, 0.15 );

                        pGib->pev->velocity = pGib->pev->velocity * 900;

                        pGib->pev->avelocity.x = RANDOM_FLOAT ( 250, 400 );
                        pGib->pev->avelocity.y = RANDOM_FLOAT ( 250, 400 );

                        // copy owner's blood color
                        pGib->m_bloodColor = (CBaseEntity::Instance(pevVictim))->BloodColor();
               
                        if ( pevVictim->health > -50)
                        {
                                pGib->pev->velocity = pGib->pev->velocity * 0.7;
                        }
                        else if ( pevVictim->health > -200)
                        {
                                pGib->pev->velocity = pGib->pev->velocity * 2;
                        }
                        else
                        {
                                pGib->pev->velocity = pGib->pev->velocity * 4;
                        }

                       
                        pGib->pev->movetype = MOVETYPE_TOSS;
                        pGib->pev->solid = SOLID_BBOX;
                        UTIL_SetSize ( pGib->pev, Vector ( 0, 0 ,0 ), Vector ( 0, 0, 0 ) );
                        pGib->SetTouch ( &CGib::StickyGibTouch );
                        pGib->SetThink (NULL);
                }
                pGib->LimitVelocity();
        }
}



My code:
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <orpheu>

new OrpheuFunctionFwdSpawnStickyGibs;

public 
plugin_precache()
    
precache_model("models/stickygib.mdl");
    
    
public 
plugin_init()
{
    
FwdSpawnStickyGibs OrpheuGetFunction("SpawnStickyGibs""CGib");

    
register_clcmd("say /gib""CmdGib");
}


public 
CmdGib(id)
{
    new 
FloatflOrigin[3];
    
pev(idpev_originflOrigin);
    
    
OrpheuCall(FwdSpawnStickyGibsidflOrigin10);

    
client_print(idprint_chat"GIBBING...");



Signature:
Code:

{
        "name"                : "SpawnStickyGibs",
        "class"                : "CGib",
        "library"        : "mod",
        "arguments" :
        [
                {
                        "info" : "Victim id",
                        "type" : "entvars_s *"
                },
                {
                        "info" : "Origin",
                        "type" : "Vector"
                },
                {
                        "info" : "Amount of gibs",
                        "type" : "int"
                }
        ],
        "identifiers":
        [
                {
                        "os"        : "windows",
                        "mod"        : "cstrike",
                        "value"        : [0x8B,0x49,"*",0x83,0xEC,"*",0x83,0xC1,"*",0xD9,0x41,"*",0xD9,0x41,"*",0xD9]
                },
                {
                        "os"        : "linux",
                        "mod"        : "cstrike",
                        "value" : "SpawnStickyGibs__4CGibP9entvars_sG6Vectori"
                }
        ]
}


Bugsy 09-23-2011 09:48

Re: [Orpheu] Invalid parameter count
 
I don't think orpheu has support for Vector at this point. I'm sure Arkshine or quim will chime in to confirm the problem.

drekes 09-23-2011 10:00

Re: [Orpheu] Invalid parameter count
 
Yeah, i've checked the orpheu thread again & found these data types:
Code:

    "bool"
    "byte"
    "long"
    "CBaseEntity *"
    "char *"
    "edict_s *"
    "float"
    "Vector *"
    "CMBaseMonster *"
    "char"
    "short"
    "entvars_s *"

I guess i'll just have to wait for an update :)

Thanks


Edit:
The argument type is accepted when the signatures are loaded though, not sure if this means anything:
Code:

Parsing file "SpawnStickyGibs" started
 Argument type "entvars_s *" validated
 Argument type "Vector" validated
 Argument type "int" validated
 Searching for signature "[0x8b][0x49][*][0x83][0xec](...)" ... FOUND
Parsing file "SpawnStickyGibs"


jim_yang 09-23-2011 10:15

Re: [Orpheu] Invalid parameter count
 
don't wait for the update, cause you can't pass a class member as parameter through pawn, you will find that all the para types listed above are actually sort of value, number or address. that's the limitation of this script stuff.

drekes 09-23-2011 10:28

Re: [Orpheu] Invalid parameter count
 
I don't know much about those things :S

Could you explain what class members are ?

jim_yang 09-23-2011 10:29

Re: [Orpheu] Invalid parameter count
 
a member of a class, like Vector origin;
origin is the member of class "Vector"

hleV 09-23-2011 10:29

Re: [Orpheu] Invalid parameter count
 
Quote:

Originally Posted by drekes (Post 1561435)
Could you explain what class members are ?

Variables and functions declared in a class. Same goes for Pawn's enumerations.
PHP Code:

enum TestEnumeration
{
    
TestVariable,
    
TestArray[2]
}; 

TestVariable and TestArray[] are members of TestEnumeration.

drekes 09-23-2011 10:37

Re: [Orpheu] Invalid parameter count
 
Okay, now i get it.

So there's no way to handle that function ?

jim_yang 09-23-2011 10:43

Re: [Orpheu] Invalid parameter count
 
then orpheu will change the way how it works, like get the float x,y,z pawn passed, and declare temp Vector(x, y, z), pass manually to that function. that conflit with the original procedure how orpheu does.

drekes 09-23-2011 10:46

Re: [Orpheu] Invalid parameter count
 
I'll try to figure it out, thanks everyone.

Edit:
I seem to have the same problem with CGib::SpawnHeadGib() which doesn't use Vector *

My code:
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <orpheu>

new OrpheuFunctionFwdSpawnHeadGib;


public 
plugin_init()
{
    
FwdSpawnHeadGib OrpheuGetFunction("SpawnHeadGib""CGib");
    
    
register_clcmd("say /gib""CmdGib");
}


public 
CmdGib(id)
{
    
OrpheuCall(FwdSpawnHeadGibid);
    
    return 
PLUGIN_HANDLED;


Signature:
Code:

{
        "name"                : "SpawnHeadGib",
        "class"                : "CGib",
        "library"        : "mod",
        "arguments" :
        [
                {
                        "info" : "Player Id",
                        "type" : "entvars_s *"
                }
        ],
        "identifiers":
        [
                {
                        "os"        : "windows",
                        "mod"        : "cstrike",
                        "value"        : [0x83,0xEC,"*",0x56,0x57,0xFF,"*","*","*","*","*",0x85,0xC0,"*","*",0x33,0xFF,"*","*",0x8D,0xB8,"*","*","*","*",0x8B,0x87,"*","*","*","*",0x85,0xC0,"*","*",0x8B,0x70,"*",0x85,0xF6,"*","*",0x68,"*","*","*","*",0x50,0xFF,"*","*","*","*","*",0x83,0xC4,"*"]
                },
                {
                        "os"        : "linux",
                        "mod"        : "cstrike",
                        "value" : "SpawnHeadGib__4CGibP9entvars_s"
                }
        ]
}

Error:
Code:

L 09/23/2011 - 17:23:34: [ORPHEU] Invalid parameters count. Expected [3]. Got [2]
L 09/23/2011 - 17:23:34: [AMXX] Displaying debug trace (plugin "test.amxx")
L 09/23/2011 - 17:23:34: [AMXX] Run time error 10: native error (native "OrpheuCall")
L 09/23/2011 - 17:23:34: [AMXX]    [0] test.sma::CmdGib (line 18)



All times are GMT -4. The time now is 19:31.

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