AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Orpheu: Changing weapon slot. (https://forums.alliedmods.net/showthread.php?t=130390)

Owner123 06-23-2010 12:25

Orpheu: Changing weapon slot.
 
Hi all.
I want to change awp slot from 1 to 6.
I try with normal function and with virtual function.
I use this code:
PHP Code:

#include <amxmodx>
#include <orpheu>

public plugin_init()
{
    
register_plugin("New Plugin""1.0""Owner")
    new 
OrpheuFunction:HookAwpSlot OrpheuGetFunction("iItemSlot""CAWP"// i use this
    //new OrpheuFunction:HookAwpSlot = OrpheuGetFunctionFromClass("weapon_awp", "iItemSlot", "CAWP") // or this
    
OrpheuRegisterHook(HookAwpSlot"OnAwpSlot")
}

public 
OnAwpSlot(weapon_awp)
    
OrpheuSetReturn(6

And with this(now as virtual function but i change this to normal function):
Code:

{
    "name" : "iItemSlot",
    "class" : "CAWP",
    "library" : "mod",
    "return" :
    {
        "type" : "int"
    },
    "indexes" :
    [
        {
            "os" : "windows",
            "mod" : "cstrike",
            "value" : 79
        },
        {
            "os" : "linux",
            "mod" : "cstrike",
            "value" : 81
        }
    ]
}

But it still dont work :s

Arkshine 06-23-2010 12:30

Re: Orpheu: Changing weapon slot.
 
With this sig, you should use what you have commented.

Owner123 06-23-2010 12:32

Re: Orpheu: Changing weapon slot.
 
I uncomment this and comment other but AWP still is on slot1 but not on slot6 :F

Arkshine 06-23-2010 12:33

Re: Orpheu: Changing weapon slot.
 
Is the slot 5 working ?

Owner123 06-23-2010 12:35

Re: Orpheu: Changing weapon slot.
 
No.

Arkshine 06-23-2010 13:11

Re: Orpheu: Changing weapon slot.
 
Well, you use the wrong function.

Code:
#include <amxmodx> #include <orpheu> public plugin_precache() {     OrpheuRegisterHook( OrpheuGetFunctionFromClass( "weapon_awp", "GetItemInfo", "CBasePlayerItem" ), "OnGetItemInfoAWP", OrpheuHookPost ); } public OnGetItemInfoAWP( const item, const itemInfo) {     OrpheuSetParamStructMember( 2, "iSlot", 5 ); // 5 = slot 6 }

with the signature, in a file named GetItemInfo in virtualFunctions/CBasePlayerItem/ :

Code:
{     "name"      : "GetItemInfo",     "class"     : "CBasePlayerItem",     "library"   : "mod",     "arguments" :     [         {             "type" : "ItemInfo *"         }     ],     "return" :     {         "type" : "int"     },     "indexes" :     [         {             "os"    : "windows",             "mod"   : "cstrike",             "value" : 61         },         {             "os"    : "linux",             "mod"   : "cstrike",             "value" : 63         }     ] }

Owner123 06-23-2010 13:48

Re: Orpheu: Changing weapon slot.
 
Thanks, works. :)


All times are GMT -4. The time now is 14:50.

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