Raised This Month: $ Target: $400
 0% 

Orpheu: Changing weapon slot.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Owner123
Member
Join Date: Jun 2010
Old 06-23-2010 , 12:25   Orpheu: Changing weapon slot.
Reply With Quote #1

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
Owner123 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-23-2010 , 12:30   Re: Orpheu: Changing weapon slot.
Reply With Quote #2

With this sig, you should use what you have commented.
__________________
Arkshine is offline
Owner123
Member
Join Date: Jun 2010
Old 06-23-2010 , 12:32   Re: Orpheu: Changing weapon slot.
Reply With Quote #3

I uncomment this and comment other but AWP still is on slot1 but not on slot6 :F
__________________
Sorry for my bad english !
Owner123 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-23-2010 , 12:33   Re: Orpheu: Changing weapon slot.
Reply With Quote #4

Is the slot 5 working ?
__________________
Arkshine is offline
Owner123
Member
Join Date: Jun 2010
Old 06-23-2010 , 12:35   Re: Orpheu: Changing weapon slot.
Reply With Quote #5

No.
__________________
Sorry for my bad english !
Owner123 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-23-2010 , 13:11   Re: Orpheu: Changing weapon slot.
Reply With Quote #6

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         }     ] }
__________________
Arkshine is offline
Owner123
Member
Join Date: Jun 2010
Old 06-23-2010 , 13:48   Re: Orpheu: Changing weapon slot.
Reply With Quote #7

Thanks, works.
__________________
Sorry for my bad english !
Owner123 is offline
Reply



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 16:12.


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