PDA

View Full Version : Orpheu: Changing weapon slot.


Owner123
06-23-2010, 12:25
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:
#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):
{
"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
With this sig, you should use what you have commented.

Owner123
06-23-2010, 12:32
I uncomment this and comment other but AWP still is on slot1 but not on slot6 :F

Arkshine
06-23-2010, 12:33
Is the slot 5 working ?

Owner123
06-23-2010, 12:35
No.

Arkshine
06-23-2010, 13:11
Well, you use the wrong function.


#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/ :


{
"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
Thanks, works. :)