Raised This Month: $ Target: $400
 0% 

[Help] How to use SetHamItemInfo correctly?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 05-23-2014 , 05:08   [Help] How to use SetHamItemInfo correctly?
Reply With Quote #1

Hi, i have a problem using this native.

Code:
/**
 * Sets a parameter on the fly of the current hook.
 * Use this on parameters that are iteminfo result handles.
 *
 * @param iteminfo_handle    Item info handle.
 * @param type                Item info type. See HamItemInfo_ constants.
 */
native SetHamItemInfo(iteminfo_handle, HamItemInfo:type, any:...);
I've tried in pre/post forward but still no update on my clip/bp ammo.
my code


Ham module from amx183:
Code:
amxx version
AMX Mod X 1.8.3-dev+55456ea (http://www.amxmodx.org)
Authors:
        David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
        Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
        Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
        Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: May  3 2014, 06:42:35
Build ID: 3806:55456eaf17d1767111cebccc37e94e20d8ec778f
Core mode: JIT+ASM32
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019

Last edited by yokomo; 05-23-2014 at 05:09.
yokomo is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 05-23-2014 , 05:23   Re: [Help] How to use SetHamItemInfo correctly?
Reply With Quote #2

Try registering it in plugin_precache. I remember playing with and it only worked in precache.
__________________


Last edited by NiHiLaNTh; 05-23-2014 at 05:23.
NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 05-23-2014 , 08:34   Re: [Help] How to use SetHamItemInfo correctly?
Reply With Quote #3

Quote:
Originally Posted by NiHiLaNTh View Post
Try registering it in plugin_precache. I remember playing with and it only worked in precache.
Awww you are right, i need to register hook post in "plugin_precache()". But strange i set iMaxAmmo1 to 100 but only show max 90 for AK47.
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-23-2014 , 10:06   Re: [Help] How to use SetHamItemInfo correctly?
Reply With Quote #4

There is something wrong somewhere. When I get the AK, and I want to buy ammos, I see Money called until I can't afford to buy them. It sounds like when it loops to give ammos, some check doesn't do the expected job to stop it. Maybe something wrong with if (player->m_rgAmmo[nAmmo] >= weapon->iMaxAmmo1()), is iMaxAmmo1 holding proper value? It should, as I see well the new value in WeaponList message and this uses ItemInfoArray to pass the value. Problem seems to be elsewhere.
__________________
Arkshine is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-23-2014 , 12:48   Re: [Help] How to use SetHamItemInfo correctly?
Reply With Quote #5

I know partially why it doesn't work.

It's because, for example AK47, MaxAmmo is 90 and is hardcoded in C762NatoAmmo::AddAmmo(), more as param in GiveAmmo.

So all you need to do is to hook Ham_GiveAmmo and changing last param with your new value.

I've tested it, it works fine.
__________________
Arkshine is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 05-23-2014 , 15:10   Re: [Help] How to use SetHamItemInfo correctly?
Reply With Quote #6

Quote:
Originally Posted by Arkshine View Post
I know partially why it doesn't work.

It's because, for example AK47, MaxAmmo is 90 and is hardcoded in C762NatoAmmo::AddAmmo(), more as param in GiveAmmo.

So all you need to do is to hook Ham_GiveAmmo and changing last param with your new value.

I've tested it, it works fine.
Thanks for your investigation, i will try on my code.
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo 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 09:41.


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