Raised This Month: $7 Target: $400
 1% 

Detecting weapon change without Ham_Item_Deploy.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 12-23-2017 , 11:30   Detecting weapon change without Ham_Item_Deploy.
Reply With Quote #1

Is it possible?
__________________
gabuch2 is offline
TheWhitesmith
Senior Member
Join Date: Oct 2017
Location: Morocco :c
Old 12-23-2017 , 11:41   Re: Detecting weapon change without Ham_Item_Deploy.
Reply With Quote #2

CurWeapon and check if current weapon is last weapon?
__________________
TheWhitesmith is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-23-2017 , 12:02   Re: Detecting weapon change without Ham_Item_Deploy.
Reply With Quote #3

Why exactly you need another way?
__________________
HamletEagle is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 12-23-2017 , 13:08   Re: Detecting weapon change without Ham_Item_Deploy.
Reply With Quote #4

Quote:
Originally Posted by HamletEagle View Post
Why exactly you need another way?
A bit of background, I'm changing the v_ model of the weapon whenever I'm activating its zoom, I'm using SetFOV game message.

Code:
public zoomingIn(id) {     if(is_user_alive(id))     {         new newFOV = read_data(1);                 if(newFOV != 0)             pev(id, pev_viewmodel2, oldVModel[id], charsmax(oldVModel));                 switch(newFOV)         {             case 20:             {                 set_pev(id, pev_viewmodel, engfunc(EngFunc_AllocString, SNIPER_SCOPE));             }             case 40:             {                 set_pev(id, pev_viewmodel, engfunc(EngFunc_AllocString, NINEMMAR_SCOPE));             }             case 41:             {                 set_pev(id, pev_viewmodel, engfunc(EngFunc_AllocString, IRONSIGHTS_SCOPE));             }             case 0:             {                 set_pev(id, pev_viewmodel, engfunc(EngFunc_AllocString, oldVModel[id]));             }         }     } }

However, this method gets called if you change weapons when you are zooming, the problem with this is it's called AFTER the weapon is changed, so it will change the model of the new weapon to the model of the old weapon.

I was thinking on hooking an item deploy to add some sort of check, I can't use Ham_Item_Deploy because it's not hooked on custom weapons.
__________________

Last edited by gabuch2; 12-23-2017 at 13:08.
gabuch2 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-23-2017 , 14:07   Re: Detecting weapon change without Ham_Item_Deploy.
Reply With Quote #5

Check weapon index and change only if it's the index you want?

Quote:
I was thinking on hooking an item deploy to add some sort of check, I can't use Ham_Item_Deploy because it's not hooked on custom weapons.
What do you mean by custom weapons?
__________________

Last edited by HamletEagle; 12-23-2017 at 14:08.
HamletEagle is offline
Reply


Thread Tools
Display Modes

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 04:13.


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