Raised This Month: $ Target: $400
 0% 

[ SOLVED ] Problem with plugins based on knife


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 02-21-2017 , 17:37   [ SOLVED ] Problem with plugins based on knife
Reply With Quote #1

Hello, I'm having a little trouble to make plugins using the knife. I don't know if I am running the code in the wrong way, or if I'm missing something.

Well, the problem is as follows, I use ham_itemdeploy to change the model of the knife. Add's knife in an extra item of the zombie plague, or a command to give the player, but if that happens, the knife only changes if the player model change for a gun, and then return to using the knife.

Is there any way to fix this problem?
__________________









Last edited by CrazY.; 03-09-2017 at 17:21.
CrazY. is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 02-21-2017 , 18:13   Re: [ HELP ] Problem with plugins based on knife
Reply With Quote #2

Post your code
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-21-2017 , 19:13   Re: [ HELP ] Problem with plugins based on knife
Reply With Quote #3

Ham_itemdeploy isn't called when you change the model, so call it manually.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 02-21-2017 , 19:24   Re: [ HELP ] Problem with plugins based on knife
Reply With Quote #4

Code:
#include <amxmodx> 
#include <hamsandwich> 
#include <fakemeta> 

new const v_knife[] = "models/v_knife.mdl"

public plugin_init()
{     
	register_plugin("Basic Teste", "0.1", "Crazy")     
	RegisterHam(Ham_Item_Deploy, "weapon_knife", "Ham_ItemDeploy_Post", 1);
}

public plugin_precache()
{
	precache_model(v_knife);
}

public Ham_ItemDeploy_Post(player) 
{
    new id = get_pdata_cbase(player, 41, 4); 
	
    if(is_user_alive(id) || is_user_connected(id))   
        set_pev(id, pev_viewmodel2, v_knife) 
}
__________________








CrazY. is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 02-21-2017 , 23:13   Re: [ HELP ] Problem with plugins based on knife
Reply With Quote #5

Know you you're setting the default models, right? I think so. If your thing doesn't work, try another. I mean CurWeapon.

FYI, is_user_alive() already checks if the user is connected, or its the opposite, I don't think so. Then you need only one of them.

Check It https://forums.alliedmods.net/showthread.php?t=177337
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 02-21-2017 at 23:24.
EFFx is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 02-22-2017 , 18:20   Re: [ HELP ] Problem with plugins based on knife
Reply With Quote #6

is_user_alive automatically checks if the user is connected

Also, the code should work, the problem may come from within the zombie plague addons, or else you may use an outdated HLDS

PHP Code:
public Ham_ItemDeploy_Post(iEntity
{
    if(!
pev_valid(iEntity)) return HAM_IGNORED
    
    
new id get_pdata_cbase(iEntity414); 
    
    if(!
is_user_alive(id)) return HAM_IGNORED

    set_pev
(idpev_viewmodel2v_knife

__________________

Last edited by Depresie; 02-22-2017 at 18:21.
Depresie is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 02-22-2017 , 20:44   Re: [ HELP ] Problem with plugins based on knife
Reply With Quote #7

I and my bad programming in amxx haha'

Ok, I will check what is wrong.
__________________








CrazY. is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 02-23-2017 , 17:16   Re: [ HELP ] Problem with plugins based on knife
Reply With Quote #8

Hello, sorry for the Spam.

Well, I made the changes in my code but still with the same problems. The model of the knife only changes when the player exchange of gun, and now another problem arose. When the player buys custom knife, and then turns into a zombie, the model of the knife does not become "in the hands" of the zombie, but continues with the plugin. Any idea?
__________________








CrazY. is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 02-23-2017 , 17:25   Re: [ HELP ] Problem with plugins based on knife
Reply With Quote #9

Tenta explicar melhor.

Explain better. What you mean "in the hands"?
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 02-23-2017 , 17:41   Re: [ HELP ] Problem with plugins based on knife
Reply With Quote #10

Opa, mais um Brasileiro. Então cara, o problema é o seguinte. Quando o jogador compra a faca, o modelo só muda se trocarmos para uma outra arma. O segundo problema é que, quando o jogador que tem essa faca, é infectado, as mãos do zumbi que ele se transforma fica com o modelo do extra item que estou desenvolvendo. Entendeu?
__________________








CrazY. 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 21:03.


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